Coder Social home page Coder Social logo

Comments (15)

filiparag avatar filiparag commented on June 19, 2024

I have installed the package via apk but I can´t figure out what I'm doing wrong...

Have you installed only hetzner_ddns-0.2.3.apk or also hetzner_ddns-doc-0.2.3.apk and hetzner_ddns-openrc-0.2.3.apk?

Error message Cannot iterate over null (null) can also be a result of an invalid API key.

from hetzner_ddns.

ant0nioli avatar ant0nioli commented on June 19, 2024

I have installed only:

hetzner_ddns-0.2.3.apk and hetzner_ddns-doc-0.2.3.apk

Should I install hetzner_ddns-openrc-0.2.3.apk too?

I checked the API key and it's the correct one I got from Hetzner yesterday.

Thanks

from hetzner_ddns.

filiparag avatar filiparag commented on June 19, 2024

Docs package is not required, but if you are using this as an OpenRC service, you have to install hetzner_ddns-openrc-0.2.3.apk for it to register.

And regarding the jq message, can you provide the logfile /var/log/hetzner_ddns.log? Just be sure to replace sensitive with placeholder data.

from hetzner_ddns.

ant0nioli avatar ant0nioli commented on June 19, 2024

Yes, I installed the Docs afterwards, in the first time I installed only the required package and I was getting the same problem.

This is what I have inside my /var/log/hetzner_ddns.log:

[2023-07-15 04:08:09] Started Hetzner DDNS daemons.log                          
[2023-07-15 16:29:12] Started Hetzner DDNS daemon
[2023-07-15 16:34:40] Started Hetzner DDNS daemon

A new line is added when I launch: localhost:/# hetzner_ddns

I'm fairly new with this, and as I see maybe I should use open-rc with Alpine..

An other things that catches my attention is the error message in reply when I try to start the service:

localhost:/# service hetzner_ddns enable
 * service: service `hetzner_ddns' does not exist

Here the `hetzner_ddns' name is printed with two different apostrophes at the beginning and at the end of the service name: ` and '

Thanks

from hetzner_ddns.

ant0nioli avatar ant0nioli commented on June 19, 2024

Installing hetzner_ddns-openrc-0.2.3.apk seems to be a step forward.

Now I can update the open-rc:

localhost:~# rc-update add hetzner_ddns
 * service hetzner_ddns added to runlevel default

But if I try to start the service I get this error:

localhost:~# service hetzner_ddns start
unable to read configuration file
 * ERROR: hetzner_ddns failed to start

the /var/log/hetzner_ddns.log is showing the same:

[2023-07-15 04:08:09] Started Hetzner DDNS daemons.log                          
[2023-07-15 16:29:12] Started Hetzner DDNS daemon
[2023-07-15 16:34:40] Started Hetzner DDNS daemon
[2023-07-15 17:03:18] Started Hetzner DDNS daemon

from hetzner_ddns.

filiparag avatar filiparag commented on June 19, 2024

Here the `hetzner_ddns' name is printed with two different apostrophes at the beginning and at the end of the service name: ` and '

This is an OpenRC typo, as you can see it when trying to start arbitrarily-named services:

