Version control is awful

This commit is contained in:
2023-09-07 08:03:42 +03:00
parent 7d107bca67
commit 095adb09cd

5
harden
View File

@@ -588,7 +588,10 @@ if [[ -n "$OLD_PORTS" ]]; then
# Deny the port in the firewall # Deny the port in the firewall
case "$currentFirewall" in case "$currentFirewall" in
ufw) ufw)
sudo ufw deny "$port"/tcp PORT_RULE_NUMS="$(sudo ufw status numbered | grep -i "$port" | grep -oP '\[.*?\]' | grep -o '[0-9]')"
for PORT_RULE_NUM in ${PORT_RULE_NUMS[@]}; do
yes | sudo ufw delete "$PORT_RULE_NUM"
done
;; ;;
firewalld) firewalld)
sudo firewall-cmd --permanent --remove-port="$port"/tcp sudo firewall-cmd --permanent --remove-port="$port"/tcp