Unify legacy data path /etc/xdp-blocker → /etc/xdp-defense
All config/data paths now use /etc/xdp-defense/ consistently, eliminating the legacy xdp-blocker directory reference. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -9,8 +9,8 @@ PIN_PATH="/sys/fs/bpf/xdp-defense"
|
||||
CONFIG_FILE="/etc/xdp-defense/config.yaml"
|
||||
DATA_DIR="/var/lib/xdp-defense"
|
||||
PID_FILE="$DATA_DIR/daemon.pid"
|
||||
BLOCKLIST_FILE="/etc/xdp-blocker/blocklist.txt"
|
||||
COUNTRY_DIR="/etc/xdp-blocker/countries"
|
||||
BLOCKLIST_FILE="/etc/xdp-defense/blocklist.txt"
|
||||
COUNTRY_DIR="/etc/xdp-defense/countries"
|
||||
GEOIP_DB="/usr/share/GeoIP/GeoLite2-Country.mmdb"
|
||||
CITY_DB="/usr/share/GeoIP/GeoLite2-City.mmdb"
|
||||
ASN_DB="/usr/share/GeoIP/GeoLite2-ASN.mmdb"
|
||||
@@ -144,8 +144,8 @@ cmd_load() {
|
||||
fi
|
||||
|
||||
# Restore whitelists
|
||||
if [ -d "/etc/xdp-blocker/whitelist" ]; then
|
||||
for wl_file in /etc/xdp-blocker/whitelist/*.txt; do
|
||||
if [ -d "/etc/xdp-defense/whitelist" ]; then
|
||||
for wl_file in /etc/xdp-defense/whitelist/*.txt; do
|
||||
[ -f "$wl_file" ] || continue
|
||||
local name
|
||||
name=$(basename "$wl_file" .txt)
|
||||
@@ -480,7 +480,7 @@ cmd_whitelist_add() {
|
||||
bpftool map update id "$map_id" key hex $key_hex value hex 01 00 00 00 00 00 00 00 2>/dev/null
|
||||
|
||||
# Persist to file for restore on reload
|
||||
local direct_file="/etc/xdp-blocker/whitelist/direct.txt"
|
||||
local direct_file="/etc/xdp-defense/whitelist/direct.txt"
|
||||
mkdir -p "$(dirname "$direct_file")"
|
||||
grep -qxF "$name" "$direct_file" 2>/dev/null || echo "$name" >> "$direct_file"
|
||||
|
||||
@@ -516,7 +516,7 @@ cmd_whitelist_del() {
|
||||
bpftool map delete id "$map_id" key hex $key_hex 2>/dev/null && log_ok "Removed from whitelist: $name"
|
||||
|
||||
# Remove from persistence file
|
||||
local direct_file="/etc/xdp-blocker/whitelist/direct.txt"
|
||||
local direct_file="/etc/xdp-defense/whitelist/direct.txt"
|
||||
if [ -f "$direct_file" ]; then
|
||||
local tmpfile="${direct_file}.tmp.$$"
|
||||
{ grep -vxF "$name" "$direct_file" || true; } > "$tmpfile" 2>/dev/null
|
||||
|
||||
Reference in New Issue
Block a user