diff --git a/wireguard.sh b/wireguard.sh index a68eb54..59add2a 100644 --- a/wireguard.sh +++ b/wireguard.sh @@ -339,9 +339,9 @@ enable_ip_forward() { set_firewall() { _info "Setting firewall rules" if _exists "firewall-cmd"; then - if [ "$(firewall-cmd --state)" = "running" ]; then + if [ "$(firewall-cmd --state | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g")" = "running" ]; then default_zone="$(firewall-cmd --get-default-zone)" - if [ "$(firewall-cmd --zone=${default_zone} --query-masquerade)" = "no" ]; then + if [ "$(firewall-cmd --zone=${default_zone} --query-masquerade | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g")" = "no" ]; then _error_detect "firewall-cmd --zone=${default_zone} --add-masquerade" fi if ! firewall-cmd --list-ports | grep -qw "${SERVER_WG_PORT}/udp"; then @@ -648,4 +648,4 @@ main() { esac } -main "$@" \ No newline at end of file +main "$@"