diff --git a/openvpn-install.sh b/openvpn-install.sh index cb9e60b..e945d59 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -36,8 +36,6 @@ elif [[ -e /etc/centos-release || -e /etc/redhat-release ]]; then OS=centos GROUPNAME=nobody RCLOCAL='/etc/rc.d/rc.local' - # Needed for CentOS 7 - chmod +x /etc/rc.d/rc.local else echo "Looks like you aren't running this installer on a Debian, Ubuntu or CentOS system" exit 5 @@ -311,6 +309,12 @@ crl-verify crl.pem" >> /etc/openvpn/server.conf fi # Avoid an unneeded reboot echo 1 > /proc/sys/net/ipv4/ip_forward + # Needed to use rc.local with some systemd distros + if [[ "$OS" = 'debian' && ! -e $RCLOCAL ]]; then + echo '#!/bin/sh -e +exit 0' > $RCLOCAL + fi + chmod +x $RCLOCAL # Set NAT for the VPN subnet iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to $IP sed -i "1 a\iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to $IP" $RCLOCAL