Compare commits
2 commits
5e22dcadf1
...
c00468eaea
Author | SHA1 | Date | |
---|---|---|---|
|
c00468eaea | ||
|
03290d7a8d |
2 changed files with 9 additions and 2 deletions
|
@ -13,6 +13,13 @@ RULES=(
|
||||||
"443:4430"
|
"443:4430"
|
||||||
"443:4430/udp"
|
"443:4430/udp"
|
||||||
"22:22"
|
"22:22"
|
||||||
|
"3478:3478"
|
||||||
|
"3478:3478/udp"
|
||||||
|
"25:2500"
|
||||||
|
"143:1430"
|
||||||
|
"465:4650"
|
||||||
|
"587:5870"
|
||||||
|
"993:9930"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Runs the actual script
|
# Runs the actual script
|
||||||
|
|
|
@ -14,7 +14,6 @@ add_NAT_forwarding() {
|
||||||
forward_to_port="$6"
|
forward_to_port="$6"
|
||||||
|
|
||||||
firewall-cmd --add-rich-rule "rule family=\"ipv4\" destination address=\"$original_destination_ip\" forward-port port=\"$original_destination_port\" protocol=\"$tcp_or_udp\" to-addr=\"$forward_to_ip\" to-port=\"$forward_to_port\"" --permanent > /dev/null
|
firewall-cmd --add-rich-rule "rule family=\"ipv4\" destination address=\"$original_destination_ip\" forward-port port=\"$original_destination_port\" protocol=\"$tcp_or_udp\" to-addr=\"$forward_to_ip\" to-port=\"$forward_to_port\"" --permanent > /dev/null
|
||||||
firewall-cmd --reload > /dev/null
|
|
||||||
|
|
||||||
echo "+ [$interface_source][$tcp_or_udp] $original_destination_ip:$original_destination_port --> $forward_to_ip:$forward_to_port"
|
echo "+ [$interface_source][$tcp_or_udp] $original_destination_ip:$original_destination_port --> $forward_to_ip:$forward_to_port"
|
||||||
}
|
}
|
||||||
|
@ -33,7 +32,6 @@ remove_NAT_forwarding() {
|
||||||
forward_to_port="$6"
|
forward_to_port="$6"
|
||||||
|
|
||||||
firewall-cmd --remove-rich-rule "rule family=\"ipv4\" destination address=\"$original_destination_ip\" forward-port port=\"$original_destination_port\" protocol=\"$tcp_or_udp\" to-addr=\"$forward_to_ip\" to-port=\"$forward_to_port\"" --permanent > /dev/null
|
firewall-cmd --remove-rich-rule "rule family=\"ipv4\" destination address=\"$original_destination_ip\" forward-port port=\"$original_destination_port\" protocol=\"$tcp_or_udp\" to-addr=\"$forward_to_ip\" to-port=\"$forward_to_port\"" --permanent > /dev/null
|
||||||
firewall-cmd --reload > /dev/null
|
|
||||||
|
|
||||||
echo "- [$interface_source][$tcp_or_udp] $original_destination_ip:$original_destination_port --> $forward_to_ip:$forward_to_port"
|
echo "- [$interface_source][$tcp_or_udp] $original_destination_ip:$original_destination_port --> $forward_to_ip:$forward_to_port"
|
||||||
}
|
}
|
||||||
|
@ -78,4 +76,6 @@ for rule in "${RULES[@]}"; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
firewall-cmd --reload > /dev/null
|
||||||
|
|
||||||
echo -e "\nDone! Don't forget to add/remove the rules in the security list."
|
echo -e "\nDone! Don't forget to add/remove the rules in the security list."
|
||||||
|
|
Loading…
Reference in a new issue