[multiplex.sh test-exec.sh sshd-log-wrapper.sh]
     Add optional capability to log output from regress commands; ok markus@
     Use with: make TEST_SSH_LOGFILE=/tmp/regress.log
This commit is contained in:
Darren Tucker 2005-03-07 18:33:02 +11:00
parent b712fccc18
commit a0f3ba71a0
4 changed files with 36 additions and 8 deletions

View File

@ -8,6 +8,10 @@
- david@cvs.openbsd.org 2005/01/14 04:21:18
[Makefile test-exec.sh]
pass the SUDO make variable to the individual sh tests; ok dtucker@ markus@
- dtucker@cvs.openbsd.org 2005/02/27 11:33:30
[multiplex.sh test-exec.sh sshd-log-wrapper.sh]
Add optional capability to log output from regress commands; ok markus@
Use with: make TEST_SSH_LOGFILE=/tmp/regress.log
20050306
- (dtucker) [monitor.c] Bug #125 comment #47: fix errors returned by monitor
@ -2294,4 +2298,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
$Id: ChangeLog,v 1.3697 2005/03/07 07:27:28 dtucker Exp $
$Id: ChangeLog,v 1.3698 2005/03/07 07:33:02 dtucker Exp $

View File

@ -1,4 +1,4 @@
# $OpenBSD: multiplex.sh,v 1.9 2004/11/07 00:32:41 djm Exp $
# $OpenBSD: multiplex.sh,v 1.10 2005/02/27 11:33:30 dtucker Exp $
# Placed in the Public Domain.
CTL=$OBJ/ctl-sock
@ -13,6 +13,7 @@ fi
DATA=/bin/ls${EXEEXT}
COPY=$OBJ/ls.copy
LOG=$TEST_SSH_LOGFILE
start_sshd
@ -48,13 +49,13 @@ cmp ${DATA} ${COPY} || fail "ssh -S ctl: corrupted copy of ${DATA}"
rm -f ${COPY}
trace "sftp transfer over multiplexed connection and check result"
echo "get ${DATA} ${COPY}" | \
${SFTP} -S ${SSH} -oControlPath=$CTL otherhost >/dev/null 2>&1
${SFTP} -S ${SSH} -oControlPath=$CTL otherhost >$LOG 2>&1
test -f ${COPY} || fail "sftp: failed copy ${DATA}"
cmp ${DATA} ${COPY} || fail "sftp: corrupted copy of ${DATA}"
rm -f ${COPY}
trace "scp transfer over multiplexed connection and check result"
${SCP} -S ${SSH} -oControlPath=$CTL otherhost:${DATA} ${COPY} >/dev/null 2>&1
${SCP} -S ${SSH} -oControlPath=$CTL otherhost:${DATA} ${COPY} >$LOG 2>&1
test -f ${COPY} || fail "scp: failed copy ${DATA}"
cmp ${DATA} ${COPY} || fail "scp: corrupted copy of ${DATA}"

View File

@ -0,0 +1,13 @@
#!/bin/sh
# $OpenBSD: sshd-log-wrapper.sh,v 1.2 2005/02/27 11:40:30 dtucker Exp $
# Placed in the Public Domain.
#
# simple wrapper for sshd proxy mode to catch stderr output
# sh sshd-log-wrapper.sh /path/to/sshd /path/to/logfile
sshd=$1
log=$2
shift
shift
exec $sshd $@ -e 2>>$log

View File

@ -1,4 +1,4 @@
# $OpenBSD: test-exec.sh,v 1.26 2005/01/14 04:21:18 david Exp $
# $OpenBSD: test-exec.sh,v 1.27 2005/02/27 11:33:30 dtucker Exp $
# Placed in the Public Domain.
#SUDO=sudo
@ -47,6 +47,8 @@ else
fi
unset SSH_AUTH_SOCK
SRC=`dirname ${SCRIPT}`
# defaults
SSH=ssh
SSHD=sshd
@ -91,6 +93,10 @@ if [ ! -x /$SSHD ]; then
SSHD=`which sshd`
fi
if [ "x$TEST_SSH_LOGFILE" = "x" ]; then
TEST_SSH_LOGFILE=/dev/null
fi
# these should be used in tests
export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER SCP
#echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER $SCP
@ -140,6 +146,7 @@ cleanup ()
trace ()
{
echo "trace: $@" >>$TEST_SSH_LOGFILE
if [ "X$TEST_SSH_TRACE" = "Xyes" ]; then
echo "$@"
fi
@ -147,6 +154,7 @@ trace ()
verbose ()
{
echo "verbose: $@" >>$TEST_SSH_LOGFILE
if [ "X$TEST_SSH_QUIET" != "Xyes" ]; then
echo "$@"
fi
@ -155,12 +163,14 @@ verbose ()
fail ()
{
echo "FAIL: $@" >>$TEST_SSH_LOGFILE
RESULT=1
echo "$@"
}
fatal ()
{
echo "FATAL: $@" >>$TEST_SSH_LOGFILE
echon "FATAL: "
fail "$@"
cleanup
@ -180,7 +190,7 @@ cat << EOF > $OBJ/sshd_config
#ListenAddress ::1
PidFile $PIDFILE
AuthorizedKeysFile $OBJ/authorized_keys_%u
LogLevel QUIET
LogLevel DEBUG
AcceptEnv _XXX_TEST_*
AcceptEnv _XXX_TEST
Subsystem sftp $SFTPSERVER
@ -251,7 +261,7 @@ chmod 644 $OBJ/authorized_keys_$USER
# create a proxy version of the client config
(
cat $OBJ/ssh_config
echo proxycommand ${SUDO} ${SSHD} -i -f $OBJ/sshd_proxy
echo proxycommand sh ${SRC}/sshd-log-wrapper.sh ${SUDO} ${SSHD} ${TEST_SSH_LOGFILE} -i -f $OBJ/sshd_proxy
) > $OBJ/ssh_proxy
# check proxy config
@ -261,7 +271,7 @@ start_sshd ()
{
# start sshd
$SUDO ${SSHD} -f $OBJ/sshd_config -t || fatal "sshd_config broken"
$SUDO ${SSHD} -f $OBJ/sshd_config
$SUDO ${SSHD} -f $OBJ/sshd_config -e >>$TEST_SSH_LOGFILE 2>&1
trace "wait for sshd"
i=0;