Skip to main content

A DNS management tool to mange DNS setup for domains

Project description

dnsconfigurator

GitLab Build Status

Python package I use to configure the DNS of my domain names. Keep a local DNS configuration files - covering all my domains - up to date and use DNS providers API to apply the configuration.

So if you have many domains and wish a single place to keep the configuration, I think this is a good tool

Features

  • IP's can be defined once with an alias, so if an IP changes, I can just make a single edit here, and that will automatically propagate to all my domains.
  • The config has a default section, so since all my domains share MX configuration and they all need both a "www" and a "test" subdomain, I can just add that to my default configuration, and it will automatically be applied to all my domains.
  • I often add and remove subdomains. This way I have simple way to check if my web-server configuration matches my DNS configuration.
  • This package can also be used to create TXT DNS records to Certbot, so I can automatically create and renew SSL certificates using DNS challenges.

How to use

Install the package. Look at the sample configuration. Create your own domain DNS configuration file, select a DNS provider, get an API key, deploy the configuration.

Configuration

The idea of the package is to be able to have a single DNS configuration file, where you define your DNS configuration for all your domains - no matter which DNS provider you use for the individual domains.

Check the sample config file using dnsconfigurator sample or python -m dnsconfigurator sample.

Create you own configuration file and try the various commands. The default config file is dns_config.yaml but you can specify another with the -f option. I hope to add better config file validation and a specific validate command. To check your config now just check what DNS records dnsconfigurator would make on your domain with:
dnsconfigurator local DOMAIN

Remote authentification

To access the DNS providers you need to authenticate. The specific providers needs specific authentication, which is handled in the provider-modules. Each provider module needs specific tokens or values defined as environment variables.

Usually I use API_{PROVIDER} as the name of the env variable with the API token. I also use CloudFlare as provider, and this provider needs en EMAIL variable as well. I use environment variables, because I hate having config files with secrets laying around, so I prefer to extract secrets from various password managers and store them as environment variables just while the program is running.

Other means of authenticating (like config files) or using better methods like vault or password managers could be an improvement.

Commands to use

  • list
    Show the domain names defined in your configuration file (and the provider)
  • status
    Show all domains AND check if local configuration matches the remote configuration or if the domain needs an update.
  • provider FQDN
    Show which provider is used for a domain (possibly with subdomain added). This is used to let tools know which credentials they need to create, before they can make changes to this domain.
  • local DOMAIN
    Show the local configuration for a domain
  • remote DOMAIN
    Show the remote configuration for a domain
  • compare DOMAIN
    Compare the local and remote configuration and show what an update would do
  • update DOMAIN
    Run the synchronization setting the remote DNS records to match the local configuration
  • dnscert DOMAIN CHALLENGE
    Add (or remove) special acme-challenge Certbot TXT records for creating or renewing SSL certificates.

Examples

The package includes a simple configuration file with 3 domains defined. This sample config can be used to try the different commands.

License

dnsconfigurator is distributed under the MIT license

Contact

In the completely unexpected situation, that anyone else thinks this could be useful, you are welcome to contact Kristian Hougaard

ToDo

  • Better user documentation
  • More tests. Only a small amount of testing is done
  • Add mock provider module for the testprovider, so remote stuff can be tested and sample config can do more stuff
  • Add providers command to show which providers are supported
  • Make it simpler to add more providers
  • Add commands and entrypoints which can directly be used as Certbot hooks. Maybe check if I can make it work as an "official" cerbot hook and not just as a manual hook.

Project details


Download files

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

Source Distribution

dnsconfigurator-1.1.0.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

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

dnsconfigurator-1.1.0-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dnsconfigurator-1.1.0.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.6

File hashes

Hashes for dnsconfigurator-1.1.0.tar.gz
Algorithm Hash digest
SHA256 329d892dc19f23a05962ba9c767dae90fbc7d7ff7b839855cef95f23dc6286b8
MD5 1dc41d8df318ccc63869a472868806df
BLAKE2b-256 53e3f5e804e9bcbf9388cfcf6c40f61b5986d36fa8b13afdec75f961c4608eb0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dnsconfigurator-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 703724342b6545d98cfcb2216bbc336e4b7b55bb47a37bdd2b4083977c84b4ba
MD5 7fb150d0784c94225147bce769c5a872
BLAKE2b-256 0f5f50f56e996a794d1c55708cd459dbe0b325e9a131aad390931c4478b8f738

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 Pingdom Monitoring Sentry Error logging StatusPage Status page