blob: bb602fd7e13c6d2659e5af95c2229ad44419c132 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#!/bin/sh -e
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
SYSTEMTESTTOP=../..
. $SYSTEMTESTTOP/conf.sh
keys_to_trust=""
for zonename in sub.example example initially-unavailable; do
zone=$zonename
infile=$zonename.db.in
zonefile=$zonename.db
keyname1=$($KEYGEN -a ${DEFAULT_ALGORITHM} -f KSK $zone 2>/dev/null)
keyname2=$($KEYGEN -a ${DEFAULT_ALGORITHM} $zone 2>/dev/null)
cat $infile $keyname1.key $keyname2.key >$zonefile
$SIGNER -P -g -o $zone $zonefile >/dev/null
done
# Only add the key for "initially-unavailable" to the list of keys trusted by
# ns3. "example" is expected to be validated using a chain of trust starting in
# the "root" zone on ns1.
keys_to_trust="$keys_to_trust $keyname1"
# Prepare a zone signed using a Combined Signing Key (CSK) without the SEP bit
# set and add that key to the list of keys to trust.
zone=verify-csk
infile=verify.db.in
zonefile=verify-csk.db
keyname=$($KEYGEN -a ${DEFAULT_ALGORITHM} $zone 2>/dev/null)
cat $infile $keyname.key >$zonefile
$SIGNER -P -o $zone $zonefile >/dev/null
keys_to_trust="$keys_to_trust $keyname"
# Prepare remaining zones used in the test.
ORIGINAL_SERIAL=$(awk '$2 == "SOA" {print $5}' verify.db.in)
UPDATED_SERIAL_BAD=$((ORIGINAL_SERIAL + 1))
UPDATED_SERIAL_GOOD=$((ORIGINAL_SERIAL + 2))
for variant in addzone axfr ixfr load reconfig untrusted; do
zone=verify-$variant
infile=verify.db.in
zonefile=verify-$variant.db
keyname1=$($KEYGEN -a ${DEFAULT_ALGORITHM} -f KSK $zone 2>/dev/null)
keyname2=$($KEYGEN -a ${DEFAULT_ALGORITHM} $zone 2>/dev/null)
cat $infile $keyname1.key $keyname2.key >$zonefile
# Prepare a properly signed version of the zone ("*.original.signed").
$SIGNER -P -o $zone $zonefile >/dev/null
cp $zonefile.signed $zonefile.original.signed
# Prepare a version of the zone with a bogus SOA RRSIG ("*.bad.signed").
sed "s/${ORIGINAL_SERIAL}/${UPDATED_SERIAL_BAD}/;" $zonefile.signed >$zonefile.bad.signed
# Prepare another properly signed version of the zone ("*.good.signed").
sed "s/${ORIGINAL_SERIAL}/${UPDATED_SERIAL_GOOD}/;" $zonefile >$zonefile.good
$SIGNER -P -o $zone $zonefile.good >/dev/null
rm -f $zonefile.good
# Except for the "verify-untrusted" zone, declare the KSK used for
# signing the zone to be a trust anchor for ns3.
if [ "$variant" != "untrusted" ]; then
keys_to_trust="$keys_to_trust $keyname1"
fi
done
keyfile_to_static_ds $keys_to_trust >trusted-mirror.conf
|