• Stars
    star
    1,711
  • Rank 27,277 (Top 0.6 %)
  • Language
    Go
  • License
    MIT License
  • Created about 6 years ago
  • Updated 26 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Container to update DNS records periodically with WebUI for many DNS providers

Lightweight universal DDNS Updater with Docker and web UI

Light container updating DNS A and/or AAAA records periodically for multiple DNS providers

DDNS Updater logo

Build status

dockeri.co

Last release Last Docker tag Last release size GitHub last release date Commits since release

Latest size

GitHub last commit GitHub commit activity GitHub closed PRs GitHub issues GitHub closed issues

Lines of code Code size GitHub repo size Go version

MIT Visitors count

Features

  • Updates periodically A records for different DNS providers:
    • Aliyun
    • AllInkl
    • Cloudflare
    • DD24
    • DDNSS.de
    • deSEC
    • DigitalOcean
    • DonDominio
    • DNSOMatic
    • DNSPod
    • Dreamhost
    • DuckDNS
    • DynDNS
    • Dynu
    • EasyDNS
    • FreeDNS
    • Gandi
    • GCP
    • GoDaddy
    • Google
    • He.net
    • Infomaniak
    • INWX
    • Linode
    • LuaDNS
    • Name.com
    • Namecheap
    • Netcup
    • NoIP
    • Now-DNS
    • Njalla
    • OpenDNS
    • OVH
    • Porkbun
    • Selfhost.de
    • Servercow.de
    • Spdyn
    • Strato.de
    • Variomedia.de
    • Zoneedit
    • Want more? Create an issue for it!
  • Web User interface

Web UI

  • 11MB Docker image based on a Go static binary in a Scratch Docker image
  • Persistence with a JSON file updates.json to store old IP addresses with change times for each record
  • Docker healthcheck verifying the DNS resolution of your domains
  • Highly configurable
  • Send notifications with Shoutrrr using SHOUTRRR_ADDRESSES
  • Compatible with amd64, 386, arm64, armv7, armv6, s390x, ppc64le, riscv64 CPU architectures.

Setup

The program reads the configuration from a JSON object, either from a file or from an environment variable.

  1. Create a directory of your choice, say data with a file named config.json inside:

    mkdir data
    touch data/config.json
    # Owned by user ID of Docker container (1000)
    chown -R 1000 data
    # all access (for creating json database file data/updates.json)
    chmod 700 data
    # read access only
    chmod 400 data/config.json

    If you want to use another user ID, build the image yourself with --build-arg UID=<your-uid>. You could also just run the container as root with --user="0" but this is not advised security wise.

  2. Write a JSON configuration in data/config.json, for example:

    {
        "settings": [
            {
                "provider": "namecheap",
                "domain": "example.com",
                "host": "@",
                "password": "e5322165c1d74692bfa6d807100c0310"
            }
        ]
    }

    You can find more information in the configuration section to customize it.

  3. Run the container with

    docker run -d -p 8000:8000/tcp -v "$(pwd)"/data:/updater/data qmcgaw/ddns-updater
  4. ⚠️ If you use IPv6, you might need to set -e IPV6_PREFIX=/64 (/64 is your prefix, depending on your ISP)

  5. (Optional) You can also set your JSON configuration as a single environment variable line (i.e. {"settings": [{"provider": "namecheap", ...}]}), which takes precedence over config.json. Note however that if you don't bind mount the /updater/data directory, there won't be a persistent database file /updater/updates.json but it will still work.

Next steps

You can also use docker-compose.yml with:

docker-compose up -d

You can update the image with docker pull qmcgaw/ddns-updater. Other Docker image tags are available.

GHCR

Images are also added to the Github Container Registry. To use the GHCR container replace qmcgaw/ddns-updater to ghcr.io/qdm12/ddns-updater, further details are available here

Configuration

Start by having the following content in config.json, or in your CONFIG environment variable:

