diff options
author | markus@openbsd.org <markus@openbsd.org> | 2015-03-03 22:35:19 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2015-03-05 05:59:47 +1100 |
commit | dad2b1892b4c1b7e58df483a8c5b983c4454e099 (patch) | |
tree | fa461e273ef92414c934a88cc88b2875032e616f /regress/test-exec.sh | |
parent | d48a22601bdd3eec054794c535f4ae8d8ae4c6e2 (diff) |
upstream commit
make it possible to run tests w/o ssh1 support; ok djm@
Diffstat (limited to 'regress/test-exec.sh')
-rw-r--r-- | regress/test-exec.sh | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/regress/test-exec.sh b/regress/test-exec.sh index ff0768a04..12ba094a9 100644 --- a/regress/test-exec.sh +++ b/regress/test-exec.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: test-exec.sh,v 1.48 2014/07/06 07:42:03 djm Exp $ | 1 | # $OpenBSD: test-exec.sh,v 1.51 2015/03/03 22:35:19 markus Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | #SUDO=sudo | 4 | #SUDO=sudo |
@@ -130,6 +130,11 @@ if [ "x$TEST_SSH_CONCH" != "x" ]; then | |||
130 | esac | 130 | esac |
131 | fi | 131 | fi |
132 | 132 | ||
133 | SSH_PROTOCOLS=`$SSH -Q protocol-version` | ||
134 | if [ "x$TEST_SSH_PROTOCOLS" != "x" ]; then | ||
135 | SSH_PROTOCOLS="${TEST_SSH_PROTOCOLS}" | ||
136 | fi | ||
137 | |||
133 | # Path to sshd must be absolute for rexec | 138 | # Path to sshd must be absolute for rexec |
134 | case "$SSHD" in | 139 | case "$SSHD" in |
135 | /*) ;; | 140 | /*) ;; |
@@ -374,16 +379,27 @@ fatal () | |||
374 | exit $RESULT | 379 | exit $RESULT |
375 | } | 380 | } |
376 | 381 | ||
382 | ssh_version () | ||
383 | { | ||
384 | echo ${SSH_PROTOCOLS} | grep -q "$1" | ||
385 | } | ||
386 | |||
377 | RESULT=0 | 387 | RESULT=0 |
378 | PIDFILE=$OBJ/pidfile | 388 | PIDFILE=$OBJ/pidfile |
379 | 389 | ||
380 | trap fatal 3 2 | 390 | trap fatal 3 2 |
381 | 391 | ||
392 | if ssh_version 1; then | ||
393 | PROTO="2,1" | ||
394 | else | ||
395 | PROTO="2" | ||
396 | fi | ||
397 | |||
382 | # create server config | 398 | # create server config |
383 | cat << EOF > $OBJ/sshd_config | 399 | cat << EOF > $OBJ/sshd_config |
384 | StrictModes no | 400 | StrictModes no |
385 | Port $PORT | 401 | Port $PORT |
386 | Protocol 2,1 | 402 | Protocol $PROTO |
387 | AddressFamily inet | 403 | AddressFamily inet |
388 | ListenAddress 127.0.0.1 | 404 | ListenAddress 127.0.0.1 |
389 | #ListenAddress ::1 | 405 | #ListenAddress ::1 |
@@ -409,7 +425,7 @@ echo 'StrictModes no' >> $OBJ/sshd_proxy | |||
409 | # create client config | 425 | # create client config |
410 | cat << EOF > $OBJ/ssh_config | 426 | cat << EOF > $OBJ/ssh_config |
411 | Host * | 427 | Host * |
412 | Protocol 2,1 | 428 | Protocol $PROTO |
413 | Hostname 127.0.0.1 | 429 | Hostname 127.0.0.1 |
414 | HostKeyAlias localhost-with-alias | 430 | HostKeyAlias localhost-with-alias |
415 | Port $PORT | 431 | Port $PORT |
@@ -434,8 +450,13 @@ fi | |||
434 | 450 | ||
435 | rm -f $OBJ/known_hosts $OBJ/authorized_keys_$USER | 451 | rm -f $OBJ/known_hosts $OBJ/authorized_keys_$USER |
436 | 452 | ||
453 | if ssh_version 1; then | ||
454 | SSH_KEYTYPES="rsa rsa1" | ||
455 | else | ||
456 | SSH_KEYTYPES="rsa ed25519" | ||
457 | fi | ||
437 | trace "generate keys" | 458 | trace "generate keys" |
438 | for t in rsa rsa1; do | 459 | for t in ${SSH_KEYTYPES}; do |
439 | # generate user key | 460 | # generate user key |
440 | if [ ! -f $OBJ/$t ] || [ ${SSHKEYGEN_BIN} -nt $OBJ/$t ]; then | 461 | if [ ! -f $OBJ/$t ] || [ ${SSHKEYGEN_BIN} -nt $OBJ/$t ]; then |
441 | rm -f $OBJ/$t | 462 | rm -f $OBJ/$t |