2016-02-15 13:34:45 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# create ipset from resolved ip's
|
|
|
|
|
|
|
|
SCRIPT=$(readlink -f $0)
|
|
|
|
EXEDIR=$(dirname $SCRIPT)
|
|
|
|
|
|
|
|
. "$EXEDIR/def.sh"
|
|
|
|
|
2016-03-04 09:03:34 +00:00
|
|
|
create_ipset()
|
|
|
|
{
|
|
|
|
ipset flush $1 2>/dev/null || ipset create $1 hash:ip
|
|
|
|
for f in "$2" "$3"
|
2016-02-15 13:34:45 +00:00
|
|
|
do
|
2016-03-04 09:03:34 +00:00
|
|
|
[ -f "$f" ] && {
|
2016-11-26 17:01:33 +00:00
|
|
|
echo Adding to ipset $1 : $f
|
|
|
|
if [ -f "$ZIPLIST_EXCLUDE" ] ; then
|
|
|
|
grep -vxf $ZIPLIST_EXCLUDE "$f" | sort -u | while read ip; do echo add $1 $ip; done | ipset -! restore
|
|
|
|
else
|
|
|
|
sort -u "$f" | while read ip; do echo add $1 $ip; done | ipset -! restore
|
|
|
|
fi
|
2016-02-15 13:34:45 +00:00
|
|
|
}
|
|
|
|
done
|
2016-03-04 09:03:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
create_ipset $ZIPSET $ZIPLIST $ZIPLIST_USER
|
|
|
|
create_ipset $ZIPSET_IPBAN $ZIPLIST_IPBAN $ZIPLIST_USER_IPBAN
|