Hetzner DNS Zone Manager
Project description
Hetzner DNS Manager
A command-line tool to interact with the Hetzner DNS API, allowing you to manage DNS records.
Function scope is limited to managing records within existing zones for now.
Features
- Import zones and records from the Hetzner DNS API
- Check DNS records against actual DNS entries
- Create missing and update mismatched DNS records
- Delete DNS records
- Stores zone data in YAML files for easy manual editing
Example Workflow
After initial import, add records to a zone YAML file with empty ID:
Then run update to push the change to the API and update the YAML file with the new ID:
The same way you can update records and push those.
Installation
The script uses PEP 723 for dependency management, so it's self-contained. You'll need Python 3.10 or higher and a working installation of uv, installed via your OS's package manager or via pip.
# Clone the repository
git clone https://github.com/serpent213/hetzner-dns-manager.git
cd hetzner-dns-manager
or
# Download raw script directly
curl -LO https://github.com/serpent213/hetzner-dns-manager/raw/refs/heads/master/hdem
chmod +x hdem
Install from PyPI
Alternatively install from PyPI:
# Install using pip
pip install hetzner-dns-manager
# Or with pipx for isolated installation
pipx install hetzner-dns-manager
After installation, you'll have access to the hdem command in your terminal.
Configuration
Set your Hetzner DNS API token as an environment variable:
export HETZNER_DNS_API_TOKEN="your_api_token_here"
You may want to add this to your shell profile file (.bashrc, .zshrc, etc.) for persistence.
Usage
The database will be created in ./zones and consists of one YAML file per zone.
Import Zones and Records
Import a specific zone:
./hdem import example.com
Import all zones:
./hdem import --all
This will create YAML files in the ./zones directory.
Check DNS Records
Check a specific zone against actual DNS entries using one of the domain's authoritative servers:
./hdem check example.com
Check all zones:
./hdem check --all
SOA records will be ignored as they are updated automatically by Hetzner.
Update DNS Records
Check and update mismatched records for a specific zone:
./hdem update example.com
Check and update mismatched records for all zones:
./hdem update --all
Delete a DNS Record
Delete a specific record:
./hdem delete example.com www
Data Structure
The YAML files in the ./zones directory follow this structure:
id: ZoneID
name: example.com
records:
- id: RecordID1
type: A
name: www
value: 192.0.2.1
- id: RecordID2
type: MX
name: '@'
value: '10 mail.example.com.'
Related Projects
Some other tools dealing with the Hetzner DNS API (that are not dynamic DNS updaters):
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hetzner_dns_manager-0.1.0.tar.gz.
File metadata
- Download URL: hetzner_dns_manager-0.1.0.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.30
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
132e14a09cf31a6c08fc13d61380bb4c0541d1b6fc7ae35163ae0c50bbc71615
|
|
| MD5 |
92d4da8f7ea8a3bceb5e8e083f69832c
|
|
| BLAKE2b-256 |
b439f334995adfe93f62271cba6dbb708e9a47c29dae267e76da98c3bf3698a7
|
File details
Details for the file hetzner_dns_manager-0.1.0-py3-none-any.whl.
File metadata
- Download URL: hetzner_dns_manager-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.30
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0ee724a624be98f04f120bff349ee21162a3e49b0050316184690936d52e12c
|
|
| MD5 |
0180cd6f15a271521c14ac9274aacacd
|
|
| BLAKE2b-256 |
22b69cca5c9775eadd5cb8a67b6fbb2eb7a431064dc8d84bbec0ccc446e17b47
|