Skip to content

virajchitnis/bind-adblock

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 

Repository files navigation

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.

Uses the following sources:

Setup

Python packages

Install on Ubuntu via apt-get install python3 python3-pip python3-requests python3-dnspython

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

Configure BIND

Add the response-policy statement to the BIND options

// For AdBlock
response-policy {
	zone "rpz.example.com";
};

Add your rpz zone. Replace example.com with a domain of your choice.

// AdBlock
zone "rpz.example.com" {
	type master;
	file "/etc/bind/db.rpz.example.com";
	allow-query { none; };
};

Create a zone file for your zone. Replace example.com with the domain you used before.

@ 3600 IN SOA @ admin.example.com. 0 86400 7200 2592000 86400
@ 3600 IN NS ns.example.com.

Usage

update-zonefile.py zonefile origin
  • zonefile: Path to the zone file to update
  • origin: Zone origin to use

Example: update-zonefile.py /etc/bind/db.rpz.example.com rpz.example.com

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

Whitelist

An additional zone can be used to whitelist domains. See Whitelist

About

Use the BIND DNS server to block ads

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%