mirror of
https://github.com/angristan/openvpn-install.git
synced 2024-11-22 08:49:03 +01:00
parent
6c4104c25d
commit
de021b67d5
@ -877,30 +877,30 @@ verb 3" >> /etc/openvpn/server.conf
|
|||||||
echo "#!/bin/sh
|
echo "#!/bin/sh
|
||||||
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o $NIC -j MASQUERADE
|
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o $NIC -j MASQUERADE
|
||||||
iptables -A INPUT -i tun0 -j ACCEPT
|
iptables -A INPUT -i tun0 -j ACCEPT
|
||||||
iptables -A FORWARD -i $NIC -o tun0 -j ACCEPT
|
iptables -A FORWARD 1 -i $NIC -o tun0 -j ACCEPT
|
||||||
iptables -A FORWARD -i tun0 -o $NIC -j ACCEPT
|
iptables -A FORWARD 1 -i tun0 -o $NIC -j ACCEPT
|
||||||
iptables -A INPUT -i $NIC -p $PROTOCOL --dport $PORT -j ACCEPT" > /etc/iptables/add-openvpn-rules.sh
|
iptables -A INPUT -i $NIC -p $PROTOCOL --dport $PORT -j ACCEPT" > /etc/iptables/add-openvpn-rules.sh
|
||||||
|
|
||||||
if [[ "$IPV6_SUPPORT" = 'y' ]]; then
|
if [[ "$IPV6_SUPPORT" = 'y' ]]; then
|
||||||
echo "ip6tables -t nat -A POSTROUTING -s fd42:42:42:42::/112 -o $NIC -j MASQUERADE
|
echo "ip6tables -t nat -A POSTROUTING -s fd42:42:42:42::/112 -o $NIC -j MASQUERADE
|
||||||
ip6tables -A INPUT -i tun0 -j ACCEPT
|
ip6tables -A INPUT -i tun0 -j ACCEPT
|
||||||
ip6tables -A FORWARD -i $NIC -o tun0 -j ACCEPT
|
ip6tables -A FORWARD 1 -i $NIC -o tun0 -j ACCEPT
|
||||||
ip6tables -A FORWARD -i tun0 -o $NIC -j ACCEPT" >> /etc/iptables/add-openvpn-rules.sh
|
ip6tables -A FORWARD 1 -i tun0 -o $NIC -j ACCEPT" >> /etc/iptables/add-openvpn-rules.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Script to remove rules
|
# Script to remove rules
|
||||||
echo "#!/bin/sh
|
echo "#!/bin/sh
|
||||||
iptables -t nat -D POSTROUTING -s 10.8.0.0/24 -o $NIC -j MASQUERADE
|
iptables -t nat -D POSTROUTING -s 10.8.0.0/24 -o $NIC -j MASQUERADE
|
||||||
iptables -D INPUT -i tun0 -j ACCEPT
|
iptables -D INPUT -i tun0 -j ACCEPT
|
||||||
iptables -D FORWARD -i $NIC -o tun0 -j ACCEPT
|
iptables -D FORWARD 1 -i $NIC -o tun0 -j ACCEPT
|
||||||
iptables -D FORWARD -i tun0 -o $NIC -j ACCEPT
|
iptables -D FORWARD 1 -i tun0 -o $NIC -j ACCEPT
|
||||||
iptables -D INPUT -i $NIC -p $PROTOCOL --dport $PORT -j ACCEPT" > /etc/iptables/rm-openvpn-rules.sh
|
iptables -D INPUT -i $NIC -p $PROTOCOL --dport $PORT -j ACCEPT" > /etc/iptables/rm-openvpn-rules.sh
|
||||||
|
|
||||||
if [[ "$IPV6_SUPPORT" = 'y' ]]; then
|
if [[ "$IPV6_SUPPORT" = 'y' ]]; then
|
||||||
echo "ip6tables -t nat -D POSTROUTING -s fd42:42:42:42::/112 -o $NIC -j MASQUERADE
|
echo "ip6tables -t nat -D POSTROUTING -s fd42:42:42:42::/112 -o $NIC -j MASQUERADE
|
||||||
ip6tables -D INPUT -i tun0 -j ACCEPT
|
ip6tables -D INPUT -i tun0 -j ACCEPT
|
||||||
ip6tables -D FORWARD -i $NIC -o tun0 -j ACCEPT
|
ip6tables -D FORWARD 1 -i $NIC -o tun0 -j ACCEPT
|
||||||
ip6tables -D FORWARD -i tun0 -o $NIC -j ACCEPT" >> /etc/iptables/rm-openvpn-rules.sh
|
ip6tables -D FORWARD 1 -i tun0 -o $NIC -j ACCEPT" >> /etc/iptables/rm-openvpn-rules.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod +x /etc/iptables/add-openvpn-rules.sh
|
chmod +x /etc/iptables/add-openvpn-rules.sh
|
||||||
|
Loading…
Reference in New Issue
Block a user