1#!/bin/sh
2#
3# Copyright (C) 2010, 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: tests.sh,v 1.3 2010/06/08 23:50:24 tbox Exp 
18
19SYSTEMTESTTOP=..
20. $SYSTEMTESTTOP/conf.sh
21
22RANDFILE=random.data
23
24DIGOPTS="+tcp +noadd +nosea +nostat +nocmd +dnssec -p 5300"
25
26status=0
27ret=0
28
29zonefile=ns1/example.db
30
31echo "I:testing PKCS#11 key generation"
32
33count=`$PK11LIST | grep robie-ksk | wc -l`
34if [ $count != 2 ]; then echo "I:failed"; status=1; fi
35
36echo "I:testing offline signing with PKCS#11 keys"
37
38count=`grep RRSIG $zonefile.signed | wc -l`
39if [ $count != 12 ]; then echo "I:failed"; status=1; fi
40
41echo "I:testing inline signing with PKCS#11 keys"
42
43$NSUPDATE > /dev/null <<END || status=1
44server 10.53.0.1 5300
45ttl 300
46zone example.
47update add `grep -v ';' ns1/key`
48send
49END
50
51echo "I:waiting 20 seconds for key changes to take effect"
52sleep 20
53
54$DIG $DIGOPTS ns.example. @10.53.0.1 a > dig.out || ret=1
55if [ $ret != 0 ]; then echo "I:failed"; fi
56status=`expr $status + $ret`
57count=`grep RRSIG dig.out | wc -l`
58if [ $count != 4 ]; then echo "I:failed"; status=1; fi
59
60echo "I:testing PKCS#11 key destroy"
61
62ret=0
63$PK11DEL -l robie-zsk1 || ret=1
64$PK11DEL -i 02 || ret=1
65if [ $ret != 0 ]; then echo "I:failed"; fi
66status=`expr $status + $ret`
67count=`$PK11LIST | grep robie-zsk | wc -l`
68if [ $count != 0 ]; then echo "I:failed"; fi
69status=`expr $status + $count`
70
71echo "I:exit status: $status"
72exit $status
73