1
0

Compare commits

...

9 Commits

Author SHA1 Message Date
d2ad01fd37 feat: drop Debian 11 support
All checks were successful
continuous-integration/drone/push Build is passing
2024-02-04 19:10:33 +01:00
3a364b462d feat(readme): add section about SOA-EDIT = INCEPTION-INCREMENT
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-29 13:58:32 +01:00
49e6e9ce56 fix: merge inotifywait --exclude args
All checks were successful
continuous-integration/drone/push Build is passing
inotifywait only takes the last --exclude argument
2022-12-24 19:54:23 +01:00
f27537448c fix(rebuild): the input device is not a TTY
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-11-19 17:16:31 +01:00
197a87f268 fix: configure MTU for docker:dind service to 1492
All checks were successful
continuous-integration/drone/push Build is passing
https://blog.zespre.com/dind-mtu-size-matters.html
2022-09-18 15:54:43 +02:00
15e959391d fix(Dockerfile): fail build when apt-get fails
Some checks failed
continuous-integration/drone/push Build is failing
2022-09-17 15:24:14 +02:00
288045eb53 add drone-ci
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-09 20:06:22 +02:00
67a4f2b02e exclude .swp files in inotifywait 2022-07-22 19:33:40 +02:00
7d6169a8a0 build/rebuild.sh: rebuild when current image has pending updates 2022-07-22 19:33:40 +02:00
8 changed files with 136 additions and 57 deletions

90
.drone.yml Normal file
View File

@ -0,0 +1,90 @@
kind: pipeline
type: docker
name: build
steps:
- name: build
image: docker:dind
volumes:
- name: dockersock
path: /var/run
environment:
DOCKER_USERNAME:
from_secret: docker_username
DOCKER_PASSWORD:
from_secret: docker_password
commands:
- sleep 5 # give docker enough time to start
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- ./debian/12/build.sh
when:
branch:
- master
event:
- push
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
command:
- dockerd-entrypoint.sh
- dockerd
- --host=unix:///var/run/docker.sock
- --mtu=1492
volumes:
- name: dockersock
temp: {}
trigger:
branch:
- master
event:
- push
---
kind: pipeline
type: docker
name: rebuild
steps:
- name: rebuild
image: docker:dind
volumes:
- name: dockersock
path: /var/run
environment:
DOCKER_USERNAME:
from_secret: docker_username
DOCKER_PASSWORD:
from_secret: docker_password
commands:
- sleep 5 # give docker enough time to start
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- ./build/rebuild.sh
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
command:
- dockerd-entrypoint.sh
- dockerd
- --host=unix:///var/run/docker.sock
- --mtu=1492
volumes:
- name: dockersock
temp: {}
trigger:
event:
- cron
cron:
- rebuild

View File

