rpz-manager
Block ads and malicious domains with response policy zones.
From Wikipedia:
A response policy zone (RPZ) is a mechanism to introduce a customized policy in Domain Name System servers, so that recursive resolvers return possibly modified results. By modifying a result, access to the corresponding host can be blocked.
This program allows you to build and maintain RPZ zones from domain blocklist feeds. The resulting zones can be used with ISC bind (and other compatible DNS servers).
rpz-manager is easy to deploy. Just copy it to your PATH. Optionally write a config file, set up logging, or use a cron job to keep your zone fresh.
Before you Start
Make sure to understand DNS RPZ before using this tool. These sites provide great documentation:
At minimum, you must create a new zone clause for RPZ and mention that zone in a response-policy statement.
How to Install
Run the following as root.
# Download rpz-manager
curl -Ss https://raw.githubusercontent.com/stevekroh/rpz-manager/version-0.x/rpz_manager.py \
-o /usr/local/bin/rpz-manager
# Set the executable bit
chmod 755 /usr/local/bin/rpz-manager
Alternatively, create a virtualenv and run pip install rpz-manager.
Quick Start
# View the help screen
rpz-manager --help
# Write, then review /etc/rpz-manager.ini
rpz-manager --init
# Optionally set up logging
curl -Ss https://raw.githubusercontent.com/stevekroh/rpz-manager/version-0.x/config/rpz-loggers.ini \
-o /etc/rpz-loggers.ini
# Download block lists then write an RPZ zone file
rpz-manager
Automate with Ansible
Add the following to your role or playbook.
# Customize rpz-manager.ini and save it under files
- name: upload rpz-manager.ini
copy:
src: files/rpz-manager.ini
dest: /etc/rpz-manager.ini
owner: root
group: root
mode: 'u=rw,g=r,o=r'
# Customize rpz-loggers.ini and save it under files
- name: upload rpz-loggers.ini
copy:
src: files/rpz-loggers.ini
dest: /etc/rpz-loggers.ini
owner: root
group: root
mode: 'u=rw,g=r,o=r'
# rpz-manager will be updated to the latest version when force=yes
- name: download rpz-manager
get_url:
url: https://raw.githubusercontent.com/stevekroh/rpz-manager/version-0.x/rpz_manager.py
dest: /usr/local/bin/rpz-manager
force: yes
owner: root
group: root
mode: 'u=rwx,g=rx,o=rx'
# Use a cron job to keep your zone fresh
- name: run rpz-manager daily
cron:
name: rpz-manager
special_time: daily
job: /usr/local/bin/rpz-manager
user: root
Run Without Root
It is possible to run rpz-manager without root permissions, though you must be sure to update all relevant settings pertaining to the user.
For example:
# Create an administrator belonging to the named group
useradd -m -G named admin
# Create the user cache directory
mkdir -p /home/admin/.cache
# Run rpz-manager
rpz-manager -o rpz.example.com. -z /var/named/rpz.example.com.zone \
-u admin -g named -d /home/admin/.cache
Inspired by Trellmor/bind-adblock.
Metadata
Release files for rpz-manager 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rpz-manager-0.2.tar.gz | 25.1 kB | Without provenance | Details for rpz-manager-0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rpz_manager-0.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for rpz_manager-0.2-py2.py3-none-any.whl |
Total release size: 49.7 kB
Release files / rpz-manager-0.2.tar.gz
| Download URL | rpz-manager-0.2.tar.gz |
|---|---|
| Size | 25.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
55610ee9d744e586a55ff1ca32567a597c18f274d11cf5bc19d26cb7a13a78b7
|
|
BLAKE2b-256 checksum How to use checksums |
f1cff25e2cd337121841ffbb60ebf798e628ad60d037b6caf429c721812d5b0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.3
|
Release files / rpz_manager-0.2-py2.py3-none-any.whl
| Download URL | rpz_manager-0.2-py2.py3-none-any.whl |
|---|---|
| Size | 24.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
e69778b4b0e385329d7ffbf715c90cf3846512496e27b40fb05f6ad43ecf9f2c
|
|
BLAKE2b-256 checksum How to use checksums |
77efab14cc89e1baf1601a37dd3f581e02ac0f97fc337818dd3081fb6ce67bbd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.3
|
Security for rpz-manager 0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.