From b946b291684c345591ceda78d7b3e2e6342cbf5e Mon Sep 17 00:00:00 2001 From: rodeodomino <48391143+rodeodomino@users.noreply.github.com> Date: Thu, 20 Jun 2019 16:34:37 -0400 Subject: [PATCH] Add wildcard blocking --- roles/dns/templates/adblock.sh.j2 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/roles/dns/templates/adblock.sh.j2 b/roles/dns/templates/adblock.sh.j2 index cc74f982..57679025 100644 --- a/roles/dns/templates/adblock.sh.j2 +++ b/roles/dns/templates/adblock.sh.j2 @@ -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