moritz 91e5f6b27c
All checks were successful
Gitea Actions Demo / Run-Python-Script (push) Successful in 4s
utils.go hinzugefügt
2025-05-07 15:34:51 +02:00
2025-05-04 18:13:00 +02:00
2025-05-04 14:38:44 +02:00
2025-05-07 15:31:57 +02:00
2025-05-07 15:28:59 +02:00
2025-05-04 14:54:53 +02:00
2025-05-04 14:54:53 +02:00
2025-05-04 17:47:05 +02:00
2025-05-07 15:33:47 +02:00
2025-05-04 18:17:48 +02:00
2025-05-04 17:41:58 +02:00
2025-05-07 15:34:51 +02:00

AdGuard DNS Rewrite Sync Tool

This script synchronizes DNS rewrite rules between a local YAML configuration and an AdGuard Home instance using its REST API.

Features

  • Logs into AdGuard Home via its control API
  • Loads desired DNS rewrite entries from a YAML file
  • Retrieves current DNS rewrite rules from AdGuard
  • Compares current vs. desired state and:
    • Adds new entries
    • Updates existing ones with changed IPs
    • Deletes entries no longer needed
  • Merges local and remote rules and writes back to the YAML file

Requirements

Install dependencies:

pip install -r requirements.txt

## Configuration
Create a .env file in the same directory with the following variables:

```env
ADGUARD_URL=http://<adguard-host>:3000
ADGUARD_USER=admin
PASSWORD=yourpassword
YAML_FILE=rewrites.yaml

YAML File Format

The YAML file should contain rewrite entries under the rewrites key:

rewrites:
  - domain: "example.org"
    answer: "127.0.0.1"
  - domain: "another.example.org"
    answer: "192.168.1.1"

Usage

Run the script:

python main.py
Description
No description provided
Readme 68 KiB
Languages
Python 100%