sign.sh revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews#!/bin/sh
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews#
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Copyright (C) 2012, 2014, 2016 Internet Systems Consortium, Inc. ("ISC")
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews#
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# file, You can obtain one at http://mozilla.org/MPL/2.0/.
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews
7865ea9545f28f12f046b32d24c989e8441b9812Mark AndrewsSYSTEMTESTTOP=../..
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews. $SYSTEMTESTTOP/conf.sh
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewszone=.
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewsinfile=root.db.in
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewszonefile=root.db
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewscp ../ns2/dsset-example.in dsset-example.
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewskeyname=`$KEYGEN -q -r $RANDFILE -a RSASHA1 -b 1024 -n zone $zone`
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewscat $infile $keyname.key > $zonefile
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews$SIGNER -P -g -r $RANDFILE -o $zone $zonefile > /dev/null
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews# Configure the resolving server with a trusted key.
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewscat $keyname.key | grep -v '^; ' | $PERL -n -e '
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewslocal ($dn, $class, $type, $flags, $proto, $alg, @rest) = split;
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewslocal $key = join("", @rest);
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewsprint <<EOF
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewstrusted-keys {
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews "$dn" $flags $proto $alg "$key";
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews};
7865ea9545f28f12f046b32d24c989e8441b9812Mark AndrewsEOF
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews' > trusted.conf
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewscp trusted.conf ../ns2/trusted.conf
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewscp trusted.conf ../ns3/trusted.conf
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews
60988462e5d6db53205851d056e3482a29239be9Evan Huntcd ../ns2 && $SHELL -e ./sign.sh