MyGit

atoy3731/adguard-sync

Fork: 4 Star: 40 (更新于 2024-11-28 18:15:36)

license: Apache-2.0

Language: Python .

Sync tool for local Adguard Home DNS instances

最后发布版本: 2.3 ( 2023-10-13 09:10:24)

GitHub网址

AdGuard Sync

Docker

This project will sync entries between a Primary and Secondary AdGuard Home instance using the API.

This is useful if you're dependent on local DNS and want to ensure relative High Availability.

How to Run

AdGuard Sync is packaged as a Docker image and can be ran anywhere with access to your instances, though it is advisable to run this on the same instance that is running your Primary Adguard instance. This makes your primary instance the "source of truth" for local DNS, but allows your secondary instance to stay in sync as a fallback. Once running, set your router DNS to point to both your primary and secondary. You can update the docker-compose.yaml file with your values based on the following:

Variable Required Description Default
ADGUARD_PRIMARY Yes Primary base URL for the primary AdGuard instance. It is highly advisable to use IP over hostnames to avoid DNS issues. (ie. http://192.168.1.2) N/A
ADGUARD_SECONDARY Yes Secondary base URL for the primary AdGuard instance It is highly advisable to use IP over hostnames to avoid DNS issues. (ie. http://192.168.1.3) N/A
ADGUARD_USER Yes Username to log into your AdGuard instances. N/A
ADGUARD_PASS Yes Password to log into your AdGuard instances. N/A
SECONDARY_ADGUARD_USER No Username to log into your secondary AdGuard instance. Only necessary if credentials are different between primary and secondary Value of 'ADGUARD_USER'
SECONDARY_ADGUARD_PASS No Password to log into your secondary AdGuard instance. Only necessary if credentials are different between primary and secondary Value of 'ADGUARD_PASS'
REFRESH_INTERVAL_SECS No Frequency in seconds to refresh entries. 60
SYNC_ENTRIES No If 'true', will sync rewrite entries. true
SYNC_BLOCKED_SERVICES No If 'true', will sync blocked services. true
SYNC_BLOCK_ALLOW_LISTS No If 'true', will sync block/allow lists. true
SYNC_CUSTOM_RULES No If 'true', will sync custom rules. true
SYNC_GENERAL_SETTINGS No If 'true', will sync general settings. true
SYNC_DNS_SETTINGS No If 'true', will sync DNS settings. true
SYNC_ENCRYPTION_SETTINGS No If 'true', will sync encrypt settings. false

Once you've updated the file and ensure you have docker and docker-compose installed, run the following in the root directory:

docker-compose up -d

You can check on the status of your newly running pod with:

docker-compose logs

If you'd prefer to utilize Docker without docker-compose, you can use the following command (substituting your values and adding any necessary environment variables):

docker run -d --name adguard-sync --restart=always \
    -e "ADGUARD_PRIMARY=http://192.168.1.2" \
    -e "ADGUARD_SECONDARY=http://192.168.1.3" \
    -e "ADGUARD_USER=admin" \
    -e "ADGUARD_PASS=password" \
    atoy3731/adguard-sync:2.1

NOTE: The container is set to automatically restart when the docker daemon restarts.

Encryption Syncing with Certifications/Keys

If you plan to sync encryption settings across environments and you're using paths for certificates/keys, you must make sure the files exist in both primary and secondary AdGuard instances! Given this, SYNC_ENCRYPTION_SETTINGS is defaulted to false as a safety measure.

Known Issues

Permission Error Running on Raspbian

When running on older versions of Raspbian, you may run into permission issues and see errors like the following in your logs:

Fatal Python error: pyinit_main: can't initialize time
Python runtime state: core initialized
PermissionError: [Errno 1] Operation not permitted

For this, you'll need to update to a newer version of libseccomp2:

wget http://ftp.us.debian.org/debian/pool/main/libs/libseccomp/libseccomp2_2.5.1-1_armhf.deb
sudo dpkg -i libseccomp2_2.5.1-1_armhf.deb

最近版本更新:(数据更新于 2024-09-21 23:21:38)

2023-10-13 09:10:24 2.3

2022-11-03 04:32:34 2.2

2021-11-08 11:13:23 2.1

2021-11-07 04:55:37 2.0

atoy3731/adguard-sync同语言 Python最近更新仓库

2024-12-22 18:18:34 LeslieLeung/heimdallr

2024-12-22 09:03:32 ultralytics/ultralytics

2024-12-21 13:26:40 notepad-plus-plus/nppPluginList

2024-12-21 11:42:53 XiaoMi/ha_xiaomi_home

2024-12-21 04:33:22 comfyanonymous/ComfyUI

2024-12-20 18:47:56 home-assistant/core