mirror of
https://github.com/angristan/openvpn-install.git
synced 2025-01-08 07:40:05 +01:00
add ufw rule to allow traffic on chosen udp port
This commit is contained in:
parent
e2b9f116d4
commit
4f8cad83cf
@ -134,6 +134,7 @@ if [[ -e /etc/openvpn/server.conf ]]; then
|
|||||||
if [[ "$REMOVE" = 'y' ]]; then
|
if [[ "$REMOVE" = 'y' ]]; then
|
||||||
PORT=$(grep '^port ' /etc/openvpn/server.conf | cut -d " " -f 2)
|
PORT=$(grep '^port ' /etc/openvpn/server.conf | cut -d " " -f 2)
|
||||||
if ufw status | grep -qw active; then
|
if ufw status | grep -qw active; then
|
||||||
|
ufw delete allow $PORT/udp
|
||||||
sed -i '/^##OPENVPN_START/,/^##OPENVPN_END/d' /etc/ufw/before.rules
|
sed -i '/^##OPENVPN_START/,/^##OPENVPN_END/d' /etc/ufw/before.rules
|
||||||
sed -i 's/^DEFAULT_FORWARD_POLICY="ACCEPT" #before ovpn: /DEFAULT_FORWARD_POLICY=/g' /etc/default/ufw
|
sed -i 's/^DEFAULT_FORWARD_POLICY="ACCEPT" #before ovpn: /DEFAULT_FORWARD_POLICY=/g' /etc/default/ufw
|
||||||
fi
|
fi
|
||||||
@ -392,6 +393,9 @@ tls-auth tls-auth.key 0" >> /etc/openvpn/server.conf
|
|||||||
firewall-cmd --permanent --zone=public --add-port=$PORT/udp
|
firewall-cmd --permanent --zone=public --add-port=$PORT/udp
|
||||||
firewall-cmd --permanent --zone=trusted --add-source=10.8.0.0/24
|
firewall-cmd --permanent --zone=trusted --add-source=10.8.0.0/24
|
||||||
fi
|
fi
|
||||||
|
if ufw status | grep -qw active; then
|
||||||
|
ufw allow $PORT/udp
|
||||||
|
fi
|
||||||
if iptables -L | grep -qE 'REJECT|DROP'; then
|
if iptables -L | grep -qE 'REJECT|DROP'; then
|
||||||
# If iptables has at least one REJECT rule, we asume this is needed.
|
# If iptables has at least one REJECT rule, we asume this is needed.
|
||||||
# Not the best approach but I can't think of other and this shouldn't
|
# Not the best approach but I can't think of other and this shouldn't
|
||||||
|
Loading…
Reference in New Issue
Block a user