Add wildcard blocking

This commit is contained in:
rodeodomino 2019-06-20 16:34:37 -04:00 committed by GitHub
parent 4fd05ca87d
commit b946b29168
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,6 +5,7 @@ TEMP="$(mktemp)"
TEMP_SORTED="$(mktemp)"
WHITELIST="/etc/dnscrypt-proxy/white.list"
BLACKLIST="/etc/dnscrypt-proxy/black.list"
WILDCARDS="{{ config_prefix|default('/') }}etc/dnscrypt-proxy/wildcard.list"
BLOCKHOSTS="{{ config_prefix|default('/') }}etc/dnscrypt-proxy/blacklist.txt"
BLOCKLIST_URLS="{% for url in adblock_lists %}{{ url }} {% endfor %}"
@ -17,6 +18,13 @@ for url in $BLOCKLIST_URLS; do
wget --timeout=2 --tries=3 -qO- "$url" | grep -Ev "(localhost)" | grep -Ew "(0.0.0.0|127.0.0.1)" | awk '{sub(/\r$/,"");print $2}' >> "$TEMP"
done
#Add wildcards, if non empty
if [ -s "$WILDCARDS" ]
then
echo 'Adding wildcards...'
cat $WILDCARDS >> "$TEMP"
fi
#Add black list, if non-empty
if [ -s "$BLACKLIST" ]
then