Skip to content
This repository has been archived by the owner on Jun 3, 2023. It is now read-only.

expeditioneer/bind-adblock

Repository files navigation

DEPRECATED

No longer maintained. I personally don't use this any longer.

BIND ad blocker

Fetch various blocklists and generate a BIND zone from them.

Configure BIND to return NXDOMAIN for ad and tracking domains to stop clients from contacting them.

Requires BIND 9.8 or newer for RPZ support.

The sources can be configured with the blocklists.conf file

Setup

Copy the update-zonefile.py script to /usr/local/bin. Copy the update-blacklist-zonefile.service and update-blacklist-zonefile.timer into /etc/systemd/system.

Afterwards execute

systemctl enable update-blacklist-zonefile.service
systemctl enable update-blacklist-zonefile.timer

and

systemctl start update-blacklist-zonefile.service

Required Python packages

These packages need to be installed to run the update script.

Usage

Useage of the 'update-zonefile.py' script

usage: update-zonefile.py [-h] [-v | -q] [--print-bind-config] [--reload-zone]
                      zonefile origin

positional arguments:
  zonefile             name of the generated file
  origin               name of the zone

optional arguments:
  -h, --help           show this help message and exit
  -v, --verbose        increase verbosity (specify multiple times for more output)
  -q, --quiet          suppress output, except fatal messages
  --print-bind-config  print necessary configuration of BIND to use the generated file
  --reload-zone        trigger a reload of the zone after update

Example: update-zonefile.py /var/bind/rpz/blacklist.zone rpz.blacklist -q --reload-zone

update-zonefile.py will update the zone file with the fetched server lists and issue a rndc reload origin afterwards.