https://github.com/zerwes/powerdns-pipe-ptr
simple python script to be used via powerdns pipe backend in order to convert gmysql stored A records int PTR
https://github.com/zerwes/powerdns-pipe-ptr
dns mysql pdns powerdns python python3
Last synced: 7 months ago
JSON representation
simple python script to be used via powerdns pipe backend in order to convert gmysql stored A records int PTR
- Host: GitHub
- URL: https://github.com/zerwes/powerdns-pipe-ptr
- Owner: zerwes
- License: gpl-3.0
- Created: 2024-02-21T12:20:49.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-16T06:54:58.000Z (10 months ago)
- Last Synced: 2025-01-23T06:46:03.175Z (9 months ago)
- Topics: dns, mysql, pdns, powerdns, python, python3
- Language: Python
- Homepage:
- Size: 29.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/zerwes/powerdns-pipe-ptr/actions/workflows/pylint.yml)
# powerdns-pipe-ptr
a simple script to be used via [powerdns](https://github.com/PowerDNS/pdns) pipe backend
it is intended to resolve reverse lookups based on the existing `A` records via the gmysql backend,
as the `set-ptr` option has been removed (see https://github.com/PowerDNS/pdns/pull/7797)## requirements
### python3 pymysql
the script requires `python3-pymysql` aka. `PyMySQL`
### SOA
the reverse zones in question should be created in pdns
### gmysql
the script will just work for records registered in the `gmysql` backend and uses the database connection registered for `gmysql` in the `pdns.conf` file
### pdns.conf
add the following lines to your `pdns.conf` **after** the `launch+=gmysql` line and the other gmysql settings:
```
zone-cache-refresh-interval=0
launch+=pipe
pipe-regex=^.*\.in-addr\.arpa$
pipe-command=/etc/powerdns/ptr.py
```inserting the pipe settings **after** the gmysql settings ensures that real PTR records will be resolved via the gmysql (or other) backend,
and only if none is found, the pipe backend will be used.## ptr.py
copy the script to `/etc/powerdns/ptr.py`
and
```shell
chmod 750 /etc/powerdns/ptr.py
chown root:pdns /etc/powerdns/ptr.py
```in some cases you might need to add
```
unix_socket="/var/run/mysqld/mysqld.sock"
```
as arg to `pymysql.connect`## restart pdns service
```
systemctl reload-or-restart unbound
```the script will log to syslog