There is an automatically updated, moderated and optimized list available on GitHub for blocking ads, trackers and other online garbage:
https://github.com/notracking/hosts-blocklists
The list is designed for use with dnsmasq. There is also a validation script available at https://github.com/bahamas10/notracking. You can configure automatic update of the list by following these steps:
-
- Install Node.JS that is a requirement for the notracking validate script:
$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
$ sudo apt-get install -y nodejs - Clone the notracking repository:
$ cd /opt/
$ git clone git://github.com/bahamas10/notracking.git - Configure crontab to download updated lists on a daily basis by creating the file /etc/cron.d/notracking with the following content:
0 6 * * * root cd /opt/notracking;./update;mv /opt/notracking/*.txt /etc/dnsmasq.d/;/usr/sbin/service dnsmasq restart
- Disable the CONFIG_DIR option in /etc/default/dnsmasq by comment out the following row:
#CONFIG_DIR=/etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new
- Add these two lines to the file /etc/dnsmasq.conf:
conf-file=/etc/dnsmasq.d/domains.txt
addn-hosts=/etc/dnsmasq.d/hostnames.txt
- Install Node.JS that is a requirement for the notracking validate script:
To get the configuration running immediately you can manually execute the commands from the cronjob or you can wait for it to run by it self at 06:00 the morning after you configured dnsmasq.