PowerDNS Authoritative API client
Project description
powerdns-cli
PowerDNS-CLI is your (scriptable) interface to interact with the
PowerDNS Authoritative Nameserver. PowerDNS itself does only offer an
API to interact with remotely, its pdns_util does only work on the PowerDNS-Host
itself, not remotely from another machine.
Other interaction methods are web interface designed, by hardly scriptable (to my knowledge).
This project is currently in alpha phase and will soon progress to a beta stage. Beta release will be done as soon as integration tests and python version tests are successful.
Installation
Installation is available through pypi.org:
pip install powerdns-cli
Or you use this repositories-main branch for the latest version:
git clone https://github.com/IamLunchbox/powerdns-cli
pip install .
Please be advised, that the main branch, especially in alpha phase, might be unstable. Once this project progresses to a beta or production- ready release you can expect the main branch to be stable enough, since changes will stay in different branches.
Usage
powerdns-cli is built with pythons click framework and uses keyword-based functions.
Therefore, shared flags, as the api key and api url, are positional and required before the
first arguments.
To get things going you may, for example, add a zone:
$ powerdns-cli -a MyApiKey -u http://localhost zone add example.com. 10.0.0.1 MASTER
The following example does not work and will create an error:
$ powerdns-cli zone add -a MyApiKey -u http://localhost example.com. 10.0.0.1 MASTER
You may provide all flags through your environment variables as well. Use the long
flag name in upper-case and prefix it with POWERDNS_CLI_. For example:
# This is effecively the same as above
export POWERDNS_CLI_APIKEY="MyApiKey"
export POWERDNS_CLI_URL="http://localhost"
powerdns-cli zone add example.com. 10.0.0.1 MASTER
If you want to use environment variables for subcommands you will have to add
the subcommand to the variable string as well:
POWERDNS_CLI_ADD_RECORD_TTL=86400.
powerdns-cli will almost always respond in json, even if the PowerDNS-api doesn't
(sometimes its plain/text, sometimes there is no output at all).
The only time you'll be provided with non-json output is, when you request a
BIND/AFXR-format export.
This script tries to stay idempotent as well and will not change anything if a corresponding configuration is already present upstream. This comes with a speed / traffic penalty, since sometimes several requests are necessary to get all upstream information.
Basic Examples
# Add a zone
$ powerdns-cli zone add example.com. 10.0.0.1 MASTER
{"message": "Zone example.com. created"}
If you are in need of all the possible cli options, you can take a look at the integration test. The workflow / integration test uses all common cli options to test for the api compatibility.
Constraints
- It is not possible to simply create a RRSet with several entries. Instead, you have to
use
powerdns-cli record extend. - There are no guardrails for removing records from a zone, only for removing a zone altogether.
- The default TTL is set to 86400. The ttl is set per RRSet (name:zone:record-type).
Version Support
All the PowerDNS authoritative nameserver versions, which receive patches / security updates, are covered by integration tests. You can check if your version gets updates here. And you can check here which versions are actually tested.
If the PowerDNS-Team does not apply releases and changes to their publicly released docker images (see here), they won't be covered by the integration tests.
Todos
The following features are on the roadmap:
- Format output to more concise json
- Docker container
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 powerdns_cli-0.0.20.tar.gz.
File metadata
- Download URL: powerdns_cli-0.0.20.tar.gz
- Upload date:
- Size: 51.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04f258126a379ed04d3a85b7d5c31af2f57dfb4d329836c65acf977d191cb090
|
|
| MD5 |
4c47bf236e35bb4df3d8e6bb458eeaa6
|
|
| BLAKE2b-256 |
a30ac740b864d6829211995eb05815907c1bf22be4f1df89c8d75f131c9ac0d8
|
Provenance
The following attestation bundles were made for powerdns_cli-0.0.20.tar.gz:
Publisher:
release.yml on IamLunchbox/powerdns-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
powerdns_cli-0.0.20.tar.gz -
Subject digest:
04f258126a379ed04d3a85b7d5c31af2f57dfb4d329836c65acf977d191cb090 - Sigstore transparency entry: 584450858
- Sigstore integration time:
-
Permalink:
IamLunchbox/powerdns-cli@1607a8818d022e7afbe2aa01cfb7d1910d3544f2 -
Branch / Tag:
refs/tags/0.0.20 - Owner: https://github.com/IamLunchbox
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1607a8818d022e7afbe2aa01cfb7d1910d3544f2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file powerdns_cli-0.0.20-py3-none-any.whl.
File metadata
- Download URL: powerdns_cli-0.0.20-py3-none-any.whl
- Upload date:
- Size: 35.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec376f03ad8a6e3dd6ed00699202fdb989924a071cb2344293a58377e16d47b0
|
|
| MD5 |
fb7d07d1d7b56167c25031c802fcfd74
|
|
| BLAKE2b-256 |
571063dfbf9b9379e39920ae56a5f3320e2556fadd1d8c7652cf817e3ba20c92
|
Provenance
The following attestation bundles were made for powerdns_cli-0.0.20-py3-none-any.whl:
Publisher:
release.yml on IamLunchbox/powerdns-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
powerdns_cli-0.0.20-py3-none-any.whl -
Subject digest:
ec376f03ad8a6e3dd6ed00699202fdb989924a071cb2344293a58377e16d47b0 - Sigstore transparency entry: 584450859
- Sigstore integration time:
-
Permalink:
IamLunchbox/powerdns-cli@1607a8818d022e7afbe2aa01cfb7d1910d3544f2 -
Branch / Tag:
refs/tags/0.0.20 - Owner: https://github.com/IamLunchbox
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1607a8818d022e7afbe2aa01cfb7d1910d3544f2 -
Trigger Event:
push
-
Statement type: