/transip-dynamic-dns

Keep a dns record up to date

Primary LanguagePython

TransIp Dynamic DNS

Build Status Docker Pulls GitHub repo size in bytes GitHub release GitHub issues

This repo is a fork from transip-dyndns but actually a complete refactor (including new config structure). Keeps dns entries on transip for one or multiple domains up to date with the current WAN IP (or custom content).

Features 📣

  • Update multiple domains and their entries
  • Interval (by default every 1h)
  • Docker support

Configure ❗

In the data folder there is an example file call config-example.json. rename that file as config.json and configure it as below demonstrated.

Example

{
  "transip": {
    "login": "User",
    "privateKeyPath": "/secrets/private.key"
  },
  "domainsToCheck": {
    "domains": [
      {
        "domain": "example.net",
        "dnsEntries": [
          {
            "name": "@",
            "type": "A"
          },
          {
            "name": "prefix",
            "type": "CNAME",
            "content": "@"
          }
        ]
      }
    ]
  },
  "logLevel": "info",
  "dnsCheckInterval": "30m"
}

Note: every dnsEntry needs to contain at least a name and type.

dnsEntry attributes

name { String } (required)
type { String } (required)

More info here

Environment variables (optional, when no config file used)

Its also possible to use environment variables.

Required
TRANSIP_LOGIN=username
TRANSIP_PRIVATE_KEY=/secrets/id_rsa.transip>
DOMAINS_TO_CHECK={ "domains": [ { "domain": "example.net", "dnsEntries": [ { "name": "@", "type": "AAAA", "content": "1.2.3.4" } ] } ] }
Optional
# Optional
WAN_CHECK_SERVICE_URL=https://api.ipify.org

Locally

You could also run it locally

git clone git@github.com:frankforpresident/transip-dynamic-dns.git
cd transip-dynamic-dns
pip install python-transip schedule
python transip-ddns.py

Docker 🐳

Also available as a docker image.

docker pull frankforpresident/transip-dynamic-dns:latest

Run

To run the container we need to mount 2 volumes.

  • Directory where the privateKey 🔑 can be found.
  • Directory where the config file 📄 is stored.
docker run -t -v ~/.secrets/private.key:/secrets/private.key:ro -v ~/transip-dynamic-dns/data:/data ~/transip-dynamic-dns/log/output.log:/log/output.log frankforpresident/transip-dynamic-dns

Compose

 dyndns:
    image: frankforpresident/transip-dynamic-dns
    container_name: "transip-dynamic-dns"
    restart: always
    volumes:
      - ~/transip-dynamic-dns/data:/data
      - ~/transip-dynamic-dns/log/output.log:/log/output.log
      - ~/.secrets/private.key:/secrets/private.key:ro