xref: /netbsd-src/external/mpl/bind/dist/bin/tests/system/autosign/ns2/keygen.sh (revision 2718af68c3efc72c9769069b5c7f9ed36f6b9def)
1#!/bin/sh -e
2#
3# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
4#
5# This Source Code Form is subject to the terms of the Mozilla Public
6# License, v. 2.0. If a copy of the MPL was not distributed with this
7# file, you can obtain one at https://mozilla.org/MPL/2.0/.
8#
9# See the COPYRIGHT file distributed with this work for additional
10# information regarding copyright ownership.
11
12SYSTEMTESTTOP=../..
13. $SYSTEMTESTTOP/conf.sh
14
15# Have the child generate subdomain keys and pass DS sets to us.
16( cd ../ns3 && $SHELL keygen.sh )
17
18for subdomain in secure nsec3 autonsec3 optout rsasha256 rsasha512 nsec3-to-nsec oldsigs sync \
19    dname-at-apex-nsec3
20do
21	cp ../ns3/dsset-$subdomain.example$TP .
22done
23
24# Create keys and pass the DS to the parent.
25zone=example
26zonefile="${zone}.db"
27infile="${zonefile}.in"
28cat $infile dsset-*.example$TP > $zonefile
29
30kskname=`$KEYGEN -a RSASHA1 -3 -q -fk $zone`
31$KEYGEN -a RSASHA1 -3 -q $zone > /dev/null
32$DSFROMKEY $kskname.key > dsset-${zone}$TP
33
34# Create keys for a private secure zone.
35zone=private.secure.example
36zonefile="${zone}.db"
37infile="${zonefile}.in"
38ksk=`$KEYGEN -a RSASHA1 -3 -q -fk $zone`
39$KEYGEN -a RSASHA1 -3 -q $zone > /dev/null
40keyfile_to_static_ds $ksk > private.conf
41cp private.conf ../ns4/private.conf
42$SIGNER -S -3 beef -A -o $zone -f $zonefile $infile > /dev/null
43
44# Extract saved keys for the revoke-to-duplicate-key test
45zone=bar
46zonefile="${zone}.db"
47infile="${zonefile}.in"
48cat $infile > $zonefile
49for i in Xbar.+005+30676.key Xbar.+005+30804.key Xbar.+005+30676.private \
50	 Xbar.+005+30804.private
51do
52	cp $i `echo $i | sed s/X/K/`
53done
54$KEYGEN -a RSASHA1 -q $zone > /dev/null
55$DSFROMKEY Kbar.+005+30804.key > dsset-bar$TP
56