sign.sh 1.69 KB
Newer Older
1
#!/bin/sh -e
Michael Sawyer's avatar
Michael Sawyer committed
2
#
Automatic Updater's avatar
Automatic Updater committed
3
# Copyright (C) 2004, 2006-2009  Internet Systems Consortium, Inc. ("ISC")
Mark Andrews's avatar
Mark Andrews committed
4
# Copyright (C) 2000-2003  Internet Software Consortium.
5
#
Automatic Updater's avatar
Automatic Updater committed
6
# Permission to use, copy, modify, and/or distribute this software for any
Michael Sawyer's avatar
Michael Sawyer committed
7 8
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
9
#
Mark Andrews's avatar
Mark Andrews committed
10 11 12 13 14 15 16 17
# 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.

18
# $Id: sign.sh,v 1.30 2009/10/28 00:27:10 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 30
zone=.
infile=root.db.in
zonefile=root.db

(cd ../ns2 && sh sign.sh )

31 32
cp ../ns2/dsset-example. .
cp ../ns2/dsset-dlv. .
Michael Sawyer's avatar
Michael Sawyer committed
33

34
keyname=`$KEYGEN -q -r $RANDFILE -a RSAMD5 -b 768 -n zone $zone`
Michael Sawyer's avatar
Michael Sawyer committed
35 36 37

cat $infile $keyname.key > $zonefile

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

# Configure the resolving server with a trusted key.

42
cat $keyname.key | grep -v '^; ' | $PERL -n -e '
43 44
local ($dn, $class, $type, $flags, $proto, $alg, @rest) = split;
local $key = join("", @rest);
Michael Sawyer's avatar
Michael Sawyer committed
45 46 47 48 49 50 51 52 53
print <<EOF
trusted-keys {
    "$dn" $flags $proto $alg "$key";
};
EOF
' > trusted.conf
cp trusted.conf ../ns2/trusted.conf
cp trusted.conf ../ns3/trusted.conf
cp trusted.conf ../ns4/trusted.conf
54
cp trusted.conf ../ns6/trusted.conf
55
cp trusted.conf ../ns7/trusted.conf