mirror of
https://github.com/trailofbits/algo.git
synced 2025-08-10 23:03:03 +02:00
Add wildcard blocking
This commit is contained in:
parent
c4cc59998a
commit
8627262bf1
3 changed files with 26 additions and 0 deletions
|
@ -15,6 +15,11 @@
|
||||||
job: /usr/local/sbin/adblock.sh
|
job: /usr/local/sbin/adblock.sh
|
||||||
user: root
|
user: root
|
||||||
|
|
||||||
|
- name: dnscrypt-proxy wildcard-blacklist configured
|
||||||
|
template:
|
||||||
|
src: wildcard.list.j2
|
||||||
|
dest: "{{ config_prefix|default('/') }}etc/dnscrypt-proxy/wildcard.list"
|
||||||
|
|
||||||
- name: Update adblock hosts
|
- name: Update adblock hosts
|
||||||
command: /usr/local/sbin/adblock.sh
|
command: /usr/local/sbin/adblock.sh
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
|
@ -5,6 +5,7 @@ TEMP="$(mktemp)"
|
||||||
TEMP_SORTED="$(mktemp)"
|
TEMP_SORTED="$(mktemp)"
|
||||||
WHITELIST="/etc/dnscrypt-proxy/white.list"
|
WHITELIST="/etc/dnscrypt-proxy/white.list"
|
||||||
BLACKLIST="/etc/dnscrypt-proxy/black.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"
|
BLOCKHOSTS="{{ config_prefix|default('/') }}etc/dnscrypt-proxy/blacklist.txt"
|
||||||
BLOCKLIST_URLS="{% for url in adblock_lists %}{{ url }} {% endfor %}"
|
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"
|
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
|
done
|
||||||
|
|
||||||
|
#Add wildcards, if non empty
|
||||||
|
if [ -s "$WILDCARDS" ]
|
||||||
|
then
|
||||||
|
echo 'Adding wildcards...'
|
||||||
|
cat $WILDCARDS >> "$TEMP"
|
||||||
|
fi
|
||||||
|
|
||||||
#Add black list, if non-empty
|
#Add black list, if non-empty
|
||||||
if [ -s "$BLACKLIST" ]
|
if [ -s "$BLACKLIST" ]
|
||||||
then
|
then
|
||||||
|
|
13
roles/dns/templates/wildcard.list.j2
Normal file
13
roles/dns/templates/wildcard.list.j2
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
ad.*
|
||||||
|
ads.*
|
||||||
|
ad[0-9]*
|
||||||
|
ads[0-9]*
|
||||||
|
adserver.*
|
||||||
|
adserver[0-9].*
|
||||||
|
banner.*
|
||||||
|
banners.*
|
||||||
|
beacon.*
|
||||||
|
stats.*
|
||||||
|
tag.*
|
||||||
|
telemetry.*
|
||||||
|
tracker.*
|
Loading…
Add table
Reference in a new issue