Coder Social home page Coder Social logo

filiparag / hetzner_ddns Goto Github PK

View Code? Open in Web Editor NEW
48.0 7.0 6.0 58 KB

Hetzner Dynamic DNS (DDNS, DynDNS) daemon

License: BSD 2-Clause "Simplified" License

Makefile 21.09% Roff 6.45% Shell 70.89% Dockerfile 1.58%
hetzner-dyndns hetzner hetzner-api freebsd daemon openrc systemd ddns ddns-updater dns

hetzner_ddns's Introduction

Hetzner Dynamic DNS Daemon

A simple daemon to continuously update Hetzner DNS A and AAAA records for your server with a dynamic IP address.

It features support for multiple subdomain records with painless configuration and administration.

Installation

Prebuilt packages

Officially supported operating systems:

Packages for the latest stable version can be found here.

Feel free to contribute to first-party support for other operating systems.

Manual Installation

Dependencies: awk, curl, jq.

# Download
git clone https://github.com/filiparag/hetzner_ddns.git
cd hetzner_ddns

# Install
sudo make install

# systemd service
sudo make systemd

# FreeBSD service
sudo make freebsd-rc

# NetBSD service
sudo make netbsd-rc

# OpenRC service
sudo make openrc

Configuration

Configuration file is located at /usr/local/etc/hetzner_ddns.conf

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

# Hetzner DNS API key
key='18fe3b02339b23ef2418f9feda1b69ef'

# Top level domain name
domain='example.com'

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

To obtain an API key, go to Hetzner DNS Console.

Configuration for prebuilt packages

Default configuration location differs in prebuilt packages:

  • Linux distributions: /etc/hetzner_ddns.conf
  • FreeBSD: /usr/local/etc/hetzner_ddns.conf
  • NetBSD: /usr/pkg/etc/hetzner_ddns.conf

Manage records for multiple domains

Currently, this utility supports management of one domain per daemon. If you have multiple domains, use CNAME records to point them to one the daemon will manage, as shown in the following example:

# Managed domain (master.tld)
@		IN	A	    1.2.3.4
@		IN	AAAA	1:2:3:4::

# Other domain
service		IN	CNAME	master.tld.

Multiple daemon instances for systemd

If your operating system relies on systemd, you can easily run multiple daemons as shown below:

# Create configuration file for foobar.tld domain
sudo cp -p /usr/local/etc/hetzner_ddns.conf.sample /usr/local/etc/hetzner_ddns.foobar.conf

# Modify created file to reflect your preferences

# Enable and start foobar.tld's daemon
sudo systemctl enable hetzner_ddns@foobar

Usage

Run on startup

# systemd
sudo systemctl enable hetzner_ddns

# FreeBSD and NetBSD
sudo service hetzner_ddns enable

# OpenRC
sudo rc-update add hetzner_ddns

Start/Stop

# systemd
sudo systemctl start/stop hetzner_ddns

# FreeBSD, NetBSD and OpenRC
sudo service hetzner_ddns start/stop

Log file is located at /var/log/hetzner_ddns.log

hetzner_ddns's People

Contributors

filiparag avatar jofroop avatar rjahanbakhshi avatar thenktor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

hetzner_ddns's Issues

Service is not starting and config file is not being found on my installation

Hi!

I'm trying to get your application working inside a libvirt's VM, the OS I'm using is Alpine 3.18.2.

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

I'm getting this errors:

