Backup tool for PowerDNS database
Project description
What is this?
Backup tool for PowerDNS database (MySQL) to local or S3 storage in bind format. Open metrics are also computed on your feched zones.
PyPI
Deploy the pdnsbackup tool in your server with the pip command.
pip install pdnsbackup
Usage
After installation, you can execute the pdnsbackup to start-it.
$ pdnsbackup -h
usage: -c [-h] [-c C] [-e E] [-v]
options:
-h, --help show this help message and exit
-c C external config file
-e E env config file
-v debug mode
Configuration
This tool can be configurated with severals ways. See the default config file:
-
from external configuration file (
-c configargument) -
from environment variables (
-e env fileargument)
| Variables | Description |
|---|---|
| PDNSBACKUP_DEBUG | debug mode 1 or 0 |
| PDNSBACKUP_GMYSQL_ENABLED | set to 1 to enable gmysql backend, enabled by default |
| PDNSBACKUP_GMYSQL_HOST | mysql port, default is 127.0.0.1 |
| PDNSBACKUP_GMYSQL_PORT | mysql port, default is 3306 |
| PDNSBACKUP_GMYSQL_SSL | enable ssl, default is 0 |
| PDNSBACKUP_GMYSQL_DBNAME | mysql database name |
| PDNSBACKUP_GMYSQL_USER | mysql user |
| PDNSBACKUP_GMYSQL_PASSWORD | mysql password |
| PDNSBACKUP_FILE_ENABLED | set to 1 enable backup to file, enabled by default |
| PDNSBACKUP_FILE_PATH_BIND | zone bind path in named.conf |
| PDNSBACKUP_FILE_PATH_OUTPUT | output folder of the export |
| PDNSBACKUP_S3_ENABLED | set to 1 enable backup to S3 storage, disabled by default |
| PDNSBACKUP_S3_ENDPOINT_URL | your s3 url |
| PDNSBACKUP_S3_SSL_VERIFY | disable ssl verify |
| PDNSBACKUP_S3_ACCESS_KEY_ID | your access key |
| PDNSBACKUP_S3_SECRET_ACCESS_KEY | your secret access key |
| PDNSBACKUP_S3_BUCKET_NAME | bucket name |
| PDNSBACKUP_S3_BACKUP_FILE | backup file name |
| PDNSBACKUP_S3_BACKUP_DELETE_OLDER | delete backups older than xx days |
| PDNSBACKUP_METRICS_ENABLED | export open metrics |
| PDNSBACKUP_METRICS_PROM_FILE | write metrics to file path |
Metrics
This tool can be used to compute statistics on your DNS records.
| Variables | Description |
|---|---|
| pdnsbackup_status | Status of the backup process |
| pdnsbackup_zones_total | Total number of zones |
| pdnsbackup_zones_empty_total | Total number of empty zones |
| pdnsbackup_records_total | Total number of records per DNS zones |
| pdnsbackup_wildcards_total | Total number of DNS wilcards |
| pdnsbackup_delegations_total | Total number of DNS delegations |
| pdnsbackup_rrtypes_total | Total number of records per type (A, AAAA, CNAME, ...) |
Docker run
sudo docker run --rm --env-file ./.env --name=pdnsbackup dmachard/pdnsbackup:latest
Run from source
Create a .env file to populate your variable
Create a virtualenv
python -m venv venv
source venv/bin/activate
Install requirements and run-it
python3 -m pip install -r requirements.txt
python3 -c "import pdnsbackup; pdnsbackup.run();"
python3 -c "import pdnsbackup; pdnsbackup.run();" -c tests/config.yml
python3 -c "import pdnsbackup; pdnsbackup.run();" -e tests/.env
Build and run from docker image
sudo docker build . --file Dockerfile -t pdnsbackup
Run tests
Run all tests
python -m unittest discover -v tests/
Run one by one
python -m unittest -v tests.test_config
python -m unittest -v tests.test_parser
python -m unittest -v tests.test_import
python -m unittest -v tests.test_export_file
python -m unittest -v tests.test_export_metrics
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 pdnsbackup-1.0.6.tar.gz.
File metadata
- Download URL: pdnsbackup-1.0.6.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
792b23ffb1bb164569b5ae8c41cf4c2ad3d9ac45166ef6fd2f3ece0568ed8bd5
|
|
| MD5 |
caffbaf535c943968c217371ecac01da
|
|
| BLAKE2b-256 |
b06dec228cc5c77ff965b839b58c815d3201e116818a2151e8f898fda8e70e61
|
Provenance
The following attestation bundles were made for pdnsbackup-1.0.6.tar.gz:
Publisher:
publish.yml on dmachard/pdns-backup
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pdnsbackup-1.0.6.tar.gz -
Subject digest:
792b23ffb1bb164569b5ae8c41cf4c2ad3d9ac45166ef6fd2f3ece0568ed8bd5 - Sigstore transparency entry: 891941240
- Sigstore integration time:
-
Permalink:
dmachard/pdns-backup@a94b50f0f91c4220f4dc79109d104409add5be6a -
Branch / Tag:
refs/tags/v1.0.6 - Owner: https://github.com/dmachard
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a94b50f0f91c4220f4dc79109d104409add5be6a -
Trigger Event:
release
-
Statement type:
File details
Details for the file pdnsbackup-1.0.6-py3-none-any.whl.
File metadata
- Download URL: pdnsbackup-1.0.6-py3-none-any.whl
- Upload date:
- Size: 10.5 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 |
cf5c862ed5df7eb89256306553f9a4bc5e1e6898248277bf30bae8447bec4e84
|
|
| MD5 |
ae41ce127fa86e2a0f93b73e5b0881ce
|
|
| BLAKE2b-256 |
e8182a81719c2072d8844717633ee76e47fe79df708b4a9bbfbc35f8a8da99ed
|
Provenance
The following attestation bundles were made for pdnsbackup-1.0.6-py3-none-any.whl:
Publisher:
publish.yml on dmachard/pdns-backup
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pdnsbackup-1.0.6-py3-none-any.whl -
Subject digest:
cf5c862ed5df7eb89256306553f9a4bc5e1e6898248277bf30bae8447bec4e84 - Sigstore transparency entry: 891941345
- Sigstore integration time:
-
Permalink:
dmachard/pdns-backup@a94b50f0f91c4220f4dc79109d104409add5be6a -
Branch / Tag:
refs/tags/v1.0.6 - Owner: https://github.com/dmachard
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a94b50f0f91c4220f4dc79109d104409add5be6a -
Trigger Event:
release
-
Statement type: