mirror of
				https://github.com/angristan/openvpn-install.git
				synced 2025-10-31 14:07:36 +01:00 
			
		
		
		
	add ufw rule to allow traffic on chosen udp port
This commit is contained in:
		| @@ -134,6 +134,7 @@ if [[ -e /etc/openvpn/server.conf ]]; then | ||||
| 			if [[ "$REMOVE" = 'y' ]]; then | ||||
| 				PORT=$(grep '^port ' /etc/openvpn/server.conf | cut -d " " -f 2) | ||||
| 				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 's/^DEFAULT_FORWARD_POLICY="ACCEPT" #before ovpn: /DEFAULT_FORWARD_POLICY=/g' /etc/default/ufw | ||||
| 				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=trusted --add-source=10.8.0.0/24 | ||||
| 	fi | ||||
| 	if ufw status | grep -qw active; then | ||||
| 		ufw allow $PORT/udp | ||||
| 	fi | ||||
| 	if iptables -L | grep -qE 'REJECT|DROP'; then | ||||
| 		# 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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 jtbr
					jtbr