-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.sh
executable file
·57 lines (51 loc) · 1.04 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
EXE=scripts/validate.py
NS=1.1.1.1
EXITCODE=0
function do_test
{
q=$1
rr=$2
echo "testing positive $q $rr"
rm -rf /tmp/digsec
mkdir /tmp/digsec
digsec.resolve $q $rr /tmp/digsec $NS || EXITCODE=$?
if [ $EXITCODE -ne 0 ]
then
echo "exiting with 1, query fail"
exit 1
fi
digsec.authenticate $q $rr /tmp/digsec || EXITCODE=$?
if [ $EXITCODE -ne 0 ]
then
echo "exiting with 1, validate fail (expected success)"
exit 1
fi
echo "test success"
}
function do_ftest
{
q=$1
rr=$2
echo "testing negative $q $rr"
rm -rf /tmp/digsec
mkdir /tmp/digsec
digsec.resolve $q $rr /tmp/digsec $NS || EXITCODE=$?
if [ $EXITCODE -ne 0 ]
then
echo "exiting with 1, query fail"
exit 1
fi
digsec.authenticate $q $rr /tmp/digsec || EXITCODE=$?
if [ $EXITCODE -eq 0 ]
then
echo "exiting with 1, validate success (expected fail)"
exit 1
fi
echo "test success"
}
do_test . DNSKEY
do_test com DNSKEY
do_test metebalci.com DNSKEY
do_test metebalci.com A DNSKEY
do_ftest dnssec-failed.org DNSKEY