1#!/bin/sh -e 2# 3# Copyright (C) 2004, 2006-2014 Internet Systems Consortium, Inc. ("ISC") 4# Copyright (C) 2000-2003 Internet Software Consortium. 5# 6# Permission to use, copy, modify, and/or distribute this software for any 7# purpose with or without fee is hereby granted, provided that the above 8# copyright notice and this permission notice appear in all copies. 9# 10# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 11# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 12# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 13# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 14# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 15# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16# PERFORMANCE OF THIS SOFTWARE. 17 18SYSTEMTESTTOP=../.. 19. $SYSTEMTESTTOP/conf.sh 20 21zone=. 22infile=root.db.in 23zonefile=root.db 24 25(cd ../ns2 && $SHELL sign.sh ) 26(cd ../ns6 && $SHELL sign.sh ) 27(cd ../ns7 && $SHELL sign.sh ) 28 29cp ../ns2/dsset-example. . 30cp ../ns2/dsset-dlv. . 31cp ../ns2/dsset-in-addr.arpa. . 32 33grep "8 [12] " ../ns2/dsset-algroll. > dsset-algroll. 34cp ../ns6/dsset-optout-tld. . 35 36keyname=`$KEYGEN -q -r $RANDFILE -a RSAMD5 -b 768 -n zone $zone` 37 38cat $infile $keyname.key > $zonefile 39 40$SIGNER -P -g -r $RANDFILE -o $zone $zonefile > /dev/null 41 42# Configure the resolving server with a trusted key. 43cat $keyname.key | grep -v '^; ' | $PERL -n -e ' 44local ($dn, $class, $type, $flags, $proto, $alg, @rest) = split; 45local $key = join("", @rest); 46print <<EOF 47trusted-keys { 48 "$dn" $flags $proto $alg "$key"; 49}; 50EOF 51' > trusted.conf 52 53# ...or with a managed key. 54cat $keyname.key | grep -v '^; ' | $PERL -n -e ' 55local ($dn, $class, $type, $flags, $proto, $alg, @rest) = split; 56local $key = join("", @rest); 57print <<EOF 58managed-keys { 59 "$dn" initial-key $flags $proto $alg "$key"; 60}; 61EOF 62' > managed.conf 63cp trusted.conf ../ns2/trusted.conf 64cp trusted.conf ../ns3/trusted.conf 65cp trusted.conf ../ns4/trusted.conf 66cp trusted.conf ../ns6/trusted.conf 67cp trusted.conf ../ns7/trusted.conf 68cp managed.conf ../ns4/managed.conf 69# 70# Save keyid for managed key id test. 71# 72keyid=`expr $keyname : 'K.+001+\(.*\)'` 73keyid=`expr $keyid + 0` 74echo "$keyid" > managed.key.id 75