summaryrefslogtreecommitdiff
path: root/regress/cert-userkey.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-userkey.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-userkey.sh')
-rw-r--r--regress/cert-userkey.sh31
1 files changed, 17 insertions, 14 deletions
diff --git a/regress/cert-userkey.sh b/regress/cert-userkey.sh
index 6018b38f4..b093a9196 100644
--- a/regress/cert-userkey.sh
+++ b/regress/cert-userkey.sh
@@ -1,23 +1,26 @@
1# $OpenBSD: cert-userkey.sh,v 1.11 2013/05/17 00:37:40 dtucker Exp $ 1# $OpenBSD: cert-userkey.sh,v 1.12 2013/12/06 13:52:46 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="certified user keys" 4tid="certified user 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/authorized_keys_$USER $OBJ/user_ca_key* $OBJ/cert_user_key* 6rm -f $OBJ/authorized_keys_$USER $OBJ/user_ca_key* $OBJ/cert_user_key*
13cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak 7cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak
14 8
9PLAIN_TYPES=`$SSH -Q key-plain | sed 's/^ssh-dss/ssh-dsa/;s/^ssh-//'`
10
11type_has_legacy() {
12 case $1 in
13 ed25519*|ecdsa*) return 1 ;;
14 esac
15 return 0
16}
17
15# Create a CA key 18# Create a CA key
16${SSHKEYGEN} -q -N '' -t rsa -f $OBJ/user_ca_key ||\ 19${SSHKEYGEN} -q -N '' -t rsa -f $OBJ/user_ca_key ||\
17 fail "ssh-keygen of user_ca_key failed" 20 fail "ssh-keygen of user_ca_key failed"
18 21
19# Generate and sign user keys 22# Generate and sign user keys
20for ktype in rsa dsa $ecdsa ; do 23for ktype in $PLAIN_TYPES ; do
21 verbose "$tid: sign user ${ktype} cert" 24 verbose "$tid: sign user ${ktype} cert"
22 ${SSHKEYGEN} -q -N '' -t ${ktype} \ 25 ${SSHKEYGEN} -q -N '' -t ${ktype} \
23 -f $OBJ/cert_user_key_${ktype} || \ 26 -f $OBJ/cert_user_key_${ktype} || \
@@ -25,18 +28,18 @@ for ktype in rsa dsa $ecdsa ; do
25 ${SSHKEYGEN} -q -s $OBJ/user_ca_key -I "regress user key for $USER" \ 28 ${SSHKEYGEN} -q -s $OBJ/user_ca_key -I "regress user key for $USER" \
26 -z $$ -n ${USER},mekmitasdigoat $OBJ/cert_user_key_${ktype} || 29 -z $$ -n ${USER},mekmitasdigoat $OBJ/cert_user_key_${ktype} ||
27 fail "couldn't sign cert_user_key_${ktype}" 30 fail "couldn't sign cert_user_key_${ktype}"
28 # v00 ecdsa certs do not exist 31 type_has_legacy $ktype || continue
29 test "${ktype}" = "ecdsa" && continue
30 cp $OBJ/cert_user_key_${ktype} $OBJ/cert_user_key_${ktype}_v00 32 cp $OBJ/cert_user_key_${ktype} $OBJ/cert_user_key_${ktype}_v00
31 cp $OBJ/cert_user_key_${ktype}.pub $OBJ/cert_user_key_${ktype}_v00.pub 33 cp $OBJ/cert_user_key_${ktype}.pub $OBJ/cert_user_key_${ktype}_v00.pub
34 verbose "$tid: sign host ${ktype}_v00 cert"
32 ${SSHKEYGEN} -q -t v00 -s $OBJ/user_ca_key -I \ 35 ${SSHKEYGEN} -q -t v00 -s $OBJ/user_ca_key -I \
33 "regress user key for $USER" \ 36 "regress user key for $USER" \
34 -n ${USER},mekmitasdigoat $OBJ/cert_user_key_${ktype}_v00 || 37 -n ${USER},mekmitasdigoat $OBJ/cert_user_key_${ktype}_v00 ||
35 fail "couldn't sign cert_user_key_${ktype}_v00" 38 fatal "couldn't sign cert_user_key_${ktype}_v00"
36done 39done
37 40
38# Test explicitly-specified principals 41# Test explicitly-specified principals
39for ktype in rsa dsa $ecdsa rsa_v00 dsa_v00 ; do 42for ktype in $PLAIN_TYPES rsa_v00 dsa_v00 ; do
40 for privsep in yes no ; do 43 for privsep in yes no ; do
41 _prefix="${ktype} privsep $privsep" 44 _prefix="${ktype} privsep $privsep"
42 45
@@ -162,7 +165,7 @@ basic_tests() {
162 extra_sshd="TrustedUserCAKeys $OBJ/user_ca_key.pub" 165 extra_sshd="TrustedUserCAKeys $OBJ/user_ca_key.pub"
163 fi 166 fi
164 167
165 for ktype in rsa dsa $ecdsa rsa_v00 dsa_v00 ; do 168 for ktype in $PLAIN_TYPES rsa_v00 dsa_v00 ; do
166 for privsep in yes no ; do 169 for privsep in yes no ; do
167 _prefix="${ktype} privsep $privsep $auth" 170 _prefix="${ktype} privsep $privsep $auth"
168 # Simple connect 171 # Simple connect
@@ -332,7 +335,7 @@ test_one "principals key option no principals" failure "" \
332 335
333# Wrong certificate 336# Wrong certificate
334cat $OBJ/sshd_proxy_bak > $OBJ/sshd_proxy 337cat $OBJ/sshd_proxy_bak > $OBJ/sshd_proxy
335for ktype in rsa dsa $ecdsa rsa_v00 dsa_v00 ; do 338for ktype in $PLAIN_TYPES rsa_v00 dsa_v00 ; do
336 case $ktype in 339 case $ktype in
337 *_v00) args="-t v00" ;; 340 *_v00) args="-t v00" ;;
338 *) args="" ;; 341 *) args="" ;;