Compare commits

..

2 Commits

Author SHA1 Message Date
Jan Gaßner
ff8433dfe9 Added FQDN docs 2023-07-09 19:12:41 +02:00
Jan Gaßner
ff0e2bd8d6 Add configuration option server.host 2023-07-09 18:57:25 +02:00
3 changed files with 63 additions and 6 deletions

View File

@ -27,7 +27,7 @@ Limitations:
## AVM Fritzbox
Fritzbox DynDNS Settings:
```
Update-URL: https://192.168.178.10/fqdns/<domain>/dyndns?ip=<ipaddr>&ip=<ip6addr>&ipv6lanprefix=<ip6lanprefix>&dualstack=<dualstack>
Update-URL: https://192.168.178.10/fqdns/<domain>/dyndns?ip=<ipaddr>&ip=<ip6addr>&ipv6lanprefix=<ip6lanprefix>
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"} |

View File

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

View File

@ -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):
@ -93,6 +94,7 @@ class FQDNSettings(BaseModel):
class Server(BaseModel):
host: str = '127.0.0.1'
port: int = 8000
app_log_level: int = logging.INFO
root_log_level: int = logging.WARNING