From c72a4d2b5ef19e298ab7b3570327ab6bc6997642 Mon Sep 17 00:00:00 2001 From: Nyr Date: Wed, 12 Mar 2014 21:14:38 +0100 Subject: [PATCH] Bugfix: port redirect wasn't correctly set when a custom port was in place --- openvpn-install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index fd39d2d..e2e5271 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -97,7 +97,7 @@ if [ -e /etc/openvpn/server.conf ]; then apt-get remove --purge -y openvpn openvpn-blacklist rm -rf /etc/openvpn rm -rf /usr/share/doc/openvpn - sed -i '/--dport 53 -j REDIRECT --to-port 1194/d' /etc/rc.local + sed -i '/--dport 53 -j REDIRECT --to-port/d' /etc/rc.local sed -i '/iptables -t nat -A POSTROUTING -s 10.8.0.0/d' /etc/rc.local echo "" echo "OpenVPN removed!" @@ -179,8 +179,8 @@ else sed -i "s|port 1194|port $PORT|" server.conf # Listen at port 53 too if user wants that if [ $ALTPORT = 'y' ]; then - iptables -t nat -A PREROUTING -p udp -d $IP --dport 53 -j REDIRECT --to-port 1194 - sed -i "/# By default this script does nothing./a\iptables -t nat -A PREROUTING -p udp -d $IP --dport 53 -j REDIRECT --to-port 1194" /etc/rc.local + iptables -t nat -A PREROUTING -p udp -d $IP --dport 53 -j REDIRECT --to-port $PORT + sed -i "/# By default this script does nothing./a\iptables -t nat -A PREROUTING -p udp -d $IP --dport 53 -j REDIRECT --to-port $PORT" /etc/rc.local fi # Enable net.ipv4.ip_forward for the system sed -i 's|#net.ipv4.ip_forward=1|net.ipv4.ip_forward=1|' /etc/sysctl.conf