1#!/bin/sh -e 2# 3# Copyright (C) 2011, 2012 Internet Systems Consortium, Inc. ("ISC") 4# 5# Permission to use, copy, modify, and/or distribute this software for any 6# purpose with or without fee is hereby granted, provided that the above 7# copyright notice and this permission notice appear in all copies. 8# 9# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 10# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 11# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 12# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 14# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15# PERFORMANCE OF THIS SOFTWARE. 16 17# Id: sign.sh,v 1.3 2011/03/03 16:16:46 each Exp 18 19SYSTEMTESTTOP=../.. 20. $SYSTEMTESTTOP/conf.sh 21 22RANDFILE=../random.data 23 24zone=dlv.isc.org 25infile=dlv.isc.org.db.in 26zonefile=dlv.isc.org.db 27 28dlvkey=`$KEYGEN -q -r $RANDFILE -a RSAMD5 -b 768 -n zone $zone` 29cat $infile $dlvkey.key > $zonefile 30$SIGNER -P -g -r $RANDFILE -o $zone $zonefile > /dev/null 31 32zone=. 33infile=root.db.in 34zonefile=root.db 35 36rootkey=`$KEYGEN -q -r $RANDFILE -a RSAMD5 -b 768 -n zone $zone` 37cat $infile $rootkey.key > $zonefile 38$SIGNER -P -g -r $RANDFILE -o $zone $zonefile > /dev/null 39 40# Create bind.keys file for the use of the resolving server 41echo "managed-keys {" > bind.keys 42cat $dlvkey.key | grep -v '^; ' | $PERL -n -e ' 43local ($dn, $class, $type, $flags, $proto, $alg, @rest) = split; 44local $key = join("", @rest); 45print <<EOF 46 "$dn" initial-key $flags $proto $alg "$key"; 47EOF 48' >> bind.keys 49cat $rootkey.key | grep -v '^; ' | $PERL -n -e ' 50local ($dn, $class, $type, $flags, $proto, $alg, @rest) = split; 51local $key = join("", @rest); 52print <<EOF 53 "$dn" initial-key $flags $proto $alg "$key"; 54EOF 55' >> bind.keys 56echo "};" >> bind.keys 57