mirror of
https://github.com/Nyr/openvpn-install.git
synced 2024-11-23 21:46:08 +03:00
Bugfix: port redirect wasn't correctly set when a custom port was in place
This commit is contained in:
parent
a69dae3021
commit
c72a4d2b5e
@ -97,7 +97,7 @@ if [ -e /etc/openvpn/server.conf ]; then
|
|||||||
apt-get remove --purge -y openvpn openvpn-blacklist
|
apt-get remove --purge -y openvpn openvpn-blacklist
|
||||||
rm -rf /etc/openvpn
|
rm -rf /etc/openvpn
|
||||||
rm -rf /usr/share/doc/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
|
sed -i '/iptables -t nat -A POSTROUTING -s 10.8.0.0/d' /etc/rc.local
|
||||||
echo ""
|
echo ""
|
||||||
echo "OpenVPN removed!"
|
echo "OpenVPN removed!"
|
||||||
@ -179,8 +179,8 @@ else
|
|||||||
sed -i "s|port 1194|port $PORT|" server.conf
|
sed -i "s|port 1194|port $PORT|" server.conf
|
||||||
# Listen at port 53 too if user wants that
|
# Listen at port 53 too if user wants that
|
||||||
if [ $ALTPORT = 'y' ]; then
|
if [ $ALTPORT = 'y' ]; then
|
||||||
iptables -t nat -A PREROUTING -p udp -d $IP --dport 53 -j REDIRECT --to-port 1194
|
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 1194" /etc/rc.local
|
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
|
fi
|
||||||
# Enable net.ipv4.ip_forward for the system
|
# Enable net.ipv4.ip_forward for the system
|
||||||
sed -i 's|#net.ipv4.ip_forward=1|net.ipv4.ip_forward=1|' /etc/sysctl.conf
|
sed -i 's|#net.ipv4.ip_forward=1|net.ipv4.ip_forward=1|' /etc/sysctl.conf
|
||||||
|
Loading…
Reference in New Issue
Block a user