diff options
author | Darren Tucker <dtucker@cvs.openbsd.org> | 2019-09-06 04:24:07 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@cvs.openbsd.org> | 2019-09-06 04:24:07 +0000 |
commit | bb190f41db2e37f97c78bd6cccc26fea2e3a8b3b (patch) | |
tree | ce7920de93c21762ff67844296e7273e0463df88 /regress/usr.bin | |
parent | 96e229bd6e90590667f080001729689edd01b1e6 (diff) |
Check for RSA support before using it for the user key, otherwise use
ed25519 which is supported when built without OpenSSL.
Diffstat (limited to 'regress/usr.bin')
-rw-r--r-- | regress/usr.bin/ssh/principals-command.sh | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/regress/usr.bin/ssh/principals-command.sh b/regress/usr.bin/ssh/principals-command.sh index abf511fceb7..b3a722aaa79 100644 --- a/regress/usr.bin/ssh/principals-command.sh +++ b/regress/usr.bin/ssh/principals-command.sh @@ -1,4 +1,4 @@ -# $OpenBSD: principals-command.sh,v 1.6 2018/11/22 08:48:32 dtucker Exp $ +# $OpenBSD: principals-command.sh,v 1.7 2019/09/06 04:24:06 dtucker Exp $ # Placed in the Public Domain. tid="authorized principals command" @@ -10,12 +10,17 @@ if [ -z "$SUDO" -a ! -w /var/run ]; then fatal "need SUDO to create file in /var/run, test won't work without" fi +case "`${SSH} -Q key-plain`" in + *ssh-rsa*) userkeytype=rsa ;; + *) userkeytype=ed25519 ;; +esac + SERIAL=$$ # Create a CA key and a user certificate. ${SSHKEYGEN} -q -N '' -t ed25519 -f $OBJ/user_ca_key || \ fatal "ssh-keygen of user_ca_key failed" -${SSHKEYGEN} -q -N '' -t rsa -f $OBJ/cert_user_key || \ +${SSHKEYGEN} -q -N '' -t ${userkeytype} -f $OBJ/cert_user_key || \ fatal "ssh-keygen of cert_user_key failed" ${SSHKEYGEN} -q -s $OBJ/user_ca_key -I "Joanne User" \ -z $$ -n ${USER},mekmitasdigoat $OBJ/cert_user_key || \ @@ -33,7 +38,7 @@ trap "$SUDO rm -f ${PRINCIPALS_COMMAND}" 0 cat << _EOF | $SUDO sh -c "cat > '$PRINCIPALS_COMMAND'" #!/bin/sh test "x\$1" != "x${LOGNAME}" && exit 1 -test "x\$2" != "xssh-rsa-cert-v01@openssh.com" && exit 1 +test "x\$2" != "xssh-${userkeytype}-cert-v01@openssh.com" && exit 1 test "x\$3" != "xssh-ed25519" && exit 1 test "x\$4" != "xJoanne User" && exit 1 test "x\$5" != "x${SERIAL}" && exit 1 |