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
14set -e
15
16. ../../conf.sh
17
18zone=.
19infile=root.db.in
20zonefile=root.db
21
22echo_i "ns1/sign.sh"
23
24cp $infile $zonefile
25
26if [ -f ../ecdsa256-supported.file ]; then
27  zsk256=$($KEYGEN -q -a ECDSA256 -n zone "$zone")
28  ksk256=$($KEYGEN -q -a ECDSA256 -n zone -f KSK "$zone")
29  cat "$ksk256.key" "$zsk256.key" >>"$zonefile"
30  $DSFROMKEY -a sha-256 "$ksk256.key" >>dsset-256
31fi
32
33if [ -f ../ecdsa384-supported.file ]; then
34  zsk384=$($KEYGEN -q -a ECDSA384 -n zone "$zone")
35  ksk384=$($KEYGEN -q -a ECDSA384 -n zone -f KSK "$zone")
36  cat "$ksk384.key" "$zsk384.key" >>"$zonefile"
37  $DSFROMKEY -a sha-256 "$ksk384.key" >>dsset-256
38fi
39
40# Configure the resolving server with a static key.
41if [ -f ../ecdsa256-supported.file ]; then
42  keyfile_to_static_ds $ksk256 >trusted.conf
43  cp trusted.conf ../ns2/trusted.conf
44else
45  keyfile_to_static_ds $ksk384 >trusted.conf
46  cp trusted.conf ../ns2/trusted.conf
47fi
48
49if [ -f ../ecdsa384-supported.file ]; then
50  keyfile_to_static_ds $ksk384 >trusted.conf
51  cp trusted.conf ../ns3/trusted.conf
52else
53  keyfile_to_static_ds $ksk256 >trusted.conf
54  cp trusted.conf ../ns3/trusted.conf
55fi
56
57$SIGNER -P -g -o "$zone" "$zonefile" >/dev/null 2>signer.err || cat signer.err
58