filiparag / hetzner_ddns

Hetzner Dynamic DNS (DDNS, DynDNS) daemon
BSD 2-Clause "Simplified" License
48 stars 8 forks source link

Error: Invalid API Key #15

Closed Clankcoll closed 5 days ago

Clankcoll commented 1 month ago

Hi i am getting following error

2024-07-25 21:54:48 [2024-07-25 19:54:48] Started Hetzner DDNS daemon
2024-07-25 21:54:48 [2024-07-25 19:54:48] Reading configuration from /etc/hetzner_ddns.conf
2024-07-25 21:54:48 [2024-07-25 19:54:48] Error: Invalid API key

This is all i get i am Using Docker Desktop 4.32.0 on Windows and even on Docker on "Linux" Synology NAS to be precise version 20.10.3-1239 both the same error,

Here is my conf file i just changed the key to have the same schematic just different random key

# Seconds between updates / TTL value
interval='3600'

# Hetzner DNS API key
key='kFE6YoYaOSLOeECxGWoO9SXEJRlNhIbR' 

# Top level domain name
domain='mylab.dev'

# Space separated host subdomains (@ for domain itself)
records='homelab'

no worries this is not my real key

any tips or known issues ? or is it a Layer 8 problem ?

Kind regards and Love -C XOXO

Clankcoll commented 1 month ago

When i do an Postman call with the same production key it works flawessly

Clankcoll commented 1 month ago

Layer 8 Was this Issue.

Needed to set the right folder / file path sometimes you just gotta go sleep. :D fix was to set right folder mount in Docker to /etc/

Now i am getting:

2024-07-26 10:46:03 [2024-07-26 08:46:03] Started Hetzner DDNS daemon
2024-07-26 10:46:03 [2024-07-26 08:46:03] Reading configuration from /etc/hetzner_ddns.conf
2024-07-26 10:46:04 [2024-07-26 08:46:04] Error: Unable to fetch zone ID for domain mylab.dev

I will need to look further in my next Pause :)

filiparag commented 1 month ago

Thanks for reporting the issue. This might be the same problem laid out in #14.

Unfortunately I am not able to reproduce the issue with Docker 27.0.3 (amd64) on Linux, so I have to rely on your logs.

Clankcoll commented 1 month ago

Give me Some time since i am kinda new to this whole World :)

Well i can see that he atleast is getting his domain IF fetched i can only fetch it via Curl

do you have an Idea where i could look next ?

Click me ### Some Logs ```{ "zones": [ { "id": "wonderID1", "name": "proddomain.tld", "ttl": 3600, "registrar": "", "legacy_dns_host": "", "legacy_ns": [ "notouch.", "nolook.", "nosee.", "nolove." ], "ns": [ "notouch.", "nosee.", "nolog." ], "created": "2020-04-10 19:12:04.373 +0000 UTC", "verified": "", "modified": "2023-11-14 20:19:40.936 +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": 22 }, { "id": "yesthisID", "name": "mylab.dev", "ttl": 7200, "registrar": "", "legacy_dns_host": "", "legacy_ns": [ "ns1.your-server.de.", "ns.second-ns.com.", "ns3.second-ns.de." ], "ns": [ "ns3.second-ns.de.", "ns1.your-server.de.", "ns.second-ns.com." ], "created": "2024-07-25 16:14:05.341 +0000 UTC", "verified": "", "modified": "2024-07-25 16:14:05.993 +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": 6 } ], "meta": { "pagination": { "page": 1, "per_page": 100, "previous_page": 1, "next_page": 1, "last_page": 1, "total_entries": 2 } } } ```
Clankcoll commented 1 month ago

@filiparag sta mislis da Zamjenimo TLD Domain sa domain ID ?

Then you need to do an first GET on the pbulic API to get the ID but could press down the specific Fails in #14 & #15 So in that case we dont need to double resolve just onetime ID Grabbing since it ID should not change it would seem Stabler to be build on that.

