All apps · 0 apps
Unifi-Network-List-Sync
Docker app from mstrhakr's Repository
Overview
Readme
View on GitHubDepreciation Notice
UniFi Network List Sync
Automatically resolves DNS hostnames to IPs and pushes them into UniFi controller firewall groups. Replaces the manual process of maintaining IP allow-lists.
Features:
- Web UI for creating and managing sync jobs
- Cron scheduling to keep firewall groups automatically updated
- Multi-resolver DNS lookups across authoritative DNS plus Cloudflare, Google, Quad9, and OpenDNS
- Literal IPv4 and IPv4 CIDR support in the input list for mixed hostname and direct-entry workflows
- DNS preview to test hostname resolution before syncing
- Run history with detailed diffs of every sync
- Single binary with embedded web interface — no external dependencies
- SQLite storage for jobs and logs
Why Use It
Use this when you maintain UniFi firewall/address groups that depend on hostnames whose IPs change over time.
Typical examples:
- Monitoring providers with rotating probe IPs
- Third-party integrations that publish hostnames instead of fixed IPs
- Mixed allow-lists where some entries are hostnames and others are static CIDRs
Without automation, these groups drift and access breaks. This tool keeps the group aligned with current DNS results on a schedule.
How It Works
- You create a sync job in the web UI.
- The job stores UniFi credentials, target group ID, and hostname/CIDR inputs.
- On manual run or schedule, the app resolves hostnames using multiple DNS resolvers.
- It computes the desired final list and updates the UniFi firewall group.
- It stores run history so you can review diffs and failures.
Before You Start
- A reachable UniFi Network Controller URL.
- A UniFi API key with permission to update firewall groups.
- The target Site name (usually
default). - The firewall/address group ID you want to keep in sync.
- A host machine where Docker can keep a persistent
/datavolume.
Quick Start (Docker Preferred)
Run Latest Development Build
docker run --rm -p 8080:8080 \
-v unifi-sync-data:/data \
ghcr.io/mstrhakr/go-unifi-network-list-sync:main
Open http://localhost:8080 in your browser.
Run A Stable Release
docker run --rm -p 8080:8080 \
-v unifi-sync-data:/data \
ghcr.io/mstrhakr/go-unifi-network-list-sync:v0.1.0
The image is published for linux/amd64 and linux/arm64.
Image Tag Strategy
main: latest build from themainbranchvMAJOR: latest patch release in a major seriesvMAJOR.MINOR: latest patch release in a minor seriesvMAJOR.MINOR.PATCH: exact immutable releasesha-<commit>: commit-specific image
Data Persistence
The container defaults to:
-addr :8080-db /data/sync.db-log-file /data/sync.log
Use a bind mount or named volume for /data so DB and logs persist across upgrades.
Unraid Permissions (Optional)
For Unraid-style deployments, you can run the process as a specific user/group and set file mode defaults with environment variables:
PUID: runtime user ID (for example99)PGID: runtime group ID (for example100)UMASK: process umask (for example002)
Example:
docker run --rm -p 8080:8080 \
-e PUID=99 \
-e PGID=100 \
-e UMASK=002 \
-v unifi-sync-data:/data \
ghcr.io/mstrhakr/go-unifi-network-list-sync:main
Optional: Build The Image Locally
docker build -t go-unifi-network-list-sync:dev .
Optional: Docker Compose Example
Full example file: docs/docker-compose.unraid.yml
services:
go-unifi-network-list-sync:
image: ghcr.io/mstrhakr/go-unifi-network-list-sync:main
container_name: go-unifi-network-list-sync
restart: unless-stopped
ports:
- "8080:8080"
environment:
PUID: "99"
PGID: "100"
UMASK: "022"
volumes:
- /mnt/user/appdata/go-unifi-network-list-sync:/data
Optional: Run From Binary
go build -o go-unifi-network-list-sync .
./go-unifi-network-list-sync
For maintainer and contributor workflows (local dev, CI, and release process), see docs/development.md.
Options
| Flag | Default | Description |
|---|---|---|
-addr |
:8080 |
HTTP listen address |
-db |
sync.db |
SQLite database path |
-debug |
false |
Enable debug logging |
-verbose |
false |
Enable verbose logging |
-log-file |
sync.log |
Log file path ("" disables file logging) |
-version |
false |
Print build version metadata and exit |
./go-unifi-network-list-sync -addr :9090 -db /var/lib/sync/data.db -log-file ./sync.log
Usage
First-Time Setup Walkthrough
- Start the container and open the UI at http://localhost:8080.
- Click + New Sync Job.
- Enter a clear job name, for example
grafana-probes-prod. - Set Controller URL to your UniFi endpoint, for example
https://192.168.1.4:8443. - Set API Key from UniFi OS (
Settings -> System -> Advanced -> API Keys). - Set Site to your UniFi site name (usually
default). - Set Firewall Group ID by opening the target group in UniFi and copying the hex ID from the URL.
- In Hostnames, add one entry per line.
- Use comments with
#for documentation. - Add a schedule such as
0 */6 * * *for every 6 hours, or leave blank for manual runs. - Click Save.
- Click Run Now to verify connectivity and output.
Example host list:
# Grafana synthetic probes
synthetics.grafana.net
# Static office egress
203.0.113.10
203.0.113.0/24
What To Check After First Run
- The run status is successful in job history.
- The log shows resolved records and applied changes.
- The target UniFi group now contains the expected entries.
- A second run without DNS changes produces little or no diff.
Recommended Operations
- Start with manual runs while validating job configuration.
- Enable schedule only after one or two clean manual runs.
- Use stable tags (
vMAJOR.MINOR.PATCH) in production. - Use
mainfor testing new behavior. - Keep
/datapersisted so jobs and history survive container updates.
Common Failure Causes
- Invalid controller URL or TLS trust issues.
- API key missing required permissions.
- Wrong site or firewall group ID.
- DNS resolver/network restrictions from the container host.
- Container started without persistent
/datavolume.
API Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /api/jobs |
List all sync jobs |
| POST | /api/jobs |
Create a new sync job |
| GET | /api/jobs/{id} |
Get a specific job |
| PUT | /api/jobs/{id} |
Update a job |
| DELETE | /api/jobs/{id} |
Delete a job and its history |
| POST | /api/jobs/{id}/run |
Trigger a sync immediately |
| GET | /api/jobs/{id}/logs |
Get run history for a job |
| POST | /api/resolve |
Preview DNS resolution |
Cron Schedule Examples
| Expression | Meaning |
|---|---|
*/30 * * * * |
Every 30 minutes |
0 */6 * * * |
Every 6 hours |
0 0 * * * |
Daily at midnight |
0 0 * * 1 |
Every Monday |
UniFi API Schema Reference
- Local copy:
docs/reference/unifi-network-10.1.85.json - Source:
https://github.com/beezly/unifi-apis/raw/refs/heads/main/unifi-network/10.1.85.json
This file is treated as the authoritative schema reference for endpoint paths and response payload shapes.
License
MIT
Install Unifi-Network-List-Sync on Unraid in a few clicks.
Find Unifi-Network-List-Sync in Community Apps on your Unraid server, review the template, and click Install. Unraid handles the Docker app or plugin setup from the published template.
Related apps
Explore more like this
Explore allDetails
ghcr.io/mstrhakr/go-unifi-network-list-sync:latestRuntime arguments
- Web UI
http://[IP]:[PORT:8080]- Network
bridge- Shell
sh- Privileged
- false
Template configuration
HTTP port for the WebUI.
- Target
- 8080
- Default
- 8080
Persistent config files
- Target
- /data
- Default
- /mnt/user/appdata/go-unifi-network-list-sync
User ID to run the container as.
- Default
- 99
Group ID to run the container as.
- Default
- 100
File creation mask for the container.
- Default
- 022