sign.sh 2.24 KB
Newer Older
1
#!/bin/sh -e
Michael Sawyer's avatar
Michael Sawyer committed
2
#
Tinderbox User's avatar
Tinderbox User committed
3
# Copyright (C) 2004, 2006-2013  Internet Systems Consortium, Inc. ("ISC")
Mark Andrews's avatar
Mark Andrews committed
4 5 6 7 8 9 10 11 12 13 14 15 16
# Copyright (C) 2000-2003  Internet Software Consortium.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
Mark Andrews's avatar
Mark Andrews committed
17

18
# $Id: sign.sh,v 1.37 2011/05/03 16:07:44 marka Exp $
David Lawrence's avatar
David Lawrence committed
19

20 21
SYSTEMTESTTOP=../..
. $SYSTEMTESTTOP/conf.sh
Michael Sawyer's avatar
Michael Sawyer committed
22

23 24
RANDFILE=../random.data

Michael Sawyer's avatar
Michael Sawyer committed
25 26 27 28 29
zone=.
infile=root.db.in
zonefile=root.db

(cd ../ns2 && sh sign.sh )
30
(cd ../ns6 && sh sign.sh )
Michael Sawyer's avatar
Michael Sawyer committed
31

32 33
cp ../ns2/dsset-example. .
cp ../ns2/dsset-dlv. .
34
grep "8 [12] " ../ns2/dsset-algroll. > dsset-algroll.
35
cp ../ns6/dsset-optout-tld. .
Michael Sawyer's avatar
Michael Sawyer committed
36

37
keyname=`$KEYGEN -q -r $RANDFILE -a RSAMD5 -b 768 -n zone $zone`
Michael Sawyer's avatar
Michael Sawyer committed
38 39 40

cat $infile $keyname.key > $zonefile

41
$SIGNER -P -g -r $RANDFILE -o $zone $zonefile > /dev/null
Michael Sawyer's avatar
Michael Sawyer committed
42 43

# Configure the resolving server with a trusted key.
44
cat $keyname.key | grep -v '^; ' | $PERL -n -e '
45 46
local ($dn, $class, $type, $flags, $proto, $alg, @rest) = split;
local $key = join("", @rest);
Michael Sawyer's avatar
Michael Sawyer committed
47 48 49 50 51 52
print <<EOF
trusted-keys {
    "$dn" $flags $proto $alg "$key";
};
EOF
' > trusted.conf
53 54 55 56 57 58 59 60 61 62 63

# ...or with a managed key.
cat $keyname.key | grep -v '^; ' | $PERL -n -e '
local ($dn, $class, $type, $flags, $proto, $alg, @rest) = split;
local $key = join("", @rest);
print <<EOF
managed-keys {
    "$dn" initial-key $flags $proto $alg "$key";
};
EOF
' > managed.conf
Michael Sawyer's avatar
Michael Sawyer committed
64 65 66
cp trusted.conf ../ns2/trusted.conf
cp trusted.conf ../ns3/trusted.conf
cp trusted.conf ../ns4/trusted.conf
67
cp trusted.conf ../ns6/trusted.conf
68
cp trusted.conf ../ns7/trusted.conf
69
cp managed.conf ../ns4/managed.conf
70 71 72 73
#
#  Save keyid for managed key id test.
#
keyid=`expr $keyname : 'K.+001+\(.*\)'`
Mark Andrews's avatar
Mark Andrews committed
74
keyid=`expr $keyid + 0`
75
echo "$keyid" > managed.key.id