localhost:/# hetzner_ddns
jq: error (at <stdin>:0): Cannot iterate over null (null)
localhost:/# service hetzner enable
 * service: service `hetzner_ddns' does not exist
localhost:/etc# 
localhost:/# hetzner_ddns start
unable to read configuration file

Any clue?

Thank you very much for sharing this @filiparag !!

Wildcard subdomains unexpeted expansion

Couldn't quite figure out where it happens but the wildcard subdomain seems to be receiving a shell expanseion somewhere.

Placed "@ *" into records variable. Debian 11.2

[2022-11-16 15:30:29] Missing both records for bin.example.org
[2022-11-16 15:30:29] Missing both records for boot.example.org
[2022-11-16 15:30:30] Missing both records for dev.example.org
...

It seems that the asterisk is being expanded to the files in the root directory somewhere, but I couldn't figure it out- the obvious contenders are taken care of (no missing double quotes i could find...)

Copr repodata folder missing (at least on Fedora 39)

Hi, when trying to update I get the following error:

Copr repo for hetzner_ddns owned by filiparag                                                                                     321  B/s | 341  B     00:01    
Errors during downloading metadata for repository 'copr:copr.fedorainfracloud.org:filiparag:hetzner_ddns':
  - Status code: 404 for https://download.copr.fedorainfracloud.org/results/filiparag/hetzner_ddns/fedora-39-x86_64/repodata/repomd.xml (IP: 13.225.78.78)
Error: Failed to download metadata for repo 'copr:copr.fedorainfracloud.org:filiparag:hetzner_ddns': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

There is indeed no repodata folder at that address: https://download.copr.fedorainfracloud.org/results/filiparag/hetzner_ddns/fedora-39-x86_64/

Can you have a look please?

Error: No applicable records found

Hi there, I've got a problem regarding getting my domain pointing to the correct IP-address.

Config

# 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'

Output

hetzner-ddns_1  | [2024-07-20 09:17:42] Started Hetzner DDNS daemon
hetzner-ddns_1  | [2024-07-20 09:17:42] Reading configuration from /etc/hetzner_ddns.conf
hetzner-ddns_1  | [2024-07-20 09:17:43] Zone for myawesome.domain: some_key
hetzner-ddns_1  | [2024-07-20 09:17:43] Warning: Missing both A and AAAA records for bla.myawesome.domain
hetzner-ddns_1  | [2024-07-20 09:17:44] Warning: Missing both A and AAAA records for blubb.myawesome.domain
hetzner-ddns_1  | [2024-07-20 09:17:44] Error: No applicable records found myawesome.domain

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.

Problem installing on Raspberry Pi

Hello,
thanks for the code, that's exactly what I'm looking for! Sorry, I'm kind of a n00b here. I sucessfully installed it on one Raspberry Pi, but on the other one I get the following error:

Job for hetzner_ddns.service failed because the control process exited with error code.
See "systemctl status hetzner_ddns.service" and "journalctl -xe" for details.

where status yields:

● hetzner_ddns.service - Hetzner Dynamic DNS
     Loaded: loaded (/etc/systemd/system/hetzner_ddns.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Sat 2024-02-10 11:55:00 CET; 5s ago
       Docs: man:hetzner_ddns(1)
    Process: 17068 ExecStartPre=/usr/bin/touch /var/log/hetzner_ddns.log (code=exited, status=0/SUCCESS)
    Process: 17069 ExecStartPre=/usr/bin/chown daemon:root /var/log/hetzner_ddns.log (code=exited, status=203/EXEC)`

and journalctl:
`Feb 10 11:56:32 openpihole systemd[17123]: hetzner_ddns.service: Failed at step EXEC spawning /usr/bin/chown: No such file or>
░░ Subject: Process /usr/bin/chown could not be executed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ The process /usr/bin/chown could not be executed and failed.
░░
░░ The error number returned by this process is ERRNO.
Feb 10 11:56:32 openpihole systemd[1]: hetzner_ddns.service: Control process exited, code=exited, status=203/EXEC
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ An ExecStartPre= process belonging to unit hetzner_ddns.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 203.
Feb 10 11:56:32 openpihole systemd[1]: hetzner_ddns.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ The unit hetzner_ddns.service has entered the 'failed' state with result 'exit-code'.
Feb 10 11:56:32 openpihole systemd[1]: Failed to start Hetzner Dynamic DNS.
░░ Subject: A start job for unit hetzner_ddns.service has failed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A start job for unit hetzner_ddns.service has finished with a failure.
░░
░░ The job identifier is 1018797 and the job result is failed.

Do you have any idea on how to solve this? Thanks!

Error: Invalid API Key

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

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.