1 1.1 christos #!/bin/sh -e 2 1.1.1.7 christos 3 1.1 christos # Copyright (C) Internet Systems Consortium, Inc. ("ISC") 4 1.1 christos # 5 1.1.1.7 christos # SPDX-License-Identifier: MPL-2.0 6 1.1.1.7 christos # 7 1.1 christos # This Source Code Form is subject to the terms of the Mozilla Public 8 1.1.1.7 christos # License, v. 2.0. If a copy of the MPL was not distributed with this 9 1.1.1.6 christos # file, you can obtain one at https://mozilla.org/MPL/2.0/. 10 1.1 christos # 11 1.1 christos # See the COPYRIGHT file distributed with this work for additional 12 1.1 christos # information regarding copyright ownership. 13 1.1 christos 14 1.1.1.10 christos . ../../conf.sh 15 1.1 christos 16 1.1.1.9 christos zone=sub.tld 17 1.1.1.9 christos zonefile=sub.tld.db 18 1.1.1.9 christos 19 1.1.1.9 christos keyname=$($KEYGEN -a ${DEFAULT_ALGORITHM} -qfk $zone) 20 1.1.1.9 christos zskkeyname=$($KEYGEN -a ${DEFAULT_ALGORITHM} -q $zone) 21 1.1.1.9 christos 22 1.1.1.10 christos $SIGNER -Sg -o $zone $zonefile >/dev/null 2>/dev/null 23 1.1.1.10 christos keyfile_to_initial_ds $keyname >island.conf 24 1.1.1.9 christos cp island.conf ../ns5/island.conf 25 1.1.1.9 christos 26 1.1.1.9 christos zone=tld 27 1.1.1.9 christos zonefile=tld.db 28 1.1.1.9 christos 29 1.1.1.9 christos keyname=$($KEYGEN -a ${DEFAULT_ALGORITHM} -qfk $zone) 30 1.1.1.9 christos zskkeyname=$($KEYGEN -a ${DEFAULT_ALGORITHM} -q $zone) 31 1.1.1.9 christos 32 1.1.1.10 christos $SIGNER -Sg -o $zone $zonefile >/dev/null 2>/dev/null 33 1.1.1.9 christos 34 1.1 christos zone=. 35 1.1 christos zonefile=root.db 36 1.1 christos 37 1.1.1.8 christos keyname=$($KEYGEN -a ${DEFAULT_ALGORITHM} -qfk $zone) 38 1.1.1.8 christos zskkeyname=$($KEYGEN -a ${DEFAULT_ALGORITHM} -q $zone) 39 1.1 christos 40 1.1.1.11 christos $SIGNER -Sg -N unixtime -o $zone $zonefile >/dev/null 2>/dev/null 41 1.1 christos 42 1.1.1.5 christos # Configure the resolving server with an initializing key. 43 1.1.1.10 christos keyfile_to_initial_ds $keyname >managed.conf 44 1.1 christos cp managed.conf ../ns2/managed.conf 45 1.1 christos cp managed.conf ../ns4/managed.conf 46 1.1 christos cp managed.conf ../ns5/managed.conf 47 1.1 christos 48 1.1.1.8 christos # Configure broken trust anchor for ns3 49 1.1.1.8 christos # Rotate each nibble in the digest by -1 50 1.1.1.10 christos $DSFROMKEY $keyname.key \ 51 1.1.1.10 christos | awk '!/^; /{ 52 1.1.1.8 christos printf "trust-anchors {\n" 53 1.1.1.8 christos printf "\t\""$1"\" initial-ds " 54 1.1.1.8 christos printf $4 " " $5 " " $6 " \"" 55 1.1.1.8 christos for (i=7; i<=NF; i++) { 56 1.1.1.8 christos # rotate digest 57 1.1.1.8 christos digest=$i 58 1.1.1.8 christos gsub("0", ":", digest) 59 1.1.1.8 christos gsub("1", "0", digest) 60 1.1.1.8 christos gsub("2", "1", digest) 61 1.1.1.8 christos gsub("3", "2", digest) 62 1.1.1.8 christos gsub("4", "3", digest) 63 1.1.1.8 christos gsub("5", "4", digest) 64 1.1.1.8 christos gsub("6", "5", digest) 65 1.1.1.8 christos gsub("7", "6", digest) 66 1.1.1.8 christos gsub("8", "7", digest) 67 1.1.1.8 christos gsub("9", "8", digest) 68 1.1.1.8 christos gsub("A", "9", digest) 69 1.1.1.8 christos gsub("B", "A", digest) 70 1.1.1.8 christos gsub("C", "B", digest) 71 1.1.1.8 christos gsub("D", "C", digest) 72 1.1.1.8 christos gsub("E", "D", digest) 73 1.1.1.8 christos gsub("F", "E", digest) 74 1.1.1.8 christos gsub(":", "F", digest) 75 1.1.1.8 christos printf digest 76 1.1.1.8 christos } 77 1.1.1.8 christos printf "\";\n" 78 1.1.1.8 christos printf "};\n" 79 1.1.1.10 christos }' >../ns3/broken.conf 80 1.1.1.8 christos 81 1.1.1.5 christos # Configure a static key to be used by delv. 82 1.1.1.10 christos keyfile_to_static_ds $keyname >trusted.conf 83 1.1 christos 84 1.1.1.3 christos # Prepare an unsupported algorithm key. 85 1.1.1.3 christos unsupportedkey=Kunknown.+255+00000 86 1.1.1.3 christos cp unsupported.key "${unsupportedkey}.key" 87 1.1.1.3 christos 88 1.1 christos # 89 1.1 christos # Save keyname and keyid for managed key id test. 90 1.1 christos # 91 1.1.1.10 christos echo "$keyname" >managed.key 92 1.1.1.10 christos echo "$zskkeyname" >zone.key 93 1.1.1.10 christos keyfile_to_key_id $keyname >managed.key.id 94