Cyberes 1789f11c3f | ||
---|---|---|
.gitignore | ||
README.md | ||
pihole-opnsense-sync.service | ||
requirements.txt | ||
syncer.py |
README.md
pihole-opnsense-sync
Sync custom DNS entries in Pi-hole to OPNsense Unbound.
This little service watches Pi-hole's /etc/pihole/custom.list
file and when a change is made, it syncs it with your
OPNsense router's Unbound host overrides. This is useful because if your Pi-hole goes offline then you will still be
able to resolve your custom domains.
Install
- Install pip requirements:
pip install -r requirements.txt
- Create your secrets file at
/etc/secrets/pihole-opnsense-sync
with your API details:OPNSENSE_API_KEY='...' OPNSENSE_API_SECRET='...'
- Give your user the
Services: Unbound DNS: Edit Host and Domain Override
permision. - Set the permissions on this file:
sudo chown root:root /etc/secrets/pihole-opnsense-sync sudo chmod 600 /etc/secrets/pihole-opnsense-sync
- Copy the systemd service file:
The service is configured to run as thesudo cp pihole-opnsense-sync.service /etc/systemd/system/pihole-opnsense-sync.service
pihole:pihole
user. - Edit the service file. You might need to modify
--opnsense
and add--insecure
. 7Enable and start the service:sudo systemctl enable --now pihole-opnsense-sync sleep 2 sudo systemctl status pihole-opnsense-sync