mirror of
https://github.com/Nyr/openvpn-install.git
synced 2024-11-23 21:46:08 +03:00
Fix #255
Ubuntu no longer includes the rc.local file, so iptables weren’t applied after a system reboot.
This commit is contained in:
parent
971474e531
commit
a31aaf82f3
@ -36,8 +36,6 @@ elif [[ -e /etc/centos-release || -e /etc/redhat-release ]]; then
|
|||||||
OS=centos
|
OS=centos
|
||||||
GROUPNAME=nobody
|
GROUPNAME=nobody
|
||||||
RCLOCAL='/etc/rc.d/rc.local'
|
RCLOCAL='/etc/rc.d/rc.local'
|
||||||
# Needed for CentOS 7
|
|
||||||
chmod +x /etc/rc.d/rc.local
|
|
||||||
else
|
else
|
||||||
echo "Looks like you aren't running this installer on a Debian, Ubuntu or CentOS system"
|
echo "Looks like you aren't running this installer on a Debian, Ubuntu or CentOS system"
|
||||||
exit 5
|
exit 5
|
||||||
@ -311,6 +309,12 @@ crl-verify crl.pem" >> /etc/openvpn/server.conf
|
|||||||
fi
|
fi
|
||||||
# Avoid an unneeded reboot
|
# Avoid an unneeded reboot
|
||||||
echo 1 > /proc/sys/net/ipv4/ip_forward
|
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
|
# Set NAT for the VPN subnet
|
||||||
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to $IP
|
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
|
sed -i "1 a\iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to $IP" $RCLOCAL
|
||||||
|
Loading…
Reference in New Issue
Block a user