This script aggregates multiple blocklists for PiHole from internet and local sources into a single file.
This script needs to run on a Linux machine with a webserver. It also requires internet access to download blocklists from external webservers. The following commands must be available on your server: wget, grep, sed, sort, uniq
This file contains the logic which creates the aggregated blocklist file and copies it into your webserver's directory. You may need to change the configuration section to reflect your environment.
Those variables need to be set correctly:
- basepath: the full path to the folder where this script is located
- target: the target folder within your webserver
- targetfile: the filename of the aggregated blocklist file
This file contains the blocklists which should be downloaded from the internet. One URL per line. You can find example blocklists already in it.
This file contains domains which should never be in the aggregated blocklist. One domain per line. You can find a few domains which normally should not be blocked already in it.
This folder contains multiple .list files which contain domains which should be in the aggregated blocklist. One domain per line. You can find two example blocklists already in it.
- Install a webserver (e.g. lighttpd, Apache httpd or NGINX) on your Linux server (e.g. your PiHole machine).
- Clone this repository into a folder of your choice (default: /opt/blocklistaggregator).
- Configure the script in the files listed above.
- Add execution rights to update.sh (chmod +x update.sh).
- Add the output file to your PiHole blocklists (e.g. http://127.0.0.1/block.list)
- Run update.sh and pihole -g regularily (e.g. via Cronjob) to ensure you're always up-to-date.