fix: critical nfqws startup failures + root-check + strategy bugs
Fixed the following critical issues that prevented zapret from working: 1. strategies/*.conf: Remove --dpi-desync-fake-discord/--dpi-desync-fake-stun These are Windows winws.exe parameters that do NOT exist in Linux nfqws. nfqws immediately exited with 'unrecognized option', causing the infamous 'error 0000' / all strategies failing in autotest. 2. run_strategy.sh: Remove 'set -e' that broke on SIGTERM and empty arrays. Remove useless service.sh sub-command calls (status_zapret/check_updates/ load_game_filter/load_user_lists) that did nothing and could fork bomb. Add root check with clear 'sudo ' message. 3. autotest.sh: Fix typo '2&1' -> '2>&1' (bash parse error on cleanup). Remove redundant 'sudo' when already root. Properly kill strategy wrapper PID before cleanup_firewall to avoid nfqws orphan processes. 4. service.sh: Add root check at main() entry. Remove nested 'sudo' inside already-root scripts (systemctl cp/daemon-reload/...). Fix recursive 'bash remove_services' -> call service_remove directly. 5. lib/functions.sh: Fix stray space before detect_distro(). Add check_root() helper for all scripts. Add missing fake-bin warning in check_nfqws(). 6. setup.sh / install_nfqws.sh / install.sh: Add root check. Remove nested 'sudo' inside package manager calls. Fix EUID portability (use id -u fallback). 26 files changed. All 19 strategy configs now produce valid nfqws arguments.
This commit is contained in:
+13
-6
@@ -6,6 +6,13 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
BIN_DIR="$SCRIPT_DIR/bin"
|
||||
BUILD_DIR="/tmp/zapret-build-$$"
|
||||
|
||||
# Require root
|
||||
if [[ "${EUID:-$(id -u)}" -ne 0 ]]; then
|
||||
echo "[!] This script must be run as root (or with sudo)"
|
||||
echo " sudo $0"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source "$SCRIPT_DIR/lib/download_helper.sh"
|
||||
|
||||
echo "=============================================="
|
||||
@@ -38,12 +45,12 @@ echo "[*] Installing build dependencies..."
|
||||
install_deps() {
|
||||
case "$DISTRO" in
|
||||
ubuntu|debian|linuxmint|pop|zorin|kubuntu|xubuntu|lubuntu)
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y git make gcc curl iptables nftables libnetfilter-queue-dev libcap-dev build-essential
|
||||
apt-get update
|
||||
apt-get install -y git make gcc curl iptables nftables libnetfilter-queue-dev libcap-dev build-essential
|
||||
;;
|
||||
arch|manjaro|endeavouros|garuda|artix|arcolinux|blackarch)
|
||||
if command -v pacman >/dev/null 2>&1; then
|
||||
sudo pacman -Syu --noconfirm git make gcc curl iptables nftables libnetfilter_queue libcap
|
||||
pacman -Syu --noconfirm git make gcc curl iptables nftables libnetfilter_queue libcap
|
||||
elif command -v yay >/dev/null 2>&1; then
|
||||
yay -Syu --noconfirm git make gcc curl iptables nftables libnetfilter_queue libcap
|
||||
elif command -v paru >/dev/null 2>&1; then
|
||||
@@ -51,10 +58,10 @@ install_deps() {
|
||||
fi
|
||||
;;
|
||||
fedora|rhel|centos|almalinux|rocky)
|
||||
sudo dnf install -y git make gcc curl iptables nftables libnetfilter_queue-devel libcap-devel
|
||||
dnf install -y git make gcc curl iptables nftables libnetfilter_queue-devel libcap-devel
|
||||
;;
|
||||
alpine)
|
||||
sudo apk add --no-cache git make gcc curl iptables nftables libnetfilter_queue-dev libcap-dev linux-headers
|
||||
apk add --no-cache git make gcc curl iptables nftables libnetfilter_queue-dev libcap-dev linux-headers
|
||||
;;
|
||||
*)
|
||||
echo "[!] Unknown distro: $DISTRO"
|
||||
@@ -133,7 +140,7 @@ fi
|
||||
echo ""
|
||||
echo "[*] Setting capabilities..."
|
||||
if command -v setcap >/dev/null 2>&1; then
|
||||
sudo setcap cap_net_admin,cap_net_raw+eip "$BIN_DIR/nfqws" 2>/dev/null || true
|
||||
setcap cap_net_admin,cap_net_raw+eip "$BIN_DIR/nfqws" 2>/dev/null || true
|
||||
echo " [OK] cap_net_admin,cap_net_raw set"
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user