xref: /netbsd-src/external/mpl/bind/dist/bin/tests/system/checkds/ns9/setup.sh (revision b2c35e17b976cf7ccd7250c86c6f5e95090ed636)
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
17echo_i "ns9/setup.sh"
18
19setup() {
20  zone="$1"
21  echo_i "setting up zone: $zone"
22  zonefile="${zone}.db"
23  infile="${zone}.db.infile"
24  echo "$zone" >>zones
25}
26
27# Short environment variable names for key states and times.
28H="HIDDEN"
29R="RUMOURED"
30O="OMNIPRESENT"
31U="UNRETENTIVE"
32T="now-30d"
33Y="now-1y"
34
35# DS Publication.
36for zn in dspublished reference missing-dspublished bad-dspublished \
37  multiple-dspublished incomplete-dspublished bad2-dspublished resolver-dspublished; do
38  setup "${zn}.checkds"
39  cp template.db.in "$zonefile"
40  keytimes="-P $T -P sync $T -A $T"
41  CSK=$($KEYGEN -k default $keytimes $zone 2>keygen.out.$zone)
42  $SETTIME -s -g $O -k $O $T -r $O $T -z $O $T -d $R $T "$CSK" >settime.out.$zone 2>&1
43  cat template.db.in "${CSK}.key" >"$infile"
44  private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK" >>"$infile"
45  cp $infile $zonefile
46  $SIGNER -S -z -x -s now-1h -e now+30d -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
47done
48
49# DS Withdrawal.
50for zn in dswithdrawn missing-dswithdrawn bad-dswithdrawn multiple-dswithdrawn \
51  incomplete-dswithdrawn bad2-dswithdrawn resolver-dswithdrawn; do
52  setup "${zn}.checkds"
53  cp template.db.in "$zonefile"
54  keytimes="-P $Y -P sync $Y -A $Y"
55  CSK=$($KEYGEN -k default $keytimes $zone 2>keygen.out.$zone)
56  $SETTIME -s -g $H -k $O $T -r $O $T -z $O $T -d $U $T "$CSK" >settime.out.$zone 2>&1
57  cat template.db.in "${CSK}.key" >"$infile"
58  private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$CSK" >>"$infile"
59  cp $infile $zonefile
60  $SIGNER -S -z -x -s now-1h -e now+30d -o $zone -O raw -f "${zonefile}.signed" $infile >signer.out.$zone.1 2>&1
61done
62