3 # Test SSL's hostname compare using subjectAltName extensions.
5 # these can be overridden by the 'q' and 'v' cmd line options
21 echo usage
: doTest \
[q\
] \
[v\
]
27 # hard coded in signerAndSubjSsl
29 set ROOT_CERT
= ssRootCert.der
30 set LEAF_CERT
= ssSubjCert.der
31 set COMMON_NAME
= something.org
33 # the common arguments to certcrl
35 set STD_CRL_ARGS
= "-c $LEAF_CERT -C $ROOT_CERT -a -n -N -q"
37 # DNS_NAME goes in the leaf cert's subjectAltName, which is supposed to have precedence
38 # over the common name (which is fixed at something.org).
40 set DNS_NAME
= foo.bar
41 set BAD_DNS_NAME
= foo.foo.bar
44 echo === leaf cert with DNS name
$DNS_NAME
47 set cmd
= "signerAndSubjSsl d=$DNS_NAME q"
48 if($VERBOSE == 1) then
53 # Note the app is passing in $HOST_NAME which differs from the leaf cert's common name
56 echo === ...verify success with hostname
$DNS_NAME
58 set cmd
= "certcrl $STD_CRL_ARGS -h $DNS_NAME"
59 if($VERBOSE == 1) then
65 echo === ...verify failure with common name
$COMMON_NAME when DNS name present
67 set cmd
= "certcrl $STD_CRL_ARGS -h $COMMON_NAME -e=CSSMERR_TP_VERIFY_ACTION_FAILED"
68 if($VERBOSE == 1) then
74 echo === ...verify failure with
host name
$BAD_DNS_NAME
76 set cmd
= "certcrl $STD_CRL_ARGS -h $BAD_DNS_NAME -e=CSSMERR_TP_VERIFY_ACTION_FAILED"
77 if($VERBOSE == 1) then
85 set IP_ADDR_PAD
= 1.0.05.008
86 set BAD_IP_ADDR
= 2.0.5.8
89 echo === leaf cert with IP address
$IP_ADDR
91 set cmd
= "signerAndSubjSsl i=$IP_ADDR q"
92 if($VERBOSE == 1) then
98 echo === ...verify with hostname
$IP_ADDR
100 set cmd
= "certcrl $STD_CRL_ARGS -h $IP_ADDR"
101 if($VERBOSE == 1) then
107 echo === ...verify with hostname
$IP_ADDR_PAD
109 set cmd
= "certcrl $STD_CRL_ARGS -h $IP_ADDR_PAD"
110 if($VERBOSE == 1) then
116 echo === ...verify with hostname
$COMMON_NAME when no DNS name present
118 set cmd
= "certcrl $STD_CRL_ARGS -h $COMMON_NAME"
119 if($VERBOSE == 1) then
125 echo === ...verify failure with
host name
$BAD_IP_ADDR
127 set cmd
= "certcrl $STD_CRL_ARGS -h $BAD_IP_ADDR -e=CSSMERR_TP_VERIFY_ACTION_FAILED"
128 if($VERBOSE == 1) then
135 set DNS_WC_NAME
= "*.foo.bar"
136 set DNS_GOOD_WC_NAME
= bar.foo.bar
137 set DNS_BAD_WC_NAME
= foo.bar
140 echo === leaf cert with DNS name
"$DNS_WC_NAME"
142 set cmd
= "signerAndSubjSsl d=*.foo.bar q"
143 if($VERBOSE == 1) then
146 signerAndSubjSsl
"d=*.foo.bar" q
|| exit(1)
149 echo === ...verify with hostname
$DNS_GOOD_WC_NAME
151 set cmd
= "certcrl $STD_CRL_ARGS -h $DNS_GOOD_WC_NAME"
152 if($VERBOSE == 1) then
158 echo === ...verify failure with hostname
$DNS_BAD_WC_NAME
160 set cmd
= "certcrl $STD_CRL_ARGS -h $DNS_BAD_WC_NAME -e=CSSMERR_TP_VERIFY_ACTION_FAILED"
161 if($VERBOSE == 1) then
168 set DNS_WC_NAME
= "*foo.bar"
169 set DNS_GOOD_WC_NAME
= barfoo.bar
170 set DNS_BAD_WC_NAME
= bar.foo.bar
173 echo === leaf cert with DNS name
"$DNS_WC_NAME"
175 set cmd
= "signerAndSubjSsl d=*foo.bar q"
176 if($VERBOSE == 1) then
179 signerAndSubjSsl
"d=*foo.bar" q
|| exit(1)
182 echo === ...verify with hostname
$DNS_GOOD_WC_NAME
184 set cmd
= "certcrl $STD_CRL_ARGS -h $DNS_GOOD_WC_NAME"
185 if($VERBOSE == 1) then
191 echo === ...verify failure with hostname
$DNS_BAD_WC_NAME
193 set cmd
= "certcrl $STD_CRL_ARGS -h $DNS_BAD_WC_NAME -e=CSSMERR_TP_VERIFY_ACTION_FAILED"
194 if($VERBOSE == 1) then
202 echo === leaf cert with no DNS name
, verify with common name
204 set cmd
= "signerAndSubjSsl q"
205 if($VERBOSE == 1) then
209 set cmd
= "certcrl $STD_CRL_ARGS -h $COMMON_NAME"
210 if($VERBOSE == 1) then
214 echo ...signerAndSubjSslTest complete