Compare commits

..

No commits in common. "ff8433dfe9c809e5b1ae0335393fa52faf0b7724" and "859cffe9a0c8ecf615a643970737b927711c7e00" have entirely different histories.

3 changed files with 6 additions and 63 deletions

View File

@ -27,7 +27,7 @@ Limitations:
## AVM Fritzbox ## AVM Fritzbox
Fritzbox DynDNS Settings: Fritzbox DynDNS Settings:
``` ```
Update-URL: https://192.168.178.10/fqdns/<domain>/dyndns?ip=<ipaddr>&ip=<ip6addr>&ipv6lanprefix=<ip6lanprefix> Update-URL: https://192.168.178.10/fqdns/<domain>/dyndns?ip=<ipaddr>&ip=<ip6addr>&ipv6lanprefix=<ip6lanprefix>&dualstack=<dualstack>
Domainname: test1.domain.tld Domainname: test1.domain.tld
Username: testuser Username: testuser
Password: testpassword Password: testpassword
@ -38,7 +38,7 @@ App config:
{ {
"fqdns": { "fqdns": {
"test1.domain.tld": { "test1.domain.tld": {
"vendor": "hetzner", "vendor": "...",
"dyndns_credentials": { "dyndns_credentials": {
"testuser": "9f735e0df9a1ddc702bf0a1a7b83033f9f7153a00c29de82cedadc9957289b05" "testuser": "9f735e0df9a1ddc702bf0a1a7b83033f9f7153a00c29de82cedadc9957289b05"
} }
@ -65,7 +65,7 @@ If a DynDNS API call contains an `ipv6lanprefix`, the FQDN settings of the given
{ {
"fqdns": { "fqdns": {
"test1.domain.tld": { "test1.domain.tld": {
"vendor": "hetzner", "vendor": "...",
"dyndns_credentials": { "dyndns_credentials": {
"testuser": "9f735e0df9a1ddc702bf0a1a7b83033f9f7153a00c29de82cedadc9957289b05" "testuser": "9f735e0df9a1ddc702bf0a1a7b83033f9f7153a00c29de82cedadc9957289b05"
}, },
@ -91,39 +91,7 @@ test2.domaintld AAAA 2001:db8:85a3::2a0:00ff:111c:1234
- Larger IIDs than a prefix allows will be shortened - 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` - 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.: All vendor config is defined under a key `vendors` and the lowercase name of the vendor, e.g.:
```json ```json
{ {
@ -144,31 +112,9 @@ The following common options are available for every vendor:
| default_zone_ttl | 86400 | false | default TTL to set for created zones | 7200 | | 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 | | default_record_ttl | 600 | false | default TTL to set for created records - if not defined in individual FQDN settings | 300 |
### Hetzner ## Hetzner
Additional options for Hetzner: Additional options:
| Option | Default | Required | Description | Example | | Option | Default | Required | Description | Example |
|:-------|:--------|:---------|:------------|:--------| |:-------|:--------|:---------|:------------|:--------|
| api_url | 'https://dns.hetzner.com/api/v1' | false | Hetzner DNS API URL | | | 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' | | 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"} |

View File

@ -19,7 +19,6 @@ app.include_router(fqdn_router)
def run(): def run():
config = uvicorn.Config( config = uvicorn.Config(
app=app, app=app,
host=CONFIG.server.host,
port=CONFIG.server.port, port=CONFIG.server.port,
log_level=CONFIG.server.app_log_level log_level=CONFIG.server.app_log_level
) )

View File

@ -60,7 +60,6 @@ class FQDNSettings(BaseModel):
NOTE: If prefix is smaller than IID requires, parts of IID will be omitted. E.g.: 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 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') @field_validator('dyndns_credentials')
def validate_dyndns_credentials(cls, v, info: FieldValidationInfo): def validate_dyndns_credentials(cls, v, info: FieldValidationInfo):
if isinstance(v, dict): if isinstance(v, dict):
@ -94,7 +93,6 @@ class FQDNSettings(BaseModel):
class Server(BaseModel): class Server(BaseModel):
host: str = '127.0.0.1'
port: int = 8000 port: int = 8000
app_log_level: int = logging.INFO app_log_level: int = logging.INFO
root_log_level: int = logging.WARNING root_log_level: int = logging.WARNING