aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorLexi Winter <lexi@le-fay.org>2025-06-07 11:19:02 +0100
committerLexi Winter <lexi@le-fay.org>2025-06-07 11:19:02 +0100
commit252adda53c507abbbe5d8e9f125fc174e84a2c02 (patch)
tree4ce803266a34239c4fc48d3e0101eae6c4f1dbb3 /Makefile
parent199c42f56eda6416d7094ce987124049ae3d8fde (diff)
downloaddns-252adda53c507abbbe5d8e9f125fc174e84a2c02.tar.gz
dns-252adda53c507abbbe5d8e9f125fc174e84a2c02.tar.bz2
support generating the Unbound config
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile84
1 files changed, 80 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 3cd43c7..3b77e2d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,15 @@
+# Our local master server.
+MASTER= hemlock.eden.le-fay.org
+MASTER_ADDR!= getaddrinfo -f inet6 -p tcp -t stream hemlock.eden.le-fay.org|awk '{ print $$4 }'
+
+# The DN42 master server.
+DN42_MASTER= fd42:4242:2601:ac53::1
+
NSDIFF= nsdiff
-NSDIFFFLAGS= -Sserial -s hemlock.eden.le-fay.org
+NSDIFFFLAGS= -Sserial -s ${MASTER}
DIFF?=
+# The zones we serve.
ZONES= le-fay.org \
le-fay.org.uk \
le-fay.dn42 \
@@ -18,13 +26,64 @@ ZONES= le-fay.org \
0/26.76.23.172.in-addr.arpa \
18.198.in-addr.arpa
+# These zones are used for DN42.
+DN42_ZONES= \
+ dn42 \
+ d.f.ip6.arpa \
+ 20.172.in-addr.arpa \
+ 21.172.in-addr.arpa \
+ 22.172.in-addr.arpa \
+ 23.172.in-addr.arpa \
+ 24.172.in-addr.arpa \
+ 25.172.in-addr.arpa \
+ 26.172.in-addr.arpa \
+ 27.172.in-addr.arpa \
+ 28.172.in-addr.arpa \
+ 29.172.in-addr.arpa \
+ 30.172.in-addr.arpa \
+ 31.172.in-addr.arpa
+
+# Our local networks.
+# TODO: Generate these from LDAP.
+LFNETWORKS= \
+ 2001:8b0:aab5::/48 \
+ 81.187.47.192/28 \
+ 81.2.96.160/28 \
+ 81.187.73.117/32 \
+ 2a00:1098:6b::/48 \
+ 2001:ba8:4015::/48 \
+ 2001:ba8:404a::/48 \
+ fd5b:a83:b06b::/48 \
+ 172.16.0.0/12 \
+ 10.0.0.0/8 \
+ 198.18.0.0/15
+
+UNBOUND_SERVERS= \
+ witch.le-fay.org \
+ turnera.le-fay.org
+
+UNBOUND_PROCESS_FLAGS= \
+ -Dconfdir=/usr/local/etc/unbound \
+ -Dmaster="${MASTER}" \
+ -Dmaster_addr="${MASTER_ADDR}" \
+ -Dlfnetworks="${LFNETWORKS}" \
+ -Dlocal_zones="${ZONES}" \
+ -Ddn42_zones="${DN42_ZONES}" \
+ -Ddn42_master="${DN42_MASTER}"
+UNBOUND_PROCESS_FLAGS.witch.le-fay.org= -Dtls=yes
+UNBOUND_PROCESS_FLAGS.turnera.le-fay.org= -Dtls=yes
+
all:
@echo "Please specify a target:"
@echo " make diff show diff between zone files and online zone"
@echo " make update-zones update online zones"
+ @echo " make unbound-update build and install Unbound configs"
+
+clean:
-.PATH: zones
-.PHONY: all update-zones
+.PATH: ${.CURDIR}/zones
+.OBJDIR: ${.CURDIR}/build
+.PHONY: all update-zones clean
.for zone in ${ZONES}
update-zones: ${zone}
@@ -46,4 +105,21 @@ ${zone}: ${zone:S,/,_,g}.zone
.PHONY: diff
diff:
- @${MAKE} update-zones DIFF=yes
+ @${MAKE} -C ${.CURDIR} update-zones DIFF=yes
+
+unbound-update:
+
+.for server in ${UNBOUND_SERVERS}
+update-unbound: update-unbound-${server}
+update-unbound-${server}: unbound.conf.${server}
+ @echo "updating ${server}"
+unbound.conf.${server}: unbound.conf.erb
+ ${.CURDIR}/bin/process \
+ -Dservername=${server} \
+ ${UNBOUND_PROCESS_FLAGS} \
+ ${UNBOUND_PROCESS_FLAGS.${server}} \
+ $> $@
+clean: clean-unbound-${server}
+clean-unbound-${server}:
+ rm -f ${.OBJDIR}/unbound.conf.${server}
+.endfor