Skip to content

Hetzner dyndns utility for Hetzner Cloud API zones

License

Notifications You must be signed in to change notification settings

Sytm/hetzner_dyndns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hetzner Cloud API DynDns utility

This is a simple utility to update DNS records managed in the Hetzner DNS service. Supports A and AAAA records and custom services used to retrieve the effective IP address (uses SeeIP by default).

When executed without any arguments it reads the dyndns.json in the current working directory, otherwise the first argument is used as the path to read.

Sample dyndns.json (the actual config does not support comments)

{
  "HetznerApiKey": "<HETZNER_CLOUD_API_KEY>",
  "RecordTTL": 300,
  "Zones": {
    "example.de": [
      "service1",
      "service2"
    ],
    "alternative.de": [
      "backup.homelab"
    ]
  },
  "AAAA": {
    "Enabled": true,
//    "Source": "https://ipv6.seeip.org"
  },
  "A": {
    "Enabled": false,
//    "Source": "https://ipv4.seeip.org"
  }
}

It is recommended to change the file permissions of dyndns.json to 0600 to prevent access to the api key to processes running on the host.

Example crontab entry that checks and if needed updates the address every 10 minutes (given that both files are in the /root directory):

*/10 * * * * /root/dyndns /root/dyndns.json