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