summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--regress/cert-hostkey.sh23
-rw-r--r--regress/cert-userkey.sh19
3 files changed, 32 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index c0e3d3bf3..de3fb011c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,9 @@
4 [mux.c] 4 [mux.c]
5 Typo in confirmation message. bz#1827, patch from imorgan at 5 Typo in confirmation message. bz#1827, patch from imorgan at
6 nas nasa gov 6 nas nasa gov
7 - djm@cvs.openbsd.org 2010/08/31 12:24:09
8 [regress/cert-hostkey.sh regress/cert-userkey.sh]
9 tests for ECDSA certificates
7 10
820101011 1120101011
9 - (djm) [canohost.c] Zero a4 instead of addr to better match type. 12 - (djm) [canohost.c] Zero a4 instead of addr to better match type.
diff --git a/regress/cert-hostkey.sh b/regress/cert-hostkey.sh
index 0265e8f6b..22ae4999d 100644
--- a/regress/cert-hostkey.sh
+++ b/regress/cert-hostkey.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: cert-hostkey.sh,v 1.4 2010/04/16 01:58:45 djm Exp $ 1# $OpenBSD: cert-hostkey.sh,v 1.5 2010/08/31 12:24:09 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="certified host keys" 4tid="certified host keys"
@@ -18,7 +18,7 @@ ${SSHKEYGEN} -q -N '' -t rsa -f $OBJ/host_ca_key ||\
18) > $OBJ/known_hosts-cert 18) > $OBJ/known_hosts-cert
19 19
20# Generate and sign host keys 20# Generate and sign host keys
21for ktype in rsa dsa ; do 21for ktype in rsa dsa ecdsa ; do
22 verbose "$tid: sign host ${ktype} cert" 22 verbose "$tid: sign host ${ktype} cert"
23 # Generate and sign a host key 23 # Generate and sign a host key
24 ${SSHKEYGEN} -q -N '' -t ${ktype} \ 24 ${SSHKEYGEN} -q -N '' -t ${ktype} \
@@ -28,6 +28,8 @@ for ktype in rsa dsa ; do
28 -I "regress host key for $USER" \ 28 -I "regress host key for $USER" \
29 -n $HOSTS $OBJ/cert_host_key_${ktype} || 29 -n $HOSTS $OBJ/cert_host_key_${ktype} ||
30 fail "couldn't sign cert_host_key_${ktype}" 30 fail "couldn't sign cert_host_key_${ktype}"
31 # v00 ecdsa certs do not exist
32 test "{ktype}" = "ecdsa" && continue
31 cp $OBJ/cert_host_key_${ktype} $OBJ/cert_host_key_${ktype}_v00 33 cp $OBJ/cert_host_key_${ktype} $OBJ/cert_host_key_${ktype}_v00
32 cp $OBJ/cert_host_key_${ktype}.pub $OBJ/cert_host_key_${ktype}_v00.pub 34 cp $OBJ/cert_host_key_${ktype}.pub $OBJ/cert_host_key_${ktype}_v00.pub
33 ${SSHKEYGEN} -t v00 -h -q -s $OBJ/host_ca_key \ 35 ${SSHKEYGEN} -t v00 -h -q -s $OBJ/host_ca_key \
@@ -38,7 +40,7 @@ done
38 40
39# Basic connect tests 41# Basic connect tests
40for privsep in yes no ; do 42for privsep in yes no ; do
41 for ktype in rsa dsa rsa_v00 dsa_v00; do 43 for ktype in rsa dsa ecdsa rsa_v00 dsa_v00; do
42 verbose "$tid: host ${ktype} cert connect privsep $privsep" 44 verbose "$tid: host ${ktype} cert connect privsep $privsep"
43 ( 45 (
44 cat $OBJ/sshd_proxy_bak 46 cat $OBJ/sshd_proxy_bak
@@ -66,6 +68,9 @@ done
66 cat $OBJ/cert_host_key_rsa.pub 68 cat $OBJ/cert_host_key_rsa.pub
67 echon '@revoked ' 69 echon '@revoked '
68 echon "* " 70 echon "* "
71 cat $OBJ/cert_host_key_ecdsa.pub
72 echon '@revoked '
73 echon "* "
69 cat $OBJ/cert_host_key_dsa.pub 74 cat $OBJ/cert_host_key_dsa.pub
70 echon '@revoked ' 75 echon '@revoked '
71 echon "* " 76 echon "* "
@@ -75,7 +80,7 @@ done
75 cat $OBJ/cert_host_key_dsa_v00.pub 80 cat $OBJ/cert_host_key_dsa_v00.pub
76) > $OBJ/known_hosts-cert 81) > $OBJ/known_hosts-cert
77for privsep in yes no ; do 82for privsep in yes no ; do
78 for ktype in rsa dsa rsa_v00 dsa_v00; do 83 for ktype in rsa dsa ecdsa rsa_v00 dsa_v00; do
79 verbose "$tid: host ${ktype} revoked cert privsep $privsep" 84 verbose "$tid: host ${ktype} revoked cert privsep $privsep"
80 ( 85 (
81 cat $OBJ/sshd_proxy_bak 86 cat $OBJ/sshd_proxy_bak
@@ -102,7 +107,7 @@ done
102 echon "* " 107 echon "* "
103 cat $OBJ/host_ca_key.pub 108 cat $OBJ/host_ca_key.pub
104) > $OBJ/known_hosts-cert 109) > $OBJ/known_hosts-cert
105for ktype in rsa dsa rsa_v00 dsa_v00 ; do 110for ktype in rsa dsa ecdsa rsa_v00 dsa_v00 ; do
106 verbose "$tid: host ${ktype} revoked cert" 111 verbose "$tid: host ${ktype} revoked cert"
107 ( 112 (
108 cat $OBJ/sshd_proxy_bak 113 cat $OBJ/sshd_proxy_bak
@@ -173,7 +178,9 @@ test_one "cert has constraints" failure "-h -Oforce-command=false"
173 178
174# Check downgrade of cert to raw key when no CA found 179# Check downgrade of cert to raw key when no CA found
175for v in v01 v00 ; do 180for v in v01 v00 ; do
176 for ktype in rsa dsa ; do 181 for ktype in rsa dsa ecdsa ; do
182 # v00 ecdsa certs do not exist.
183 test "${v}${ktype}" = "v00ecdsa" && continue
177 rm -f $OBJ/known_hosts-cert $OBJ/cert_host_key* 184 rm -f $OBJ/known_hosts-cert $OBJ/cert_host_key*
178 verbose "$tid: host ${ktype} ${v} cert downgrade to raw key" 185 verbose "$tid: host ${ktype} ${v} cert downgrade to raw key"
179 # Generate and sign a host key 186 # Generate and sign a host key
@@ -210,7 +217,9 @@ done
210 cat $OBJ/host_ca_key.pub 217 cat $OBJ/host_ca_key.pub
211) > $OBJ/known_hosts-cert 218) > $OBJ/known_hosts-cert
212for v in v01 v00 ; do 219for v in v01 v00 ; do
213 for kt in rsa dsa ; do 220 for kt in rsa dsa ecdsa ; do
221 # v00 ecdsa certs do not exist.
222 test "${v}${ktype}" = "v00ecdsa" && continue
214 rm -f $OBJ/cert_host_key* 223 rm -f $OBJ/cert_host_key*
215 # Self-sign key 224 # Self-sign key
216 ${SSHKEYGEN} -q -N '' -t ${kt} \ 225 ${SSHKEYGEN} -q -N '' -t ${kt} \
diff --git a/regress/cert-userkey.sh b/regress/cert-userkey.sh
index a41a9a9c0..01f3b40a4 100644
--- a/regress/cert-userkey.sh
+++ b/regress/cert-userkey.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: cert-userkey.sh,v 1.6 2010/06/29 23:59:54 djm Exp $ 1# $OpenBSD: cert-userkey.sh,v 1.7 2010/08/31 12:24:09 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="certified user keys" 4tid="certified user keys"
@@ -11,7 +11,7 @@ ${SSHKEYGEN} -q -N '' -t rsa -f $OBJ/user_ca_key ||\
11 fail "ssh-keygen of user_ca_key failed" 11 fail "ssh-keygen of user_ca_key failed"
12 12
13# Generate and sign user keys 13# Generate and sign user keys
14for ktype in rsa dsa ; do 14for ktype in rsa dsa ecdsa ; do
15 verbose "$tid: sign user ${ktype} cert" 15 verbose "$tid: sign user ${ktype} cert"
16 ${SSHKEYGEN} -q -N '' -t ${ktype} \ 16 ${SSHKEYGEN} -q -N '' -t ${ktype} \
17 -f $OBJ/cert_user_key_${ktype} || \ 17 -f $OBJ/cert_user_key_${ktype} || \
@@ -20,6 +20,8 @@ for ktype in rsa dsa ; do
20 "regress user key for $USER" \ 20 "regress user key for $USER" \
21 -n ${USER},mekmitasdigoat $OBJ/cert_user_key_${ktype} || 21 -n ${USER},mekmitasdigoat $OBJ/cert_user_key_${ktype} ||
22 fail "couldn't sign cert_user_key_${ktype}" 22 fail "couldn't sign cert_user_key_${ktype}"
23 # v00 ecdsa certs do not exist
24 test "{ktype}" = "ecdsa" && continue
23 cp $OBJ/cert_user_key_${ktype} $OBJ/cert_user_key_${ktype}_v00 25 cp $OBJ/cert_user_key_${ktype} $OBJ/cert_user_key_${ktype}_v00
24 cp $OBJ/cert_user_key_${ktype}.pub $OBJ/cert_user_key_${ktype}_v00.pub 26 cp $OBJ/cert_user_key_${ktype}.pub $OBJ/cert_user_key_${ktype}_v00.pub
25 ${SSHKEYGEN} -q -t v00 -s $OBJ/user_ca_key -I \ 27 ${SSHKEYGEN} -q -t v00 -s $OBJ/user_ca_key -I \
@@ -29,7 +31,7 @@ for ktype in rsa dsa ; do
29done 31done
30 32
31# Test explicitly-specified principals 33# Test explicitly-specified principals
32for ktype in rsa dsa rsa_v00 dsa_v00 ; do 34for ktype in rsa dsa ecdsa rsa_v00 dsa_v00 ; do
33 for privsep in yes no ; do 35 for privsep in yes no ; do
34 _prefix="${ktype} privsep $privsep" 36 _prefix="${ktype} privsep $privsep"
35 37
@@ -155,7 +157,7 @@ basic_tests() {
155 extra_sshd="TrustedUserCAKeys $OBJ/user_ca_key.pub" 157 extra_sshd="TrustedUserCAKeys $OBJ/user_ca_key.pub"
156 fi 158 fi
157 159
158 for ktype in rsa dsa rsa_v00 dsa_v00 ; do 160 for ktype in rsa dsa ecdsa rsa_v00 dsa_v00 ; do
159 for privsep in yes no ; do 161 for privsep in yes no ; do
160 _prefix="${ktype} privsep $privsep $auth" 162 _prefix="${ktype} privsep $privsep $auth"
161 # Simple connect 163 # Simple connect
@@ -230,6 +232,11 @@ test_one() {
230 232
231 for auth in $auth_choice ; do 233 for auth in $auth_choice ; do
232 for ktype in rsa rsa_v00 ; do 234 for ktype in rsa rsa_v00 ; do
235 case $ktype in
236 *_v00) keyv="-t v00" ;;
237 *) keyv="" ;;
238 esac
239
233 cat $OBJ/sshd_proxy_bak > $OBJ/sshd_proxy 240 cat $OBJ/sshd_proxy_bak > $OBJ/sshd_proxy
234 if test "x$auth" = "xauthorized_keys" ; then 241 if test "x$auth" = "xauthorized_keys" ; then
235 # Add CA to authorized_keys 242 # Add CA to authorized_keys
@@ -249,7 +256,7 @@ test_one() {
249 verbose "$tid: $ident auth $auth expect $result $ktype" 256 verbose "$tid: $ident auth $auth expect $result $ktype"
250 ${SSHKEYGEN} -q -s $OBJ/user_ca_key \ 257 ${SSHKEYGEN} -q -s $OBJ/user_ca_key \
251 -I "regress user key for $USER" \ 258 -I "regress user key for $USER" \
252 $sign_opts \ 259 $sign_opts $keyv \
253 $OBJ/cert_user_key_${ktype} || 260 $OBJ/cert_user_key_${ktype} ||
254 fail "couldn't sign cert_user_key_${ktype}" 261 fail "couldn't sign cert_user_key_${ktype}"
255 262
@@ -302,7 +309,7 @@ test_one "principals key option no principals" failure "" \
302 309
303# Wrong certificate 310# Wrong certificate
304cat $OBJ/sshd_proxy_bak > $OBJ/sshd_proxy 311cat $OBJ/sshd_proxy_bak > $OBJ/sshd_proxy
305for ktype in rsa dsa rsa_v00 dsa_v00 ; do 312for ktype in rsa dsa ecdsa rsa_v00 dsa_v00 ; do
306 case $ktype in 313 case $ktype in
307 *_v00) args="-t v00" ;; 314 *_v00) args="-t v00" ;;
308 *) args="" ;; 315 *) args="" ;;