From ff8433dfe9c809e5b1ae0335393fa52faf0b7724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Ga=C3=9Fner?= Date: Sun, 9 Jul 2023 19:12:41 +0200 Subject: [PATCH] Added FQDN docs --- README.md | 66 ++++++++++++++++++++++++++++++++++++---- dyndnshelper/settings.py | 1 + 2 files changed, 61 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6365cc3..c90872b 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Limitations: ## AVM Fritzbox Fritzbox DynDNS Settings: ``` -Update-URL: https://192.168.178.10/fqdns//dyndns?ip=&ip=&ipv6lanprefix=&dualstack= +Update-URL: https://192.168.178.10/fqdns//dyndns?ip=&ip=&ipv6lanprefix= Domainname: test1.domain.tld Username: testuser Password: testpassword @@ -38,7 +38,7 @@ App config: { "fqdns": { "test1.domain.tld": { - "vendor": "...", + "vendor": "hetzner", "dyndns_credentials": { "testuser": "9f735e0df9a1ddc702bf0a1a7b83033f9f7153a00c29de82cedadc9957289b05" } @@ -65,7 +65,7 @@ If a DynDNS API call contains an `ipv6lanprefix`, the FQDN settings of the given { "fqdns": { "test1.domain.tld": { - "vendor": "...", + "vendor": "hetzner", "dyndns_credentials": { "testuser": "9f735e0df9a1ddc702bf0a1a7b83033f9f7153a00c29de82cedadc9957289b05" }, @@ -91,7 +91,39 @@ test2.domaintld AAAA 2001:db8:85a3::2a0:00ff:111c:1234 - Larger IIDs than a prefix allows will be shortened - e.g.: An `ipv6lanprefix` of `2001:db8:85a3:1234::/64` with an IID `::9876:2a0:00ff:111c:1234` will result in an IPv6 address `2001:db8:85a3:1234:2a0:00ff:111c:1234` -# Vendors + +# Configuration +All configuration options should be supplied as JSON files in `/etc/dyndnshelper/`. + +Files are merged by their top level key. With multiple files with the same top level key (e.g. `server`) only the last read will be used. + +Example structure: +``` +/etc/dyndnshelper/ + fqdns.json + server.json + vendors.json +``` + +## Server +All server config is defined under a key `server`, e.g.: +```json +{ + "server": { + "host": "0.0.0.0" + } +} +``` + +The following options are available: +| Option | Default | Required | Description | Example | +|:-------|:--------|:---------|:------------|:--------| +| host | '127.0.0.1' | false | host to listen on | '0.0.0.0' | +| port | 8000 | false | port to listen on | 8080 | +| app_log_level | 'INFO' | false | log level for the application | 'DEBUG' | +| root_log_level | 'WARNING' | false | log level for all other applications | 'INFO' | + +## Vendors All vendor config is defined under a key `vendors` and the lowercase name of the vendor, e.g.: ```json { @@ -112,9 +144,31 @@ The following common options are available for every vendor: | default_zone_ttl | 86400 | false | default TTL to set for created zones | 7200 | | default_record_ttl | 600 | false | default TTL to set for created records - if not defined in individual FQDN settings | 300 | -## Hetzner -Additional options: +### Hetzner +Additional options for Hetzner: | Option | Default | Required | Description | Example | |:-------|:--------|:---------|:------------|:--------| | api_url | 'https://dns.hetzner.com/api/v1' | false | Hetzner DNS API URL | | | api_token | | true | default TTL to set for created records - if not defined in individual FQDN settings | 'secretapitoken' | + +# FQDNs +All FQDN config is defined under a key `fqdns` and the FQDN as a key, e.g.: +```json +{ + "fqdns": { + "test1.domain.tld": { + "vendor": "hetzner", + ... + } + } +} +``` + +The following options are available for each FQDN: +| Option | Default | Required | Description | Example | +|:-------|:--------|:---------|:------------|:--------| +| vendor | | true | vendor to use for the FQDN | 'hetzner' | +| zone | the root zone of the FQDN | false | DNS zone to handle DNS records in | 'myservers.domain.tld' | +| record_ttl | | false | DNS record TTL to use, when creating records. Overrides vendor `default_record_ttl` | 600 | +| dyndns_credentials | | false | Users and their SHA256 hashed passwords that are allowed to send DynDNS updates for this FQDN | {"testuser": "9f735e0df9a1ddc702bf0a1a7b83033f9f7153a00c29de82cedadc9957289b05"} | +| ipv6_lan_prefix_iid_map | | false | FQDNs and their IIDs to be updates if a DynDNS update for this FQDN contains an IPv6 LAN Prefix | {"test2.domain.tld": "::2a0:00ff:111c:1234"} | diff --git a/dyndnshelper/settings.py b/dyndnshelper/settings.py index 6db7e04..c55968c 100644 --- a/dyndnshelper/settings.py +++ b/dyndnshelper/settings.py @@ -60,6 +60,7 @@ class FQDNSettings(BaseModel): NOTE: If prefix is smaller than IID requires, parts of IID will be omitted. E.g.: Prefix 2001:db8:85a3::/48 and IID ::1111:2222:3333:4444:5555:6666 results in 2001:db8:85a3:2222:3333:4444:5555:6666 """ + @field_validator('dyndns_credentials') def validate_dyndns_credentials(cls, v, info: FieldValidationInfo): if isinstance(v, dict):