sign.sh revision 60988462e5d6db53205851d056e3482a29239be9
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews#!/bin/sh
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews#
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Copyright (C) 2010, 2012, 2014 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews#
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Permission to use, copy, modify, and/or distribute this software for any
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# purpose with or without fee is hereby granted, provided that the above
0f5542c35c24e78f92182850bcd87e72cd6e1d49Andreas Gustafsson# copyright notice and this permission notice appear in all copies.
0f5542c35c24e78f92182850bcd87e72cd6e1d49Andreas Gustafsson#
0f5542c35c24e78f92182850bcd87e72cd6e1d49Andreas Gustafsson# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Hunt# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Hunt# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
c2bc56dc65b4b103a5600565680eb5f33fa4c90bMark Andrews# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
0f5542c35c24e78f92182850bcd87e72cd6e1d49Andreas Gustafsson# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Hunt# PERFORMANCE OF THIS SOFTWARE.
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Hunt
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan HuntSYSTEMTESTTOP=../..
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Hunt. $SYSTEMTESTTOP/conf.sh
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Hunt
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Huntzone=example.
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Huntinfile=example.db.in
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Huntzonefile=example.db
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Hunt
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Hunt(cd ../ns4 && $SHELL -e sign.sh )
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Hunt
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Huntcp ../ns4/dsset-sub.example. .
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Hunt
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Huntkeyname1=`$KEYGEN -q -r $RANDFILE -a RSASHA256 -b 1024 -n zone $zone`
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Huntkeyname2=`$KEYGEN -q -r $RANDFILE -a RSASHA256 -b 2048 -f KSK -n zone $zone`
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Huntcat $infile $keyname1.key $keyname2.key > $zonefile
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Hunt
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Hunt$SIGNER -g -r $RANDFILE -o $zone $zonefile > /dev/null 2>&1
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Hunt
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Hunt# Configure the resolving server with a trusted key.
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Hunt
d8ecccc889a73a496de29e263ede0e1105b3b8c3Michael Sawyercat $keyname2.key | grep -v '^; ' | $PERL -n -e '
d8ecccc889a73a496de29e263ede0e1105b3b8c3Michael Sawyerlocal ($dn, $class, $type, $flags, $proto, $alg, @rest) = split;
d8ecccc889a73a496de29e263ede0e1105b3b8c3Michael Sawyerlocal $key = join("", @rest);
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Huntprint <<EOF
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Hunttrusted-keys {
45fd95544cd650a8e6a0fc39b656d1109b811ac0Evan Hunt "$dn" $flags $proto $alg "$key";
b199bc831e7a895450a6c0745867283e2cc1a078Andreas Gustafsson};
b199bc831e7a895450a6c0745867283e2cc1a078Andreas GustafssonEOF
b199bc831e7a895450a6c0745867283e2cc1a078Andreas Gustafsson' > trusted.conf
66870de5231491d8132b98159734a62b1fa12f1fAndreas Gustafssoncp trusted.conf ../ns2/trusted.conf
66870de5231491d8132b98159734a62b1fa12f1fAndreas Gustafsson