sign.sh revision bf13e709db49bb19e0c2e73f0a964fe9d7bea4df
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp#!/bin/sh -e
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp#
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp# Copyright (C) 2004, 2006-2009 Internet Systems Consortium, Inc. ("ISC")
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp# Copyright (C) 2000-2003 Internet Software Consortium.
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp#
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp# Permission to use, copy, modify, and/or distribute this software for any
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp# purpose with or without fee is hereby granted, provided that the above
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp# copyright notice and this permission notice appear in all copies.
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp#
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp# PERFORMANCE OF THIS SOFTWARE.
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp# $Id: sign.sh,v 1.31 2010/06/25 03:24:05 marka Exp $
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp
7d87efa8fdfb9453670f2832df666fdae8291a84jmcpSYSTEMTESTTOP=../..
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp. $SYSTEMTESTTOP/conf.sh
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp
ba758cf1b2fe06a606303351c36a766f2f9f6665Jerry GilliamRANDFILE=../random.data
cd21e7c548ae2a3b5e522244bf798f2a6b4ba02dGarrett D'Amore
7d87efa8fdfb9453670f2832df666fdae8291a84jmcpzone=.
7d87efa8fdfb9453670f2832df666fdae8291a84jmcpinfile=root.db.in
7d87efa8fdfb9453670f2832df666fdae8291a84jmcpzonefile=root.db
ba758cf1b2fe06a606303351c36a766f2f9f6665Jerry Gilliam
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp(cd ../ns2 && sh sign.sh )
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp
7d87efa8fdfb9453670f2832df666fdae8291a84jmcpcp ../ns2/dsset-example. .
7d87efa8fdfb9453670f2832df666fdae8291a84jmcpcp ../ns2/dsset-dlv. .
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp
7d87efa8fdfb9453670f2832df666fdae8291a84jmcpkeyname=`$KEYGEN -q -r $RANDFILE -a RSAMD5 -b 768 -n zone $zone`
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp
7d87efa8fdfb9453670f2832df666fdae8291a84jmcpcat $infile $keyname.key > $zonefile
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp$SIGNER -P -g -r $RANDFILE -o $zone $zonefile > /dev/null
ac48dfe87039078897ed719af26744eca776508cVikram Hegde
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp# Configure the resolving server with a trusted key.
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp
7d87efa8fdfb9453670f2832df666fdae8291a84jmcpcat $keyname.key | grep -v '^; ' | $PERL -n -e '
7d87efa8fdfb9453670f2832df666fdae8291a84jmcplocal ($dn, $class, $type, $flags, $proto, $alg, @rest) = split;
7d87efa8fdfb9453670f2832df666fdae8291a84jmcplocal $key = join("", @rest);
7d87efa8fdfb9453670f2832df666fdae8291a84jmcpprint <<EOF
7d87efa8fdfb9453670f2832df666fdae8291a84jmcptrusted-keys {
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp "$dn" $flags $proto $alg "$key";
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp};
7d87efa8fdfb9453670f2832df666fdae8291a84jmcpEOF
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp' > trusted.conf
7d87efa8fdfb9453670f2832df666fdae8291a84jmcpcp trusted.conf ../ns2/trusted.conf
7d87efa8fdfb9453670f2832df666fdae8291a84jmcpcp trusted.conf ../ns3/trusted.conf
7d87efa8fdfb9453670f2832df666fdae8291a84jmcpcp trusted.conf ../ns4/trusted.conf
7d87efa8fdfb9453670f2832df666fdae8291a84jmcpcp trusted.conf ../ns6/trusted.conf
7d87efa8fdfb9453670f2832df666fdae8291a84jmcpcp trusted.conf ../ns7/trusted.conf
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp#
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp# Save keyid for managed key id test.
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp#
7d87efa8fdfb9453670f2832df666fdae8291a84jmcpkeyid=`expr $keyname : 'K.+001+\(.*\)'`
7d87efa8fdfb9453670f2832df666fdae8291a84jmcpecho "$keyid" > managed.key.id
7d87efa8fdfb9453670f2832df666fdae8291a84jmcp