{
    "settings": [
        {
            "provider": "",
        },
        {
            "provider": "",
        }
    ]
}

For each setting, you need to fill in parameters. Check the documentation for your DNS provider:

Note that:

  • you can specify multiple hosts for the same domain using a comma separated list. For example with "host": "@,subdomain1,subdomain2",.

Environment variables

Environment variable Default Description
CONFIG One line JSON object containing the entire config (takes precendence over config.json file) if specified
PERIOD 5m Default period of IP address check, following this format
IPV6_PREFIX /128 IPv6 prefix used to mask your public IPv6 address and your record IPv6 address. Ranges from /0 to /128 depending on your ISP.
PUBLICIP_FETCHERS all Comma separated fetcher types to obtain the public IP address from http and dns
PUBLICIP_HTTP_PROVIDERS all Comma separated providers to obtain the public IP address (ipv4 or ipv6). See the Public IP section
PUBLICIPV4_HTTP_PROVIDERS all Comma separated providers to obtain the public IPv4 address only. See the Public IP section
PUBLICIPV6_HTTP_PROVIDERS all Comma separated providers to obtain the public IPv6 address only. See the Public IP section
PUBLICIP_DNS_PROVIDERS all Comma separated providers to obtain the public IP address (IPv4 and/or IPv6). See the Public IP section
PUBLICIP_DNS_TIMEOUT 3s Public IP DNS query timeout
UPDATE_COOLDOWN_PERIOD 5m Duration to cooldown between updates for each record. This is useful to avoid being rate limited or banned.
HTTP_TIMEOUT 10s Timeout for all HTTP requests
LISTENING_PORT 8000 Internal TCP listening port for the web UI
ROOT_URL / URL path to append to all paths to the webUI (i.e. /ddns for accessing https://example.com/ddns through a proxy)
HEALTH_SERVER_ADDRESS 127.0.0.1:9999 Health server listening address
DATADIR /updater/data Directory to read and write data files from internally
BACKUP_PERIOD 0 Set to a period (i.e. 72h15m) to enable zip backups of data/config.json and data/updates.json in a zip file
BACKUP_DIRECTORY /updater/data Directory to write backup zip files to if BACKUP_PERIOD is not 0.
RESOLVER_ADDRESS Your network DNS A plaintext DNS address to use, such as 1.1.1.1:53. This is useful for split dns, see #389
LOG_LEVEL info Level of logging, debug, info, warning or error
LOG_CALLER hidden Show caller per log line, hidden or short
SHOUTRRR_ADDRESSES (optional) Comma separated list of Shoutrrr addresses (notification services)
TZ Timezone to have accurate times, i.e. America/Montreal

Public IP

By default, all public IP fetching types are used and cycled (over DNS and over HTTPs).

On top of that, for each fetching method, all echo services available are cycled on each request.

This allows you not to be blocked for making too many requests.

You can otherwise customize it with the following:

  • PUBLICIP_HTTP_PROVIDERS gets your public IPv4 or IPv6 address. It can be one or more of the following:
  • PUBLICIPV4_HTTP_PROVIDERS gets your public IPv4 address only. It can be one or more of the following:
  • PUBLICIPV6_HTTP_PROVIDERS gets your public IPv6 address only. It can be one or more of the following:
  • PUBLICIP_DNS_PROVIDERS gets your public IPv4 address only or IPv6 address only or one of them (see #136). It can be one or more of the following:
    • cloudflare
    • opendns

Host firewall

If you have a host firewall in place, this container needs the following ports:

  • TCP 443 outbound for outbound HTTPS
  • UDP 53 outbound for outbound DNS resolution
  • TCP 8000 inbound (or other) for the WebUI

Architecture

At program start and every period (5 minutes by default):

  1. Fetch your public IP address
  2. For each record:
    1. DNS resolve it to obtain its current IP address(es)
      • If the resolution fails, update the record with your public IP address by calling the DNS provider API and finish
    2. Check if your public IP address is within the resolved IP addresses
      • Yes: skip the update
      • No: update the record with your public IP address by calling the DNS provider API

💡 We do DNS resolution every period so it detects a change made to the record manually, for example on the DNS provider web UI 💡 As DNS resolutions are essentially free and without rate limiting, these are great to avoid getting banned for too many requests.

Special case: Cloudflare

For Cloudflare records with the proxied option, the following is done.

At program start and every period (5 minutes by default), for each record:

  1. Fetch your public IP address
  2. For each record:
    1. Check the last IP address (persisted in updates.json) for that record
      • If it doesn't exist, update the record with your public IP address by calling the DNS provider API and finish
    2. Check if your public IP address matches the last IP address you updated the record with
      • Yes: skip the update
      • No: update the record with your public IP address by calling the DNS provider API

This is the only way as doing a DNS resolution on the record will give the IP address of a Cloudflare server instead of your server.

⚠️ This has the disadvantage that if the record is changed manually, the program will not detect it. We could do an API call to get the record IP address every period, but that would get you banned especially with a low period duration.

Testing

  • The automated healthcheck verifies all your records are up to date using DNS lookups
  • You can also manually check, by:
    1. Going to your DNS management webpage
    2. Setting your record to 127.0.0.1
    3. Run the container
    4. Refresh the DNS management webpage and verify the update happened

Build the image

You can build the image yourself with:

docker build -t qmcgaw/ddns-updater https://github.com/qdm12/ddns-updater.git

You can use optional build arguments with --build-arg KEY=VALUE from the table below:

Build argument Default Description
UID 1000 User ID running the container
GID 1000 User group ID running the container
VERSION unknown Version of the program and Docker image
CREATED an unknown date Build date of the program and Docker image
COMMIT unknown Commit hash of the program and Docker image

Development and contributing

License

This repository is under an MIT license

Used in external projects

Support

Sponsor me on Github or donate to paypal.me/qmcgaw

https://github.com/sponsors/qdm12 https://www.paypal.me/qmcgaw

Many thanks to J. Famiglietti for supporting me financially 🥇👍

More Repositories

1

gluetun

VPN client in a thin Docker container for multiple VPN providers, written in Go, and using OpenVPN or Wireguard, DNS over TLS, with a few proxy servers built-in.
Go
7,717
star
2

gluetun-wiki

Home to the Markdown Wiki page for Gluetun
369
star
3

godevcontainer

Golang development container for Visual Studio Code Remote Containers Development
Dockerfile
258
star
4

dns

Docker DNS server on steroids to access DNS-over-TLS from Cloudflare, Google, Quad9, Quadrant or CleanBrowsing
Go
226
star
5

latexdevcontainer

LaTeX development container for Visual Studio Code Remote Containers Development
Dockerfile
190
star
6

deunhealth

Binary program to restart unhealthy Docker containers
Go
117
star
7

caddy-ui

UI for the Caddy proxy server
TypeScript
72
star
8

basedevcontainer

Base development Docker image used by other development Docker images
Shell
59
star
9

cod4-docker

Runs a Call of duty 4 Modern Warfare (cod4x) dedicated server in a Docker container.
Go
57
star
10

youtube-dl-docker

Download with youtube-dl using command line arguments or a configuration file + Automated updates
Shell
46
star
11

stackedit-docker

StackEdit 5.14.5 Server in a light Docker container
Go
42
star
12

rustdevcontainer

Rust development container for VSCode
Dockerfile
40
star
13

caddy-scratch

Caddy server 2.0.0 / 1.0.5 on Docker Scratch, all in 18MB / 35MB
Dockerfile
39
star
14

reprint

Golang deep copying, THE RIGHT WAY ™️
Go
37
star
15

htmlspitter

NodeJS server to spit out HTML from loaded JS using Puppeteer
TypeScript
31
star
16

hbc

API of homomorphic binary operations such as binary comparisons or binary divisions using the library HElib
C++
28
star
17

port-checker

Simple Docker container to test if a port works using a Golang server
Go
27
star
18

reactdevcontainer

React development container for Visual Studio Code
Dockerfile
22
star
19

meemo

Run a lightweight Meemo server with database on Docker with docker-compose
Dockerfile
21
star
20

ss-server

Shadowsocks server to use with Docker and to integrate in other Go programs
Go
21
star
21

btrfs-recover-scripts

Scripts to help you recover the latest files you have lost in a BTRFS volume
Shell
21
star
22

devtainr

Static binary tool to setup your development container in your repository
Go
15
star
23

go-template

Golang server template
Go
13
star
24

binpot

The Docker based pot of binaries
Dockerfile
12
star
25

goshutdown

Go library to shutdown your goroutines gracefully and in a timely manner
Go
12
star
26

VFIO-Arch-Guide

Windows 10 Parsec server setup for an Arch Linux host
12
star
27

golibs

Experimental Go libraries for my own projects
Go
10
star
28

docker-proxy-acl-alpine

A lightweight docker Unix socket proxy which restricts endpoint usage to allowed sections
Go
9
star
29

tinier

Make your videos, images and audio files tinier
Go
9
star
30

pingodown

Introduces latency on a UDP port for gaming purposes
Go
9
star
31

teamspeak-server-alpine

Minimalist Teamspeak 3 server Docker container
Shell
9
star
32

caddy-ui-server

Server responsible to serve the Caddy UI and communicate with the Caddy server API
Go
8
star
33

BitcoinUses

Big data analytics on how bitcoins are used since their creation
Java
7
star
34

xcputranslate

Simple CI translation from Docker CPU arch strings to other format
Go
7
star
35

welcome

Golang static binary I use on my servers when I login
Go
6
star
36

files

Periodically updated files and lists used by other projects and machines
6
star
37

gosplash

Go library to make initial log lines at a program start time
Go
5
star
38

BillSplitter

Mobile website app to split your bill at a venue (backend and frontend)
JavaScript
5
star
39

updated

Go program to update files periodically
Go
5
star
40

rsync-docker

Rsync in 790KB Docker image & Rsync+SSH in 5.2MB Docker image
Shell
4
star
41

srv

srv is a small Go application to server static files over HTTP
Go
4
star
42

reactserv

A Go HTTP server to serve React compiled code (no SSR)
Go
4
star
43

gotree

Go library to build tree of files and directories
Go
4
star
44

nodedevcontainer

Dockerfile
3
star
45

govalid

Go library to validate and convert strings
Go
3
star
46

log

Go log library focused on humans and thread safety
Go
3
star
47

goservices

Go package to help manage Go long running services
Go
3
star
48

reinstall

PowerShell
3
star
49

blog

Static blog using Hugo
HTML
2
star
50

qdm12

2
star
51

iptables

Docker container to run your iptables rules
Dockerfile
2
star
52

spigot-docker

Lightweight Docker container for Spigot server
Dockerfile
2
star
53

ThumbGifs

Generates intervals GIFs from video files for any length
Python
2
star
54

errdeclutter

Finds Go error wrapping messages with cluttering prefixes such as 'failed to', 'cannot', 'unable to', etc.
1
star
55

Staminaputations

Python
1
star
56

hitinc

HTTP server counter to count visitors, claps, upvotes
1
star
57

My-Computing-course

This is a course I will give about computing in general for people new to computing
Python
1
star
58

Staminapp

Android mobile application for the Stamina system
Java
1
star
59

gosettings

Go package providing helper functions for working with settings
Go
1
star
60

cli-template

A template for cross platform, cross CPU binary CLI tools
Go
1
star
61

node-ts-template

NodeJS with Typescript template
JavaScript
1
star
62

courses

TeX
1
star
63

templates

Github templates for various programming languages I use often
1
star
64

wireguard-docker

Alpine docker image with Wireguard tooling (requires Wireguard in kernel)
Dockerfile
1
star