update readme and service

This commit is contained in:
Cyberes 2024-02-26 14:43:04 -07:00
parent e0ba9a86af
commit 269876c51c
2 changed files with 27 additions and 6 deletions

View File

@ -1,9 +1,29 @@
# pihole-opnsense-sync
_Sync custom DNS entries in Pi-hole to OPNsense Unbound._
## Install
```shell
pip install -r requirements.txt
```
Then get your API auth details.
1. Install pip requirements:
```shell
pip install -r requirements.txt
```
2. Create your secrets file at `/etc/secrets/pihole-opnsense-sync` with your API details:
```bash
OPNSENSE_API_KEY='...'
OPNSENSE_API_SECRET='...'
```
3. Set the permissions on this file:
```shell
sudo chown root:root /etc/secrets/pihole-opnsense-sync
sudo chmod 600 /etc/secrets/pihole-opnsense-sync
```
4. Copy the systemd service file:
```shell
sudo cp pihole-opnsense-sync.service /etc/systemd/system/pihole-opnsense-sync.service
```
5. Enable and start the service:
```shell
sudo systemctl enable --now pihole-opnsense-sync
sudo systemctl status pihole-opnsense-sync
```

View File

@ -4,7 +4,8 @@ Description=Sync Pi-hole local DNS to OPNsense Unbound
[Service]
User=pihole
Group=pihole
ExecStart=/opt/icinga2-checks/Other/auto-acknowledge-apt.sh --api https://localhost:5665 --fail --user icingaweb2 --password XXXXX
EnvironmentFile=/etc/secrets/pihole-opnsense-sync
ExecStart=/opt/pihole-opnsense-sync/venv/bin/python /opt/pihole-opnsense-sync/syncer.py --opnsense https://192.168.1.1 --api-key ${OPNSENSE_API_KEY} --api-secret ${OPNSENSE_API_SECRET}
SyslogIdentifier=pihole-opnsense-sync
Restart=always