1
0
mirror of synced 2024-11-25 06:16:07 +03:00

Improve services on boot

This commit is contained in:
hwdsl2 2017-01-04 01:50:41 -06:00
parent e41cf78b53
commit ca84aa7a13
2 changed files with 23 additions and 12 deletions

View File

@ -387,16 +387,22 @@ exit 0
EOF
# Start services at boot
update-rc.d fail2ban enable >/dev/null 2>&1
systemctl enable fail2ban >/dev/null 2>&1
for svc in fail2ban ipsec xl2tpd; do
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 [ -f /etc/rc.local ]; then
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'
# Added by hwdsl2 VPN script
service ipsec start
service xl2tpd start
service ipsec restart
service xl2tpd restart
echo 1 > /proc/sys/net/ipv4/ip_forward
exit 0
EOF

View File

@ -371,21 +371,26 @@ fi
# Start services at boot
if grep -qs "release 6" /etc/redhat-release; then
chkconfig iptables on
chkconfig fail2ban on
for svc in iptables fail2ban ipsec xl2tpd; do
chkconfig "$svc" on
done
else
systemctl --now mask firewalld
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
if ! grep -qs "hwdsl2 VPN script" /etc/rc.local; then
if [ -f /etc/rc.local ]; then
conf_bk "/etc/rc.local"
else
echo '#!/bin/sh' > /etc/rc.local
fi
cat >> /etc/rc.local <<'EOF'
# Added by hwdsl2 VPN script
modprobe -q pppol2tp
service ipsec start
service xl2tpd start
service ipsec restart
service xl2tpd restart
echo 1 > /proc/sys/net/ipv4/ip_forward
EOF
fi