Skip to main content

dnsleaf

CI

Workspace-driven Cloudflare DDNS for Linux, primarily Proxmox VE hosts. Requires Python 3.11+. Each entry publishes IPv4, IPv6, or both from a PVE LXC guest, a PVE VM guest agent, the local host, or explicit static addresses. A oneshot sync and a system-level systemd timer handle periodic updates. Cloudflare is the only supported provider.

1.1.0 is pending release. The public PyPI installation commands below apply after publication. Before publication, install the reviewed wheel with the same uv tool install command.

Install the Python tool

Use uv for a persistent, isolated installation. For PVE system services, run these commands in a root shell with uv available:

uv tool install --python 3.11 dnsleaf
DNSLEAF="$(uv tool dir --bin)/dnsleaf"
"$DNSLEAF" --version
"$DNSLEAF" --help

For pre-release review, replace dnsleaf in the install command with the absolute path to dnsleaf-1.1.0-py3-none-any.whl. Installing the package creates a CLI; it does not install a timer or synchronize DNS. Keep this tool environment and its Python interpreter installed for the timer. The module entrypoint is python -m dnsleaf when that Python environment contains the package.

Unprivileged users can initialize and validate writable workspaces, and sync local/static entries when credentials and state are accessible. PVE guest discovery requires host privileges. apply and uninstall require root. From a non-root shell, use explicit sudo with the absolute installed entry, for example sudo /absolute/path/to/dnsleaf apply --workspace /etc/dnsleaf/example-zone. The tool never elevates itself.

Create and configure a workspace

In the same root shell:

"$DNSLEAF" init /etc/dnsleaf/example-zone
chmod 700 /etc/dnsleaf/example-zone
install -m 600 /dev/null /etc/dnsleaf/example-zone/secrets/cloudflare_api_token.txt

Put your Cloudflare API token in that file using your editor. Restrict it to the intended zone and grant the DNS permissions needed for record reads and edits; zone lookup by name also needs zone read access. Never put the token in YAML, commands, Git, or shared reports.

Edit /etc/dnsleaf/example-zone/workspace.yaml: set zone_name, optionally zone_id, and keep api_token_file pointing to the token file. Its relative path is based on the workspace directory. The generated YAML contains the packaged defaults; partial overrides are also supported. See configuration for schema 4 and all settings.

Add entries with the CLI, or edit entries.yaml (schema 2):

"$DNSLEAF" entry add lxc --workspace /etc/dnsleaf/example-zone \
  --id 101 --fqdn web.example.com --name web --family both
"$DNSLEAF" entry add vm --workspace /etc/dnsleaf/example-zone \
  --id 201 --fqdn vm.example.com --name vm --family ipv6
"$DNSLEAF" entry add local --workspace /etc/dnsleaf/example-zone \
  --fqdn host.example.com --name host --family both
"$DNSLEAF" entry add static --workspace /etc/dnsleaf/example-zone \
  --fqdn edge.example.com --name edge --family both \
  --ipv4 192.0.2.10 --ipv6 2001:db8::10

These names, guest IDs, and static documentation addresses are placeholders: use your own values. LXC discovery uses pct exec; VM discovery needs a working QEMU guest agent; local discovery uses ip. See discovery and entry management.

Validate, plan, and synchronize

"$DNSLEAF" validate --workspace /etc/dnsleaf/example-zone
"$DNSLEAF" plan --workspace /etc/dnsleaf/example-zone
"$DNSLEAF" sync-once --workspace /etc/dnsleaf/example-zone --apply

validate checks local configuration and token readability without API calls. plan and sync-once without --apply read Cloudflare state and discover addresses, but never change DNS. sync-once --apply performs one immediate sync. These commands may write workspace logs.

IPv4 and IPv6 are handled independently. Missing or ambiguous addresses are skipped without publishing guesses or deleting existing records. default_ttl: auto uses Cloudflare automatic TTL; default_proxied: null preserves existing proxy settings. Entry overrides may set true or false. Prune is off by default; explicit --prune-managed only removes stale records tracked by this workspace. Unmanaged zone records are preserved. See DNS sync.

Install the timer

"$DNSLEAF" apply --workspace /etc/dnsleaf/example-zone --no-run-sync
"$DNSLEAF" status --workspace /etc/dnsleaf/example-zone
systemctl status dnsleaf-example-zone.timer
journalctl -u dnsleaf-example-zone.service

apply validates and renders the workspace, installs system units, then enables and restarts the timer. --no-run-sync skips the command's immediate sync; the enabled timer will still run on its schedule. render only writes local generated artifacts. The service uses the absolute Python from the environment that ran apply, followed by -m dnsleaf, so its entry does not depend on an interactive shell's PATH or a development checkout. See systemd.

Workspace files are separated by purpose:

Location Purpose
workspace.yaml, entries.yaml User configuration
secrets/ Local token file
rendered/ Effective JSON and generated unit files
runtime/logs/dnsleaf.log Symlink to the current daily log
state/ Last installation and explicitly managed DNS records

Upgrade and uninstall

Upgrade the persistent tool, then refresh units using the updated entry:

uv tool upgrade dnsleaf
DNSLEAF="$(uv tool dir --bin)/dnsleaf"
"$DNSLEAF" apply --workspace /etc/dnsleaf/example-zone --no-run-sync

Remove the local service installation before uninstalling the Python tool:

"$DNSLEAF" uninstall --workspace /etc/dnsleaf/example-zone
uv tool uninstall dnsleaf

Repeat local service removal for every installed workspace before removing the tool environment. Normal uninstall retains configuration, credentials, and state. To explicitly delete a workspace, use uninstall --purge while the tool is still installed. Neither form deletes remote DNS records. A stop/disable failure aborts cleanup and returns failure. Earlier private deployments must be uninstalled separately and configured afresh; no in-place compatibility migration is provided.

Development and release

make sync
make check
make build

See development, architecture, release preparation, 1.1.0 notes, and CHANGELOG. Author: eserie-fox. License: MIT.

Metadata

Release files for dnsleaf 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dnsleaf 1.1.0
File Size Uploaded Provenance
dnsleaf-1.1.0.tar.gz 101.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for dnsleaf 1.1.0
File Interpreter ABI Platform
dnsleaf-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 171.5 kB

Release files / dnsleaf-1.1.0.tar.gz

Download URL dnsleaf-1.1.0.tar.gz
Size 101.2 kB
Tags Source
SHA-256 checksum
How to use checksums
24bb09c99cae0dceee74e7b47f6feee53b1089e4219e68a273efb131cf8da388
BLAKE2b-256 checksum
How to use checksums
d078499d8668a67a78b43bc0c1b86a9dc78cc0f800a9747787ec58a228cc57fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

Release files / dnsleaf-1.1.0-py3-none-any.whl

Download URL dnsleaf-1.1.0-py3-none-any.whl
Size 70.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a9d9766fd4471989c9d96d58741fd20cf13fea2c97d0437d386b1a83c6492a45
BLAKE2b-256 checksum
How to use checksums
f448cafb846e728d24df6c6e29c04a7ff0e0f07bf42d38948300065802e9b33d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

Security for dnsleaf 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dnsleaf-1.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page