Skip to main content
This package on the Python Package Index Continuous integration Documentation Status

About

dyndns is a HTTP based API to dynamically update DNS records (DynDNS). It’s uses Python and the Flask web framework to accomplish this task.

Installation

Install dyndns into the directory /usr/local/share/python-virtualenv/dyndns using a virtual environment.

python3 -m venv /usr/local/share/python-virtualenv/dyndns
source /usr/local/share/python-virtualenv/dyndns/bin/activate
pip3 install dyndns

The working directory of our flask web API is in the directory /var/www/dyndns.example.com. Create a file /var/www/dyndns.example.com/dyndns.ini.

[uwsgi]
module = dyndns.webapp:app

master = true
processes = 5

socket = /var/www/dyndns.example.com/dyndns.sock
chmod-socket = 664
uid = www-data
gid = www-data
vacuum = true

die-on-term = true

Example configuration file for nginx: /etc/nginx/sites-available/dyndns.example.com.

server {
    server_name dyndns.example.com;
    listen 80;
    listen [::]:80;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name dyndns.example.com;
    ssl_certificate /etc/letsencrypt/live/dyndns.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/dyndns.example.com/privkey.pem;

    location / {
                    include uwsgi_params;
                    uwsgi_pass unix:/var/www/dyndns.example.com/dyndns.sock;
    }

}

/etc/systemd/system/dyndns-uwsgi.service

[Unit]
Description=uWSGI instance to serve dyndns
After=network.target

[Service]
User=www-data
Group=www-data
WorkingDirectory=/var/www/dyndns.example.com
Environment="PATH=/usr/local/share/python-virtualenv/dyndns/bin"
ExecStart=/usr/local/share/python-virtualenv/dyndns/bin/uwsgi --ini uwsgi.ini

[Install]
WantedBy=multi-user.target

Configuration

dyndns requires a configuration file in the YAML markup language.

dyndns looks on three places for its configuration. It picks the first existing configuration file and ignores the later in this order:

  1. Custom path specified in the environment variable dyndns_CONFIG_FILE

  2. Current working directory of the dyndns app (cwd): <cwd>/.dyndns.yml

  3. /etc/dyndns.yml

---
secret: 12345678
nameserver: 127.0.0.1
dyndns_domain: dyndns.example.com
zones:
  - name: dyndns.example.com
    tsig_key: tPyvZA==
  • secret: A password like secret string. The secret string has to be at least 8 characters long and only alphnumeric characters are allowed.

  • nameserver: The IP address of your nameserver. Version 4 or version 6 are allowed. Use 127.0.0.1 to communicate with your nameserver on the same machine.

  • dyndns_domain: The domain to serve the dyndns HTTP API. This key is only used in the usage page. Can be omitted.

  • zones: At least one zone specified as a list.
    • name: The domain name of the zone, for example dyndns.example.com.

    • tsig_key: The tsig-key. Use the hmac-sha512 algorithm to generate the key: tsig-keygen -a hmac-sha512 dyndns.example.com

Usage

dyndns offers two HTTP web APIs to update DNS records. A simple and a more restricted one using only path segments and a more flexible using query strings.

Update by path

  1. <your-domain>/update-by-path/secret/fqdn

  2. <your-domain>/update-by-path/secret/fqdn/ip_1

  3. <your-domain>/update-by-path/secret/fqdn/ip_1/ip_2

Update by query

<your-domain>/update-by-query?secret=secret&fqdn=fqdn&ip_1=1.2.3.4

Arguments for the query string

  • secret: A password like secret string. The secret string has to be at least 8 characters long and only alphnumeric characters are allowed.

  • fqdn: The Fully-Qualified Domain Name (e. g. www.example.com). If you specify the argument fqdn, you don’t have to specify the arguments zone_name and record_name.

  • zone_name: The zone name (e. g. example.com). You have to specify the argument record_name.

  • record_name: The record name (e. g. www). You have to specify the argument zone_name.

  • ip_1: A IP address, can be version 4 or version 6.

  • ip_2: A second IP address, can be version 4 or version 6. Must be a different version than ip_1.

  • ipv4: A IP address version 4.

  • ipv6: A IP address version 6.

  • ttl: Time to live. The default value is 300.

Delete by path

Hit this url to delete a DNS record corresponding to the fqdn. Both ipv4 and ipv6 entries are deleted.

<your-domain>/delete-by-path/secret/fqdn

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dyndns-1.1.0.tar.gz (63.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dyndns-1.1.0-py3-none-any.whl (49.3 kB view details)

Uploaded Python 3

File details

Details for the file dyndns-1.1.0.tar.gz.

File metadata

  • Download URL: dyndns-1.1.0.tar.gz
  • Upload date:
  • Size: 63.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.8.5

File hashes

Hashes for dyndns-1.1.0.tar.gz
Algorithm Hash digest
SHA256 45f1f6a68b347815869e0fea5434f095bcde074a8d431d3b373460d5373ef67c
MD5 6a8fe3a7a2d3d55a3f15d73a55caf844
BLAKE2b-256 92ab7edebc301d3492252faa4644722321f7188f5aae7423f5b40d3ee93c3831

See more details on using hashes here.

File details

Details for the file dyndns-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: dyndns-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 49.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.8.5

File hashes

Hashes for dyndns-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f220322968dba07117ee58183a10dab12b5bdfd34042959457fd95e00125d142
MD5 c961802fad0a868dd10a149297bfff4c
BLAKE2b-256 91ff1d7f25e5ea85991c08103fe19e64930f2ca8bef0e19be5dc0220cf71a668

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page