How do I get from IANA's root-anchors.xml to managed-keys{}?

Stephane Bortzmeyer bortzmeyer at nic.fr
Fri Jul 16 10:26:51 UTC 2010


On Fri, Jul 16, 2010 at 06:16:13PM +0900,
 Kazunori Fujiwara <fujiwara at wide.ad.jp> wrote 
 a message of 25 lines which said:

> You can check root DNSKEY RR and root-anchors.xml
> using dig and dnssec-dsfromkey.

Good idea and here is a Makefile and a XSLT script which automates the
whole thing. Bug reports welcome.

-------------- next part --------------
KEYFLAGS=257
HASHALG=2 # For dnssec-dsfromkey

all: root-anchors.txt root-anchors.dnskey

root-anchors.txt: root-anchors.xml
	xsltproc -o root-anchors.txt anchors2ds.xsl root-anchors.xml

root-anchors.xml:
	wget -nc https://data.iana.org/root-anchors/root-anchors.xml
	wget -nc https://data.iana.org/root-anchors/root-anchors.asc
	gpg --verify root-anchors.asc root-anchors.xml || \
		rm -f root-anchors.asc root-anchors.xml

root-anchors.dnskey: root-anchors.txt
	dig DNSKEY . | grep -w ${KEYFLAGS} > untrusted.key
	# Verify the key
	# Thanks to Kazunori Fujiwara for the idea
	dnssec-dsfromkey -${HASHALG} untrusted.key > untrusted.ds
	cut -d' ' -f1-6 untrusted.ds | tr '\n' ' ' > root-anchors.tmp
	cut -d' ' -f7- untrusted.ds | sed 's/ //g' | tr '\n' ' ' >> root-anchors.tmp
	echo >> root-anchors.tmp
	@diff root-anchors.txt root-anchors.tmp || \
		sh -c 'echo "Invalid DNSKEY, deleting temporary files"; rm -f root-anchors.tmp untrusted.key untrusted.ds'
	awk  '{print  $$1 " " $$5 " " $$6 " " $$7 " " "\""; for (i = 8; i <= NF; i++) printf $$i " "; print  "\";"  }' untrusted.key > root-anchors.dnskey
	@echo "OK, root-anchors.dnskey is correct"

clean:
	rm -f root-anchors.txt untrusted.key untrusted.ds root-anchors.tmp

realclean: clean
	rm -f root-anchors.xml root-anchors.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: anchors2ds.xsl
Type: application/xml
Size: 855 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/bind-users/attachments/20100716/33e877d7/attachment.xsl>


More information about the bind-users mailing list