Improve services on boot
This commit is contained in:
parent
e41cf78b53
commit
ca84aa7a13
18
vpnsetup.sh
18
vpnsetup.sh
@ -387,16 +387,22 @@ exit 0
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Start services at boot
|
# Start services at boot
|
||||||
update-rc.d fail2ban enable >/dev/null 2>&1
|
for svc in fail2ban ipsec xl2tpd; do
|
||||||
systemctl enable fail2ban >/dev/null 2>&1
|
update-rc.d "$svc" enable >/dev/null 2>&1
|
||||||
|
systemctl enable "$svc" >/dev/null 2>&1
|
||||||
|
done
|
||||||
if ! grep -qs "hwdsl2 VPN script" /etc/rc.local; then
|
if ! grep -qs "hwdsl2 VPN script" /etc/rc.local; then
|
||||||
conf_bk "/etc/rc.local"
|
if [ -f /etc/rc.local ]; then
|
||||||
sed --follow-symlinks -i '/^exit 0/d' /etc/rc.local
|
conf_bk "/etc/rc.local"
|
||||||
|
sed --follow-symlinks -i '/^exit 0/d' /etc/rc.local
|
||||||
|
else
|
||||||
|
echo '#!/bin/sh' > /etc/rc.local
|
||||||
|
fi
|
||||||
cat >> /etc/rc.local <<'EOF'
|
cat >> /etc/rc.local <<'EOF'
|
||||||
|
|
||||||
# Added by hwdsl2 VPN script
|
# Added by hwdsl2 VPN script
|
||||||
service ipsec start
|
service ipsec restart
|
||||||
service xl2tpd start
|
service xl2tpd restart
|
||||||
echo 1 > /proc/sys/net/ipv4/ip_forward
|
echo 1 > /proc/sys/net/ipv4/ip_forward
|
||||||
exit 0
|
exit 0
|
||||||
EOF
|
EOF
|
||||||
|
@ -371,21 +371,26 @@ fi
|
|||||||
|
|
||||||
# Start services at boot
|
# Start services at boot
|
||||||
if grep -qs "release 6" /etc/redhat-release; then
|
if grep -qs "release 6" /etc/redhat-release; then
|
||||||
chkconfig iptables on
|
for svc in iptables fail2ban ipsec xl2tpd; do
|
||||||
chkconfig fail2ban on
|
chkconfig "$svc" on
|
||||||
|
done
|
||||||
else
|
else
|
||||||
systemctl --now mask firewalld
|
systemctl --now mask firewalld
|
||||||
yum -y install iptables-services || exiterr2
|
yum -y install iptables-services || exiterr2
|
||||||
systemctl enable iptables fail2ban >/dev/null 2>&1
|
systemctl enable iptables fail2ban ipsec xl2tpd >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
if ! grep -qs "hwdsl2 VPN script" /etc/rc.local; then
|
if ! grep -qs "hwdsl2 VPN script" /etc/rc.local; then
|
||||||
conf_bk "/etc/rc.local"
|
if [ -f /etc/rc.local ]; then
|
||||||
|
conf_bk "/etc/rc.local"
|
||||||
|
else
|
||||||
|
echo '#!/bin/sh' > /etc/rc.local
|
||||||
|
fi
|
||||||
cat >> /etc/rc.local <<'EOF'
|
cat >> /etc/rc.local <<'EOF'
|
||||||
|
|
||||||
# Added by hwdsl2 VPN script
|
# Added by hwdsl2 VPN script
|
||||||
modprobe -q pppol2tp
|
modprobe -q pppol2tp
|
||||||
service ipsec start
|
service ipsec restart
|
||||||
service xl2tpd start
|
service xl2tpd restart
|
||||||
echo 1 > /proc/sys/net/ipv4/ip_forward
|
echo 1 > /proc/sys/net/ipv4/ip_forward
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user