summaryrefslogtreecommitdiff
path: root/regress/cert-hostkey.sh
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2013-12-07 16:32:44 +1100
committerDamien Miller <djm@mindrot.org>2013-12-07 16:32:44 +1100
commitf54542af3ad07532188b10136ae302314ec69ed6 (patch)
tree2caa3c595bd1177bd6bfabecc47c8af69d33d6c8 /regress/cert-hostkey.sh
parentf104da263de995f66b6861b4f3368264ee483d7f (diff)
- markus@cvs.openbsd.org 2013/12/06 13:52:46
[regress/Makefile regress/agent.sh regress/cert-hostkey.sh] [regress/cert-userkey.sh regress/keytype.sh] test ed25519 support; from djm@
Diffstat (limited to 'regress/cert-hostkey.sh')
-rw-r--r--regress/cert-hostkey.sh48
1 files changed, 28 insertions, 20 deletions
diff --git a/regress/cert-hostkey.sh b/regress/cert-hostkey.sh
index 35cd39293..da2cec87d 100644
--- a/regress/cert-hostkey.sh
+++ b/regress/cert-hostkey.sh
@@ -1,14 +1,8 @@
1# $OpenBSD: cert-hostkey.sh,v 1.7 2013/05/17 00:37:40 dtucker Exp $ 1# $OpenBSD: cert-hostkey.sh,v 1.8 2013/12/06 13:52:46 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="certified host keys" 4tid="certified host keys"
5 5
6# used to disable ECC based tests on platforms without ECC
7ecdsa=""
8if test "x$TEST_SSH_ECC" = "xyes"; then
9 ecdsa=ecdsa
10fi
11
12rm -f $OBJ/known_hosts-cert $OBJ/host_ca_key* $OBJ/cert_host_key* 6rm -f $OBJ/known_hosts-cert $OBJ/host_ca_key* $OBJ/cert_host_key*
13cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak 7cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak
14 8
@@ -23,8 +17,17 @@ ${SSHKEYGEN} -q -N '' -t rsa -f $OBJ/host_ca_key ||\
23 cat $OBJ/host_ca_key.pub 17 cat $OBJ/host_ca_key.pub
24) > $OBJ/known_hosts-cert 18) > $OBJ/known_hosts-cert
25 19
20PLAIN_TYPES=`$SSH -Q key-plain | sed 's/^ssh-dss/ssh-dsa/g;s/^ssh-//'`
21
22type_has_legacy() {
23 case $1 in
24 ed25519*|ecdsa*) return 1 ;;
25 esac
26 return 0
27}
28
26# Generate and sign host keys 29# Generate and sign host keys
27for ktype in rsa dsa $ecdsa ; do 30for ktype in $PLAIN_TYPES ; do
28 verbose "$tid: sign host ${ktype} cert" 31 verbose "$tid: sign host ${ktype} cert"
29 # Generate and sign a host key 32 # Generate and sign a host key
30 ${SSHKEYGEN} -q -N '' -t ${ktype} \ 33 ${SSHKEYGEN} -q -N '' -t ${ktype} \
@@ -34,10 +37,10 @@ for ktype in rsa dsa $ecdsa ; do
34 -I "regress host key for $USER" \ 37 -I "regress host key for $USER" \
35 -n $HOSTS $OBJ/cert_host_key_${ktype} || 38 -n $HOSTS $OBJ/cert_host_key_${ktype} ||
36 fail "couldn't sign cert_host_key_${ktype}" 39 fail "couldn't sign cert_host_key_${ktype}"
37 # v00 ecdsa certs do not exist 40 type_has_legacy $ktype || continue
38 test "${ktype}" = "ecdsa" && continue
39 cp $OBJ/cert_host_key_${ktype} $OBJ/cert_host_key_${ktype}_v00 41 cp $OBJ/cert_host_key_${ktype} $OBJ/cert_host_key_${ktype}_v00
40 cp $OBJ/cert_host_key_${ktype}.pub $OBJ/cert_host_key_${ktype}_v00.pub 42 cp $OBJ/cert_host_key_${ktype}.pub $OBJ/cert_host_key_${ktype}_v00.pub
43 verbose "$tid: sign host ${ktype}_v00 cert"
41 ${SSHKEYGEN} -t v00 -h -q -s $OBJ/host_ca_key \ 44 ${SSHKEYGEN} -t v00 -h -q -s $OBJ/host_ca_key \
42 -I "regress host key for $USER" \ 45 -I "regress host key for $USER" \
43 -n $HOSTS $OBJ/cert_host_key_${ktype}_v00 || 46 -n $HOSTS $OBJ/cert_host_key_${ktype}_v00 ||
@@ -46,7 +49,7 @@ done
46 49
47# Basic connect tests 50# Basic connect tests
48for privsep in yes no ; do 51for privsep in yes no ; do
49 for ktype in rsa dsa $ecdsa rsa_v00 dsa_v00; do 52 for ktype in $PLAIN_TYPES rsa_v00 dsa_v00; do
50 verbose "$tid: host ${ktype} cert connect privsep $privsep" 53 verbose "$tid: host ${ktype} cert connect privsep $privsep"
51 ( 54 (
52 cat $OBJ/sshd_proxy_bak 55 cat $OBJ/sshd_proxy_bak
@@ -73,9 +76,16 @@ done
73 printf "* " 76 printf "* "
74 cat $OBJ/cert_host_key_rsa.pub 77 cat $OBJ/cert_host_key_rsa.pub
75 if test "x$TEST_SSH_ECC" = "xyes"; then 78 if test "x$TEST_SSH_ECC" = "xyes"; then
79 cat $OBJ/cert_host_key_ecdsa-sha2-nistp256.pub
80 printf '@revoked '
81 printf "* "
82 cat $OBJ/cert_host_key_ecdsa-sha2-nistp384.pub
83 printf '@revoked '
84 printf "* "
85 cat $OBJ/cert_host_key_ecdsa-sha2-nistp521.pub
76 printf '@revoked ' 86 printf '@revoked '
77 printf "* " 87 printf "* "
78 cat $OBJ/cert_host_key_ecdsa.pub 88 cat $OBJ/cert_host_key_ed25519.pub
79 fi 89 fi
80 printf '@revoked ' 90 printf '@revoked '
81 printf "* " 91 printf "* "
@@ -88,7 +98,7 @@ done
88 cat $OBJ/cert_host_key_dsa_v00.pub 98 cat $OBJ/cert_host_key_dsa_v00.pub
89) > $OBJ/known_hosts-cert 99) > $OBJ/known_hosts-cert
90for privsep in yes no ; do 100for privsep in yes no ; do
91 for ktype in rsa dsa $ecdsa rsa_v00 dsa_v00; do 101 for ktype in $PLAIN_TYPES rsa_v00 dsa_v00; do
92 verbose "$tid: host ${ktype} revoked cert privsep $privsep" 102 verbose "$tid: host ${ktype} revoked cert privsep $privsep"
93 ( 103 (
94 cat $OBJ/sshd_proxy_bak 104 cat $OBJ/sshd_proxy_bak
@@ -115,7 +125,7 @@ done
115 printf "* " 125 printf "* "
116 cat $OBJ/host_ca_key.pub 126 cat $OBJ/host_ca_key.pub
117) > $OBJ/known_hosts-cert 127) > $OBJ/known_hosts-cert
118for ktype in rsa dsa $ecdsa rsa_v00 dsa_v00 ; do 128for ktype in $PLAIN_TYPES rsa_v00 dsa_v00 ; do
119 verbose "$tid: host ${ktype} revoked cert" 129 verbose "$tid: host ${ktype} revoked cert"
120 ( 130 (
121 cat $OBJ/sshd_proxy_bak 131 cat $OBJ/sshd_proxy_bak
@@ -186,9 +196,8 @@ test_one "cert has constraints" failure "-h -Oforce-command=false"
186 196
187# Check downgrade of cert to raw key when no CA found 197# Check downgrade of cert to raw key when no CA found
188for v in v01 v00 ; do 198for v in v01 v00 ; do
189 for ktype in rsa dsa $ecdsa ; do 199 for ktype in $PLAIN_TYPES ; do
190 # v00 ecdsa certs do not exist. 200 type_has_legacy $ktype || continue
191 test "${v}${ktype}" = "v00ecdsa" && continue
192 rm -f $OBJ/known_hosts-cert $OBJ/cert_host_key* 201 rm -f $OBJ/known_hosts-cert $OBJ/cert_host_key*
193 verbose "$tid: host ${ktype} ${v} cert downgrade to raw key" 202 verbose "$tid: host ${ktype} ${v} cert downgrade to raw key"
194 # Generate and sign a host key 203 # Generate and sign a host key
@@ -225,9 +234,8 @@ done
225 cat $OBJ/host_ca_key.pub 234 cat $OBJ/host_ca_key.pub
226) > $OBJ/known_hosts-cert 235) > $OBJ/known_hosts-cert
227for v in v01 v00 ; do 236for v in v01 v00 ; do
228 for kt in rsa dsa $ecdsa ; do 237 for kt in $PLAIN_TYPES ; do
229 # v00 ecdsa certs do not exist. 238 type_has_legacy $kt || continue
230 test "${v}${ktype}" = "v00ecdsa" && continue
231 rm -f $OBJ/cert_host_key* 239 rm -f $OBJ/cert_host_key*
232 # Self-sign key 240 # Self-sign key
233 ${SSHKEYGEN} -q -N '' -t ${kt} \ 241 ${SSHKEYGEN} -q -N '' -t ${kt} \