Список файерволов

  • ipfire.org - Высокоуровневый файервол в виде отдельной виртульной машины, с кучей возможностей.
#!/bin/bash
Myservices=("ufw" "iptables" "firewalld" "nftables" "ipfire")
for myservice in ${Myservices[@]}
do
if systemctl is-active --quiet $myservice;
then
 echo -e "Service is  running \033[0;32m $myservice \033[0m"
else
 echo -e "Service not running \033[0;31m $myservice \033[0m"
fi
done

или

#!/bin/bash
 
if command -v ufw >/dev/null 2>&1 && ufw status | grep -q "active"; then
    echo "FIREWALL: UFW is active"
elif command -v firewall-cmd >/dev/null 2>&1 && systemctl is-active --quiet firewalld; then
    echo "FIREWALL: firewalld is active"
elif command -v iptables >/dev/null 2>&1 && sudo iptables -L | grep -q "Chain INPUT"; then
    echo "FIREWALL: iptables is active"
else
    echo "FIREWALL: No firewall found"
fi

или

for i in {ufw,iptables,firewalld,nftables,ipfire}; do echo "$i $(systemctl is-active $i)";done

или

#!/bin/bash
 
# Функция для проверки ufw
check_ufw() {
    if command -v ufw >/dev/null 2>&1; then
        if ufw status | grep -q "active"; then
            echo "FIREWALL: UFW is active"
        else
            echo "FIREWALL: UFW is installed but inactive"
        fi
    fi
}
 
# Функция для проверки firewalld
check_firewalld() {
    if command -v firewall-cmd >/dev/null 2>&1; then
        if systemctl is-active --quiet firewalld; then
            echo "FIREWALL: firewalld is active"
        else
            echo "FIREWALL: firewalld is installed but inactive"
        fi
    fi
}
 
# Функция для проверки iptables
check_iptables() {
    if command -v iptables >/dev/null 2>&1; then
        if sudo iptables -L | grep -q "Chain INPUT"; then
            echo "FIREWALL: iptables is active"
        else
            echo "FIREWALL: iptables is installed but inactive"
        fi
    fi
}
 
# Проверка каждого файрвола
check_ufw
check_firewalld
check_iptables
 
# Если не найдено активных файрволов
if ! (command -v ufw >/dev/null 2>&1 || command -v firewall-cmd >/dev/null 2>&1 || command -v iptables >/dev/null 2>&1); then
    echo "FIREWALL: No firewall found"
fi