xref: /netbsd-src/external/mpl/bind/dist/bin/tests/system/dnssec/ns1/sign.sh (revision 7bdf38e5b7a28439665f2fdeff81e36913eef7dd)
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# shellcheck source=conf.sh
15. ../../conf.sh
16
17set -e
18
19zone=.
20infile=root.db.in
21zonefile=root.db
22
23(cd ../ns2 && $SHELL sign.sh)
24(cd ../ns6 && $SHELL sign.sh)
25(cd ../ns7 && $SHELL sign.sh)
26
27echo_i "ns1/sign.sh"
28
29cp "../ns2/dsset-example." .
30cp "../ns2/dsset-in-addr.arpa." .
31cp "../ns2/dsset-too-many-iterations." .
32cp "../ns2/dsset-lazy-ksk." .
33
34grep "$DEFAULT_ALGORITHM_NUMBER [12] " "../ns2/dsset-algroll." >"dsset-algroll."
35cp "../ns6/dsset-optout-tld." .
36
37ksk=$("$KEYGEN" -q -fk -a "$DEFAULT_ALGORITHM" -b "$DEFAULT_BITS" -n zone "$zone")
38zsk=$("$KEYGEN" -q -a "$DEFAULT_ALGORITHM" -b "$DEFAULT_BITS" -n zone "$zone")
39
40cat "$infile" "$ksk.key" "$zsk.key" >"$zonefile"
41
42"$SIGNER" -g -o "$zone" "$zonefile" >/dev/null 2>&1
43
44# Configure the resolving server with a staitc key.
45keyfile_to_static_ds "$ksk" >trusted.conf
46cp trusted.conf ../ns2/trusted.conf
47cp trusted.conf ../ns3/trusted.conf
48cp trusted.conf ../ns4/trusted.conf
49cp trusted.conf ../ns6/trusted.conf
50cp trusted.conf ../ns7/trusted.conf
51cp trusted.conf ../ns9/trusted.conf
52
53keyfile_to_trusted_keys "$ksk" >trusted.keys
54
55# ...or with an initializing key.
56keyfile_to_initial_ds "$ksk" >managed.conf
57cp managed.conf ../ns4/managed.conf
58
59#
60#  Save keyid for managed key id test.
61#
62
63keyfile_to_key_id "$ksk" >managed.key.id
64