ipset: check dns before processing lists

This commit is contained in:
bol-van
2021-10-19 11:22:43 +03:00
parent 7355b20544
commit 6c3cf5ffc3
8 changed files with 144 additions and 116 deletions

View File

@@ -9,7 +9,6 @@ ZREESTR="$TMPDIR/reestr.txt"
#ZURL_REESTR=https://reestr.rublacklist.net/api/current
ZURL_REESTR=https://raw.githubusercontent.com/zapret-info/z-i/master/dump.csv
getuser
dig_reestr()
{
@@ -23,29 +22,31 @@ dig_reestr()
}
# assume all https banned by ip
curl -k --fail --max-time 600 --connect-timeout 5 --retry 3 --max-filesize 251658240 "$ZURL_REESTR" -o "$ZREESTR" ||
{
echo reestr list download failed
exit 2
getuser && {
# assume all https banned by ip
curl -k --fail --max-time 600 --connect-timeout 5 --retry 3 --max-filesize 251658240 "$ZURL_REESTR" -o "$ZREESTR" ||
{
echo reestr list download failed
exit 2
}
dlsize=$(LANG=C wc -c "$ZREESTR" | xargs | cut -f 1 -d ' ')
if test $dlsize -lt 1048576; then
echo reestr ip list is too small. can be bad.
exit 2
fi
#sed -i 's/\\n/\r\n/g' $ZREESTR
get_ip_regex
[ "$DISABLE_IPV4" != "1" ] && {
dig_reestr "$REG_IPV4" "$ZIPLIST" 4
}
[ "$DISABLE_IPV6" != "1" ] && {
dig_reestr "$REG_IPV6" "$ZIPLIST6" 6
}
rm -f "$ZREESTR"
}
dlsize=$(LANG=C wc -c "$ZREESTR" | xargs | cut -f 1 -d ' ')
if test $dlsize -lt 1048576; then
echo reestr ip list is too small. can be bad.
exit 2
fi
#sed -i 's/\\n/\r\n/g' $ZREESTR
get_ip_regex
[ "$DISABLE_IPV4" != "1" ] && {
dig_reestr "$REG_IPV4" "$ZIPLIST" 4
}
[ "$DISABLE_IPV6" != "1" ] && {
dig_reestr "$REG_IPV6" "$ZIPLIST6" 6
}
rm -f "$ZREESTR"
"$IPSET_DIR/create_ipset.sh"