# service foobar start
 * service: service `foobar' does not exist

Your log file should look something like this:

[2023-07-15 17:00:00] Started Hetzner DDNS daemon
[2023-07-15 17:00:03] Zone for example.com: <zone id goes here>
[2023-07-15 17:00:46] IPv4 record for test.example.com: <record id goes here>
[2023-07-15 17:00:46] IPv6 record for test.example.com: (missing)
[2023-07-13 17:01:00] Update IPv4 for test.example.com: 1.2.3.4 => 5.6.7.8

Did you add your domain and records to Hetzner DNS console?

from hetzner_ddns.

ant0nioli avatar ant0nioli commented on June 19, 2024

Did you add your domain and records to Hetzner DNS console?

I have only this info in my Hetzner DNS console.

(The domain is pointing to the Hetzner Name Servers.)

$ORIGIN mydomain.tld.
$TTL 86400
; SOA Records
@		IN	SOA	hydrogen.ns.hetzner.com. dns.hetzner.com. 2023071400 86400 10800 3600000 3600
; NS Records
@		IN	NS	helium.ns.hetzner.de.
@		IN	NS	hydrogen.ns.hetzner.com.
@		IN	NS	oxygen.ns.hetzner.com.

Should I manually add some other record for my mydomain.tld domain?

from hetzner_ddns.

filiparag avatar filiparag commented on June 19, 2024

Should I manually add some other record for my mydomain.tld domain?

Yes, you should add A/AAAA entries for every record you plan for hetzner_ddns to modify.

If reading config file still doesn't work, it might be a permissions issue, so replace these lines of /usr/bin/hetzner_ddns and see if it works:

#!/bin/sh

self='hetzner_ddns'

- if ! [ -z "$1" ]; then
-     self="${self}.$1"
- fi

# Read variabels from configuration file
- if test -G "/etc/$self.conf"; then
+ if test -f "/etc/$self.conf"; then
    . "/etc/$self.conf"

from hetzner_ddns.

ant0nioli avatar ant0nioli commented on June 19, 2024

With the /usr/bin/hetzner_ddns change the service is starting!

But the log looks the same.

In Hetzner DNS I have added only an A record with the subdomain sub.mydomain.tld I want to use, and the public IP I'm having at the moment assigned.

Maybe something more is needed?

Thank you again for your help.

from hetzner_ddns.

filiparag avatar filiparag commented on June 19, 2024

Maybe something more is needed?

If you properly set the configuration file and did all the things you said, I am not sure why it is still not working. I tried replicating your problem on AlpineLinux 3.18 but to no avail - it works as intended.

What I may suggest is for you to manually try running curl commands [1] and [2] to see if the API is properly accessible from your machine.

from hetzner_ddns.

ant0nioli avatar ant0nioli commented on June 19, 2024

If you properly set the configuration file and did all the things you said, I am not sure why it is still not working. I tried replicating your problem on AlpineLinux 3.18 but to no avail - it works as intended.

Thank you for trying to replicate it. I'm using AlpineLinux 3.17 now, but the problem I get is the same I was getting with 3.18.

What I may suggest is for you to manually try running curl commands [1] and [2] to see if the API is properly accessible from your machine.

I tried to run the two curl commands from the VM and I correctly got the records result from Heitzner.

Maybe the is something I'm missing about the whole picture...

from hetzner_ddns.

ant0nioli avatar ant0nioli commented on June 19, 2024

Something that might help.

(sensitive data has been replaced with dummy data)

When I launch this code:

curl "https://dns.hetzner.com/api/v1/records?zone_id=YTUJ78564cx345gd7UUUUT" -H "Auth-API-Token: UIROSJHYUHYUI4hduand988" 2>/dev/null | jq -r '.records[] | .name + " " + .type + " " + .id'

I get:

@ NS 11a4bcccca56t337fc972f249852083e
@ NS 61deb815148epod67854rc531d1128e7
@ NS 742a5fdser567a5d7dce2e51decb12cb
@ SOA dd16b99787878a42e2ce15eb58bd15f4
sub A c1884fh7h89765fu65e47819f22f8499

But when I launch the same command including the last awk command | awk "\$1==\"$1\" && \$2==\"A\" {print \$3}":

curl "https://dns.hetzner.com/api/v1/records?zone_id=YTUJ78564cx345gd7UUUUT" -H "Auth-API-Token: UIROSJHYUHYUI4hduand988" 2>/dev/null | jq -r '.records[] | .name + " " + .type + " " + .id' | awk "\$1==\"$1\" && \$2==\"A\" {print \$3}"

I get nothing.

from hetzner_ddns.

filiparag avatar filiparag commented on June 19, 2024

I am still unable to reproduce your issue, but it might be a bug so I labeled it as such.

But when I launch the same command including the last awk command | awk "$1=="$1" && $2=="A" {print $3}":

When you are running this awk command, you have to substitute $1 with your SUBDOMAIN subdomain:

curl "https://dns.hetzner.com/api/v1/records?zone_id=$zone" \
                -H "Auth-API-Token: $key" 2>/dev/null | \
            jq -r '.records[] | .name + " " + .type + " " + .id' | \
            awk "\$1==\"SUBDOMAIN\" && \$2==\"A\" {print \$3}"

I ran this command with BusyBox 1.35.0 on AlpineLinux.

from hetzner_ddns.

ant0nioli avatar ant0nioli commented on June 19, 2024

You are totally right @filiparag 😅

I substituted the $1 with the actual subdomain and I'm correctly getting the id as result.

I'm running this as root, I don´t know if this could be a problem.

Thank you for your help, if I have any positive update I will post them here.

from hetzner_ddns.

filiparag avatar filiparag commented on June 19, 2024

I will close the issue for now. If you have any updates, please post them here.

from hetzner_ddns.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.