mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-26 20:20:53 +03:00
ipset: add missing ZAPRET_RW enabled scripts
This commit is contained in:
parent
916895e281
commit
bd80daad97
@ -4,12 +4,12 @@
|
|||||||
# $1=no-update - do not update ipset, only create if its absent
|
# $1=no-update - do not update ipset, only create if its absent
|
||||||
# $1=clear - clear ipset
|
# $1=clear - clear ipset
|
||||||
|
|
||||||
IPSET_DIR="$(dirname "$0")"
|
EXEDIR="$(dirname "$0")"
|
||||||
IPSET_DIR="$(cd "$IPSET_DIR"; pwd)"
|
EXEDIR="$(cd "$EXEDIR"; pwd)"
|
||||||
|
|
||||||
. "$IPSET_DIR/def.sh"
|
. "$EXEDIR/def.sh"
|
||||||
. "$IPSET_DIR/../common/fwtype.sh"
|
. "$ZAPRET_BASE/common/fwtype.sh"
|
||||||
. "$IPSET_DIR/../common/nft.sh"
|
. "$ZAPRET_BASE/common/nft.sh"
|
||||||
|
|
||||||
IPSET_CMD="$TMPDIR/ipset_cmd.txt"
|
IPSET_CMD="$TMPDIR/ipset_cmd.txt"
|
||||||
IPSET_SAVERAM_CHUNK_SIZE=20000
|
IPSET_SAVERAM_CHUNK_SIZE=20000
|
||||||
@ -119,13 +119,12 @@ nfset_get_script_multi()
|
|||||||
local set=$1 nonempty N=1 f
|
local set=$1 nonempty N=1 f
|
||||||
|
|
||||||
shift
|
shift
|
||||||
|
|
||||||
# first we need to make sure at least one element exists or nft will fail
|
# first we need to make sure at least one element exists or nft will fail
|
||||||
while :
|
while :
|
||||||
do
|
do
|
||||||
eval f=\$$N
|
eval f=\$$N
|
||||||
[ -n "$f" ] || break
|
[ -n "$f" ] || break
|
||||||
nonempty=$(zzexist "$f" && zzcat "$f" | head -n 1)
|
nonempty=$(zzexist "$f" && zzcat "$f" 2>/dev/null | head -n 1)
|
||||||
[ -n "$nonempty" ] && break
|
[ -n "$nonempty" ] && break
|
||||||
N=$(($N+1))
|
N=$(($N+1))
|
||||||
done
|
done
|
||||||
|
46
ipset/def.sh
46
ipset/def.sh
@ -1,10 +1,12 @@
|
|||||||
[ -n "$IPSET_DIR" ] || {
|
EXEDIR="$(dirname "$0")"
|
||||||
IPSET_DIR="$(dirname "$0")"
|
EXEDIR="$(cd "$EXEDIR"; pwd)"
|
||||||
IPSET_DIR="$(cd "$IPSET_DIR"; pwd)"
|
ZAPRET_BASE=${ZAPRET_BASE:-"$(cd "$EXEDIR/.."; pwd)"}
|
||||||
}
|
ZAPRET_RW=${ZAPRET_RW:-"$ZAPRET_BASE"}
|
||||||
|
ZAPRET_CONFIG=${ZAPRET_CONFIG:-"$ZAPRET_RW/config"}
|
||||||
|
IPSET_RW_DIR="$ZAPRET_RW/ipset"
|
||||||
|
|
||||||
. "$IPSET_DIR/../config"
|
. "$ZAPRET_CONFIG"
|
||||||
. "$IPSET_DIR/../common/base.sh"
|
. "$ZAPRET_BASE/common/base.sh"
|
||||||
|
|
||||||
[ -z "$TMPDIR" ] && TMPDIR=/tmp
|
[ -z "$TMPDIR" ] && TMPDIR=/tmp
|
||||||
[ -z "$GZIP_LISTS" ] && GZIP_LISTS=1
|
[ -z "$GZIP_LISTS" ] && GZIP_LISTS=1
|
||||||
@ -21,27 +23,27 @@ ZIPSET=zapret
|
|||||||
ZIPSET6=zapret6
|
ZIPSET6=zapret6
|
||||||
ZIPSET_EXCLUDE=nozapret
|
ZIPSET_EXCLUDE=nozapret
|
||||||
ZIPSET_EXCLUDE6=nozapret6
|
ZIPSET_EXCLUDE6=nozapret6
|
||||||
ZIPLIST="$IPSET_DIR/zapret-ip.txt"
|
ZIPLIST="$IPSET_RW_DIR/zapret-ip.txt"
|
||||||
ZIPLIST6="$IPSET_DIR/zapret-ip6.txt"
|
ZIPLIST6="$IPSET_RW_DIR/zapret-ip6.txt"
|
||||||
ZIPLIST_EXCLUDE="$IPSET_DIR/zapret-ip-exclude.txt"
|
ZIPLIST_EXCLUDE="$IPSET_RW_DIR/zapret-ip-exclude.txt"
|
||||||
ZIPLIST_EXCLUDE6="$IPSET_DIR/zapret-ip-exclude6.txt"
|
ZIPLIST_EXCLUDE6="$IPSET_RW_DIR/zapret-ip-exclude6.txt"
|
||||||
ZIPLIST_USER="$IPSET_DIR/zapret-ip-user.txt"
|
ZIPLIST_USER="$IPSET_RW_DIR/zapret-ip-user.txt"
|
||||||
ZIPLIST_USER6="$IPSET_DIR/zapret-ip-user6.txt"
|
ZIPLIST_USER6="$IPSET_RW_DIR/zapret-ip-user6.txt"
|
||||||
ZUSERLIST="$IPSET_DIR/zapret-hosts-user.txt"
|
ZUSERLIST="$IPSET_RW_DIR/zapret-hosts-user.txt"
|
||||||
ZHOSTLIST="$IPSET_DIR/zapret-hosts.txt"
|
ZHOSTLIST="$IPSET_RW_DIR/zapret-hosts.txt"
|
||||||
|
|
||||||
ZIPSET_IPBAN=ipban
|
ZIPSET_IPBAN=ipban
|
||||||
ZIPSET_IPBAN6=ipban6
|
ZIPSET_IPBAN6=ipban6
|
||||||
ZIPLIST_IPBAN="$IPSET_DIR/zapret-ip-ipban.txt"
|
ZIPLIST_IPBAN="$IPSET_RW_DIR/zapret-ip-ipban.txt"
|
||||||
ZIPLIST_IPBAN6="$IPSET_DIR/zapret-ip-ipban6.txt"
|
ZIPLIST_IPBAN6="$IPSET_RW_DIR/zapret-ip-ipban6.txt"
|
||||||
ZIPLIST_USER_IPBAN="$IPSET_DIR/zapret-ip-user-ipban.txt"
|
ZIPLIST_USER_IPBAN="$IPSET_RW_DIR/zapret-ip-user-ipban.txt"
|
||||||
ZIPLIST_USER_IPBAN6="$IPSET_DIR/zapret-ip-user-ipban6.txt"
|
ZIPLIST_USER_IPBAN6="$IPSET_RW_DIR/zapret-ip-user-ipban6.txt"
|
||||||
ZUSERLIST_IPBAN="$IPSET_DIR/zapret-hosts-user-ipban.txt"
|
ZUSERLIST_IPBAN="$IPSET_RW_DIR/zapret-hosts-user-ipban.txt"
|
||||||
ZUSERLIST_EXCLUDE="$IPSET_DIR/zapret-hosts-user-exclude.txt"
|
ZUSERLIST_EXCLUDE="$IPSET_RW_DIR/zapret-hosts-user-exclude.txt"
|
||||||
|
|
||||||
|
|
||||||
[ -n "$IP2NET" ] || IP2NET="$IPSET_DIR/../ip2net/ip2net"
|
[ -n "$IP2NET" ] || IP2NET="$ZAPRET_BASE/ip2net/ip2net"
|
||||||
[ -n "$MDIG" ] || MDIG="$IPSET_DIR/../mdig/mdig"
|
[ -n "$MDIG" ] || MDIG="$ZAPRET_BASE/mdig/mdig"
|
||||||
[ -z "$MDIG_THREADS" ] && MDIG_THREADS=30
|
[ -z "$MDIG_THREADS" ] && MDIG_THREADS=30
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user