filiparag commented 1 month ago

Then you need to do an first GET on the pbulic API to get the ID but could press down the specific Fails in https://github.com/filiparag/hetzner_ddns/issues/14 & https://github.com/filiparag/hetzner_ddns/issues/15 So in that case we dont need to double resolve just onetime ID Grabbing since it ID should not change it would seem Stabler to be build on that.

That would probably resolve these issues, but would overall degrade the user experience. My goal was to make it as nice as possible, because in the end, you can just call cURL in a crontab instead of using any dynamic DNS helper.

filiparag commented 1 month ago

Hetzner's API doesn't seem to have been changed and the Docker builds are also unchanged, so I am not sure what is the root cause of the issues, but hope we will find it.

filiparag commented 1 month ago

do you have an Idea where i could look next ?

Can you run cURL inside the container?

Clankcoll commented 1 month ago

do you have an Idea where i could look next ?

Can you run cURL inside the container?

all these Logs and commands are run and exportet from the Container itself

filiparag commented 1 month ago

It seems like your issue is unrelated to #14 after all.

Can you try running this utility in any other way (e.g. systemd service, git bash...) to eliminate Docker as a culprit?

Clankcoll commented 1 week ago

● hetzner_ddns.service - Hetzner Dynamic DNS Loaded: loaded (/etc/systemd/system/hetzner_ddns.service; disabled; vendor preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Fri 2024-08-30 19:12:31 CEST; 6s ago Docs: man:hetzner_ddns(1) Process: 5800 ExecStartPre=/usr/bin/touch /var/log/hetzner_ddns.log (code=exited, status=0/SUCCESS) Process: 5801 ExecStartPre=/usr/bin/chown daemon:root /var/log/hetzner_ddns.log (code=exited, status=0/SUCCESS) Process: 5802 ExecStart=/usr/local/bin/hetzner_ddns (code=exited, status=1/FAILURE) Main PID: 5802 (code=exited, status=1/FAILURE)

Clankcoll commented 1 week ago

this is what i get when i run it locally also the log file under /var/log/hetzner_ddns.log is empty

Clankcoll commented 1 week ago

when i run this


curl "https://dns.hetzner.com/api/v1/zones" \
            -H "Auth-API-Token: MYKEY" 2>/dev/null | \
        jq -r '.zones[] | .name + " " + .id' | \
        awk -v d="delevoper.dev" '$1==d {print $2}'

i get the Zone ID so i cant wrap my head around where the error should be why i cant run it as is any Idea @filiparag

Clankcoll commented 1 week ago

is there a possibilty that the script is not capable of excatly choosing the domain given when i have more than 1 Domain registerd within hetzner ?

filiparag commented 1 week ago

If systemd service crashes and the log file is empty, it cannot be an API or a response parsing issue, because at least this line would have been logged.

Can you try running hetzner_ddns command as root user directly in the terminal?

Clankcoll commented 1 week ago

same config file

works when i run hetzner_ddns

filiparag commented 1 week ago

This is all i get i am Using Docker Desktop 4.32.0 on Windows and even on Docker on "Linux" Synology NAS to be precise version 20.10.3-1239 both the same error

I suspect it is something to do with the OSes then. Do the other services all work?

Clankcoll commented 5 days ago

I dont know what you mean by

Do the other services all work?

But I guess I see where it is going since I used Windows Docker. I will try it on a Linux System and see if there is the same issue.

Clankcoll commented 5 days ago

Well well well

It is an extreme specific setup error how it looks like.

Note! Dont Use Windows Docker Just use it on Linux.

Made VM setup docker tryed the same config and well well well we see it works without issues. Thank you very much for your Time and Help to debug.

If anybody neverthenless really needs a Windows Version please feel fre to make a Docker Image from this Fork

HetznerDynDNS

here it is fully done via Zone ID's