fix: auto-install iptables if missing (#14)

Debian Trixie and other newer distros use nftables by default
and don't have iptables installed. Add iptables to dependency
check so it gets installed automatically during setup.

Reported-by: @Shaheding
This commit is contained in:
SamNet-dev
2026-02-04 15:55:19 -06:00
parent ff6acb9cfb
commit 627e39d40b

View File

@@ -251,6 +251,19 @@ check_dependencies() {
esac
fi
# iptables is required for firewall rules (server mode)
if ! command -v iptables &>/dev/null; then
log_info "Installing iptables..."
case "$PKG_MANAGER" in
apt) install_package iptables || log_warn "Could not install iptables - firewall rules may not work" ;;
dnf|yum) install_package iptables || log_warn "Could not install iptables" ;;
pacman) install_package iptables || log_warn "Could not install iptables" ;;
zypper) install_package iptables || log_warn "Could not install iptables" ;;
apk) install_package iptables || log_warn "Could not install iptables" ;;
*) log_warn "Please install iptables manually for firewall rules to work" ;;
esac
fi
# libpcap is required by paqet
install_libpcap
}