Closed Kartoffelpeter closed 1 month ago
Can you manually run API call for getting all zones using your API key?
Yes
$ read -s KEY
$ curl "https://dns.hetzner.com/api/v1/zones" -H "Auth-API-Token: $KEY"
{"zones":[{"id":"some-id","name":"myawesome.domain","ttl":7200,"registrar":"","legacy_dns_host":"","legacy_ns":["ns3.second-ns.de.","ns1.your-server.de.","ns.second-ns.com."],"ns":["ns3.second-ns.de.","ns1.your-server.de.","ns.second-ns.com."],"created":"2024-07-20 08:48:00.073 +0000 UTC","verified":"","modified":"2024-07-20 08:48:00.819 +0000 UTC","project":"","owner":"","permission":"","zone_type":{"id":"","name":"","description":"","prices":null},"status":"verified","paused":false,"is_secondary_dns":false,"txt_verification":{"name":"","token":""},"records_count":19}],"meta":{"pagination":{"page":1,"per_page":100,"previous_page":1,"next_page":1,"last_page":1,"total_entries":1}}}
Im am not sure whether ns_.second-ns.de.
are supported for this API. I am using _.ns.hetzner.de.
and _.ns.hetzner.com.
.
Otherwise the output you provided seems proper.
Can you also try running these?
curl "https://dns.hetzner.com/api/v1/zones/some-id" \
-H "Auth-API-Token: $KEY" \
-H 'Content-Type: application/json; charset=utf-8'
curl "https://dns.hetzner.com/api/v1/records?zones_id=some-id" \
-H "Auth-API-Token: $KEY" \
-H 'Content-Type: application/json; charset=utf-8'
Are you running those commands on the host or inside the container? Maybe its networking configuration is broken. Otherwise all of the outputs seem fine.
I ran those commands on the host machine. But they also work inside the container:
$ cat docker-compose.yml
version: '3'
services:
hetzner-ddns:
image: filiparag/hetzner_ddns
restart: unless-stopped
volumes:
- ./hetzner_ddns.conf:/etc/hetzner_ddns.conf:ro
$ dc exec hetzner-ddns sh
/ # cat /etc/hetzner_ddns.conf
# Seconds between updates / TTL value
interval='7200'
# Hetzner DNS API key
key='lol'
# Top level domain name
domain='myawesome.domain'
# Space separated host subdomains (@ for domain itself)
records='bla blubb'
/ # read -s KEY
/ # curl "https://dns.hetzner.com/api/v1/zones" -H "Auth-API-Token: $KEY"
-> Same output as last time
/ # read -s ID
/ # curl "https://dns.hetzner.com/api/v1/zones/$ID" -H "Auth-API-Token: $KEY" -H 'Content-Type: application/json; charset=utf-8'
-> Same output as last time
/ # curl "https://dns.hetzner.com/api/v1/records?zones_id=$ID" -H "Auth-API-Token: $KEY" -H 'Content-Type: application/json; charset=utf-8'
-> Same output as last time
Thanks for providing the log.
The only way I am able to reproduce your initial output is to intentionally put bad values into records
variable in the configuration file:
Are you able to run this utility in any other way (e.g. systemd service)?
I think it doesn't hurt to share the real records. It's
records='paperless cloud'
It is possible to not use docker, but it would to great to use docker.
I set my configuration file to include only your records and have added them to DNS Console. It works when I start the container afterwards:
It is possible to not use docker, but it would to great to use docker.
Can you try running it differently, at least as a test?
I tried the deb-package (https://github.com/filiparag/hetzner_ddns/releases/download/0.2.4/hetzner_ddns-0.2.4.deb) with the same result.
$ cat /etc/hetzner_ddns.conf
interval='60' # Seconds between updates / TTL value
key='lol' # Hetzner DNS API key
domain='myawesome.domain' # Top level domain name
records='cloud paperless' # Space separated host subdomains (@ for domain itself)
$ sudo hetzner_ddns
[2024-08-01 07:47:36] Started Hetzner DDNS daemon
[2024-08-01 07:47:36] Reading configuration from /etc/hetzner_ddns.conf
[2024-08-01 07:47:36] Zone for myawesome.domain: something
[2024-08-01 07:47:37] Warning: Missing both A and AAAA records for cloud.myawesome.domain
[2024-08-01 07:47:37] Warning: Missing both A and AAAA records for paperless.myawesome.domain
[2024-08-01 07:47:37] Error: No applicable records found myawesome.domain
I think I found the problem. When you call the API you get FQDN responses:
{
"id": "<something>",
"type": "AAAA",
"name": "blubb.myawesome.domain",
"value": "<some ipv6>",
"zone_id": "$ID",
"created": "2024-07-20 09:17:38.761 +0000 UTC",
"modified": "2024-07-20 09:17:38.761 +0000 UTC"
}
while I get
{
"id": "<something>",
"type": "AAAA",
"name": "blubb",
"value": "<some ipv6>",
"ttl": 60,
"zone_id": "$ID",
"created": "2024-03-11 23:46:35.492 +0000 UTC",
"modified": "2024-03-11 23:46:40.459 +0000 UTC"
}
I am not sure why that is 🤷🏻♂️...
It should be solvable with a minor problem - if you have blubb.myawesome.domain.myawesome.domain.
subdomain, it will mix them up. I think it's not very likely to happen.
@Kartoffelpeter Can you test updated version?
Just replace /usr/bin/hetzner_ddns
executable or run it with sudo ./hetzner_ddns.sh
This looks good
$ chmod +x hetzner_ddns.sh
$ sudo ./hetzner_ddns.sh
[2024-08-05 10:54:37] Started Hetzner DDNS daemon
[2024-08-05 10:54:37] Reading configuration from /usr/local/etc/hetzner_ddns.conf
[2024-08-05 10:54:38] Zone for myawesome.domain: <zone_id>
[2024-08-05 10:54:38] IPv4 record for cloud.myawesome.domain: <some_hash>
[2024-08-05 10:54:38] IPv6 record for cloud.myawesome.domain: <some_hash>
[2024-08-05 10:54:39] IPv4 record for paperless.myawesome.domain: <some_hash>
[2024-08-05 10:54:39] IPv6 record for paperless.myawesome.domain: <some_hash>
[2024-08-05 10:54:39] Configuration successful
[2024-08-05 10:54:39] Watching for IP address and record changes
Good to hear that.
Can you manually edit the those records in DNS console to something random to test whether IP changing also works properly?
I tested it and it worked properly. I would love to see this update in the docker image ;)
I will release the update in a bit, just wanted to make sure it works first.
Hi there, I've got a problem regarding getting my domain pointing to the correct IP-address.
Config
Output
I am using the docker image. Is there any obvious mistake? I already tried to create the A and AAAA records at the Hetzner DNS-Console. It didnt change anything.