fixed makeconf.sh so it searches for ipv4_geo_blacklist instead of just blacklist

This commit is contained in:
celso 2024-12-13 05:47:52 -03:00
parent 9507ebbb1a
commit 0507155ef2
1 changed files with 1 additions and 1 deletions

View File

@ -41,7 +41,7 @@ done
# figure out what countries, if any, we're blocking # figure out what countries, if any, we're blocking
declare -a countries=($(ls -1 /var/geoipsets/dbip/nftset/ipv4/)) declare -a countries=($(ls -1 /var/geoipsets/dbip/nftset/ipv4/))
# figure out which line defines the elements of the blacklist set # figure out which line defines the elements of the blacklist set
line="$(grep -nA3 blacklist nftables.conf | grep elements | awk 'BEGIN{FS="-"} {print $1}')" line="$(grep -nA3 "ipv4_geo_blacklist" nftables.conf | grep elements | awk 'BEGIN{FS="-"} {print $1}')"
# insert names of the countries to block into the line that defines the elements of the set # insert names of the countries to block into the line that defines the elements of the set
for i in ${countries[@]}; for i in ${countries[@]};
do sed -i "${line} s/elements = { \([A-Z]\{2\}\.ipv4,\? \)*/elements = { \1\$${i}, /" nftables.conf do sed -i "${line} s/elements = { \([A-Z]\{2\}\.ipv4,\? \)*/elements = { \1\$${i}, /" nftables.conf