52 lines
1.1 KiB
Markdown
52 lines
1.1 KiB
Markdown
# Dockerized PowerDNS
|
|
|
|
## Usage with docker compose
|
|
|
|
```yaml
|
|
services:
|
|
dns:
|
|
image: docker.asperti.com/paspo/powerdns:latest
|
|
container_name: dns
|
|
ports:
|
|
- 127.0.0.1:1053:53
|
|
- 127.0.0.1:1053:53/udp
|
|
- 127.0.0.1:8081:8081 # api endpoint
|
|
environment:
|
|
API_KEY=ciaociao # please use a serious key
|
|
DB_PATH=/db/pdns.sqlite
|
|
volumes:
|
|
- ./db:/db
|
|
```
|
|
|
|
## list zones
|
|
|
|
```sh
|
|
curl -H "X-API-Key: ciaociao" http://127.0.0.1:8081/api/v1/servers/localhost/zones | jq
|
|
```
|
|
|
|
## add a zone
|
|
|
|
```sh
|
|
curl -H "X-API-Key: ciaociao" -X POST -d \
|
|
'{"name":"ciao.com.", "kind":"native", "masters": [], "nameservers":[] }' \
|
|
http://127.0.0.1:8081/api/v1/servers/localhost/zones | jq
|
|
```
|
|
|
|
## list zone content
|
|
|
|
```sh
|
|
curl -H "X-API-Key: ciaociao" http://127.0.0.1:8081/api/v1/servers/localhost/zones/ciao.com | jq
|
|
```
|
|
|
|
## add a record
|
|
|
|
```sh
|
|
curl -H "X-API-Key: ciaociao" -X PATCH -d \
|
|
'{"rrsets": [{"name": "test.ciao.com.", "type": "A", "ttl": 3600, "changetype": "REPLACE", "records": [{"content": "192.168.254.5", "disabled": false}]}]}' \
|
|
http://127.0.0.1:8081/api/v1/servers/localhost/zones/ciao.com
|
|
```
|
|
|
|
## RFC2136 dns updates
|
|
|
|
TODO
|