Skip to main content

A GNU/Linux Python 3.5+ Dynamic DNS client for your homebrew server.

Project description

hdyndns

A GNU/Linux Python 3.5+ Dynamic DNS client for your homebrew server.

When To Use It

From Access Your Home Network From Anywhere With Dynamic DNS:

A Local Update Client

If your router doesn’t support DDNS services, you will need a local client to run on a frequently used computer somewhere on your home network. This lightweight little application will check what your IP address is and then phone home to the DDNS provider to update your DDNS record. It’s less ideal than a router-based solution–if the computer isn’t on when your IP address changes, then the record doesn’t get updated–but it’s certainly better than manually editing your DDNS entry.

This tool is the 'Local Update Client' component of the Dynamic DNS hombrew setup.

Why To Use It

  • Lightweight with no external Python dependencies.
  • Simple 'ini style' configuration.
  • Avoid writing hard to maintain Dynamic DNS bash scripts.
  • Small code base, easy to understand, maintain and extend and is cross platform.
  • Will be maintained going forward and is being used in existing homebrew setups.

How To Use It

The following examples were run on a Debian system using the Gandi DNS provider.

Make sure you have the necessary system prerequisites with:

$ sudo apt update
$ sudo apt install -y python3 python3-dev python3-pip

And then install hdyndns with:

$ sudo useradd -m hdyndns
$ sudo -u hdyndns pip3 install --user hdyndns

If you have an DNS A record for mysite.com and subdomains foo.mysite.com and bar.mysite.come that looks like the following:

@   1800 IN A 86.91.199.200
foo 1800 IN A 86.91.199.200
bar 1800 IN A 86.91.199.200

Then create a configuration file at /home/hdyndns/.hdyndns/hdyndns.ini:

[mysite.com]
provider = gandi
api_secret = mySuperSecretApiPassword
subdomains = foo,bar

Finally, add it your root crontab (sudo crontab -e) to run it every 15 minutes:

*/15 * * * * runuser -l hdyndns -c '$HOME/.local/bin/hdyndns' &>/dev/null

Regarding the &>/dev/null part, see issue #1.

Known Limitations

  • Different IP addresses for subdomains are currently not supported.

Please open an issue if you want to collaborate on removing these limitations.

Supported DNS Providers

Any DNS provider can be supported if they provide some programmatic way to update their DNS records (for example, if they have a public API). If your current DNS provider is not listed above, please raise an issue. If you'd like to add it yourself, take a look at hdyndns/providers.py. All contributions welcome!

Configuration Options

  • provider: The DNS provider.
  • api_secret: The API secret for the DNS provider.
  • subdomains: Optional comma separated list of subdomains to also update DNS entries for.
  • ttl: The DNS time to live counter in secods. Default is 1800.

How To Help

You'll need to install pipenv for development.

You can follow these steps to get a working local installation:

$ pipenv install --dev  # install the dependencies
$ pipenv run pip install -e .  # install the local hdyndns
$ pipenv run hdyndns --help  # check that the local hdynds is working
$ pipenv run tox -e py37  # run the tests on python 3.7 (run `tox -l` to see pythons)

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
hdyndns-0.0.6-py3-none-any.whl (19.4 kB) Copy SHA256 hash SHA256 Wheel py3

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page