@ -8,7 +8,6 @@
# Supported tags and respective `Dockerfile` links # Supported tags and respective `Dockerfile` links
- [`4.6-bookworm`, `latest`](https://github.com/pommi/docker-powerdns/blob/master/debian/12/Dockerfile) - [`4.6-bookworm`, `latest`](https://github.com/pommi/docker-powerdns/blob/master/debian/12/Dockerfile)
- [`4.4-bullseye`](https://github.com/pommi/docker-powerdns/blob/master/debian/11/Dockerfile)
# Usage # Usage
@ -87,3 +86,15 @@ DS = example.tld. IN DS 280 13 1 0dead339b7dacebb6750c7d4e5c9c0f4c19843a9 ; ( SH
DS = example.tld. IN DS 280 13 2 f340e93c42b3c2c6fa8ef76e044ad2f064c1cd7484e785bdfca0f51cd548c88d ; ( SHA256 digest ) DS = example.tld. IN DS 280 13 2 f340e93c42b3c2c6fa8ef76e044ad2f064c1cd7484e785bdfca0f51cd548c88d ; ( SHA256 digest )
DS = example.tld. IN DS 280 13 4 a793c7e590a7701c7b39365f99655b865d11961c355a5eb59302282cf653aec8b051ddc9e36a9df0843cad29ca50149a ; ( SHA-384 digest ) DS = example.tld. IN DS 280 13 4 a793c7e590a7701c7b39365f99655b865d11961c355a5eb59302282cf653aec8b051ddc9e36a9df0843cad29ca50149a ; ( SHA-384 digest )
``` ```
Set `SOA-EDIT` to `INCEPTION-INCREMENT` so that slaves get notified when a rollover has taken place:
```
$ docker exec -it powerdns pdnsutil set-meta example.tld SOA-EDIT INCEPTION-INCREMENT
[bindbackend] Done parsing domains, 0 rejected, 1 new, 0 removed
Set 'example.tld' meta SOA-EDIT = INCEPTION-INCREMENT
$ docker exec -it powerdns pdnsutil get-meta example.tld
[bindbackend] Done parsing domains, 0 rejected, 1 new, 0 removed
Metadata for 'example.tld'
SOA-EDIT = INCEPTION-INCREMENT
```

16
build/rebuild.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
set -x
updates_available () {
docker pull $1
if test "$(docker run --rm $1 /bin/sh -c 'apt -qqq update && apt -qq list --upgradable')" != ""; then
return 0
else
return 1
fi
}
if updates_available pommib/powerdns:4.6-bookworm; then
./debian/12/build.sh
fi

21
debian/11/Dockerfile vendored
View File

@ -1,21 +0,0 @@
FROM debian:bullseye-slim
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
pdns-server \
pdns-backend-bind \
sqlite3 \
bind9-dnsutils \
inotify-tools \
; \
rm -rf /var/lib/apt/lists/*
ADD start.sh /
EXPOSE 53/tcp 53/udp
VOLUME ["/var/lib/powerdns"]
CMD /start.sh
HEALTHCHECK CMD dig +timeout=1 @127.0.0.1 || exit 1

30
debian/11/start.sh vendored
View File

@ -1,30 +0,0 @@
#!/bin/bash
# create sqlite database for DNSSEC
if test ! -e /var/lib/powerdns/bind-dnssec-db.sqlite3; then
echo [$0] Initializing /var/lib/powerdns/bind-dnssec-db.sqlite3
/usr/bin/pdnsutil create-bind-db /var/lib/powerdns/bind-dnssec-db.sqlite3
fi
sed -i 's/^# bind-dnssec-db=/bind-dnssec-db=\/var\/lib\/powerdns\/bind-dnssec-db.sqlite3/' /etc/powerdns/pdns.d/bind.conf
# start powerdns server
/usr/sbin/pdns_server --guardian=no --daemon=no --disable-syslog --log-timestamp=no --write-pid=no &
# watch for zone changes
inotifywait -mqre modify --exclude '\.git' --format '%w%f' "/var/lib/powerdns/zones/" |
while read -r path; do
zone=$(basename $path)
echo [$0] A modification was detected in $path
echo [$0] Executing \`/usr/bin/pdns_control bind-reload-now $zone\`
/usr/bin/pdns_control bind-reload-now $zone
if pdnsutil show-zone $zone 2>/dev/null | grep -q "Zone is not actively secured"; then
echo [$0] Zone is not actively secured, skipping \`pdnsutil rectify-zone $zone\`
else
echo [$0] DNSSEC secured zone. Executing \`pdnsutil rectify-zone $zone\`
/usr/bin/pdnsutil rectify-zone $zone
fi
done &
wait -n
exit $?

View File

@ -1,14 +1,15 @@
FROM debian:bookworm-slim FROM debian:bookworm-slim
RUN set -eux; \ RUN set -eux && \
apt-get update; \ apt-get update && \
apt-get install -y --no-install-recommends \ DEBIAN_FRONTEND=noninteractive apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
pdns-server \ pdns-server \
pdns-backend-bind \ pdns-backend-bind \
sqlite3 \ sqlite3 \
bind9-dnsutils \ bind9-dnsutils \
inotify-tools \ inotify-tools \
; \ && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
ADD start.sh / ADD start.sh /

12
debian/12/build.sh vendored Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
set -ex
IMAGE=pommib/powerdns:4.6-bookworm
docker pull $IMAGE
docker pull debian:bookworm-slim
docker build --no-cache -t $IMAGE ./debian/12/
docker push $IMAGE
docker tag $IMAGE pommib/powerdns:latest
docker push pommib/powerdns:latest

2
debian/12/start.sh vendored
View File

@ -11,7 +11,7 @@ sed -i 's/^# bind-dnssec-db=/bind-dnssec-db=\/var\/lib\/powerdns\/bind-dnssec-db
/usr/sbin/pdns_server --guardian=no --daemon=no --disable-syslog --log-timestamp=no --write-pid=no & /usr/sbin/pdns_server --guardian=no --daemon=no --disable-syslog --log-timestamp=no --write-pid=no &
# watch for zone changes # watch for zone changes
inotifywait -mqre modify --exclude '\.git' --format '%w%f' "/var/lib/powerdns/zones/" | inotifywait -mqre modify --exclude '.*(\.git|.*\.swp)' --format '%w%f' "/var/lib/powerdns/zones/" |
while read -r path; do while read -r path; do
zone=$(basename $path) zone=$(basename $path)
echo [$0] A modification was detected in $path echo [$0] A modification was detected in $path