Hello All. As promised, here is what I needed to do to get the regression tests to work on AIX & HPUX. It goes into a bit of detail in the hope that others might be able to get them running on their platforms. I've run these mods on AIX 4.3.3, HP-UX 11.00, Solaris 8, Redhat 7.3 and OpenBSD 3.0. The problems I encountered: * prereqs (pmake, md5sum) * bad directory owner/mode causing auth failures * echo -n doesn't always work * some "id"'s don't know -n or -u * some platforms have no /dev/stdin * some tests AIX fails when sshd runs as non-root user * path problems I used Markus' run-tests.sh script as a starting point. This reduced the need for pmake. I got md5sum from GNU textutils. Useful pointers: md5sum: http://www.gnu.org/software/textutils/textutils.html [bp]make: http://www.crufty.net/ftp/pub/sjg/ While testing I turned up LogLevel to DEBUG for the sshd under test. This showed "bad ownership or modes for directory" in syslog. The regress directory and all of its parents must be owned by the testing user or root and must be mode 755 or stricter. (Some of mine were owned by bin and group writable). Some tests use "echo -n" for a echoing without newline. This left -n's in inconvenient places (eg known_hosts files). I created a "echon" function in the test driver "test-exec.sh" that will (hopefully) work everywhere. I replaced "id -nu" with "whoami". (Solaris' "id" doesn't know -u or -n). The sftp test uses /dev/stdin to send commands to sftp via the -b (batch) option. Some platforms (eg AIX & HP-UX) don't have /dev/stdin or equivalent. I moved the commands to a normal file. The call to loginrestricted() in auth.c fails when sshd is running as a non-root user. I added a "${SUDO}" to ssh_proxy's ProxyCommand. You'll need to define SUDO in test-exec.sh on AIX or some tests will fail. I had problems with paths, so I added more explicit ones. This may not be necessary. One other thing: do authorized_keys_root, copy.1 and copy.2 need to be in CVS? -- Darren Tucker (dtucker at zip.com.au) GPG Fingerprint D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69 Good judgement comes with experience. Unfortunately, the experience usually comes from bad judgement. -------------- next part -------------- Index: regress/Makefile ==================================================================RCS file: /cvs/openssh/regress/Makefile,v retrieving revision 1.1 diff -u -r1.1 Makefile --- regress/Makefile 1 May 2002 03:17:34 -0000 1.1 +++ regress/Makefile 22 Jul 2002 12:33:34 -0000 @@ -39,9 +39,10 @@ ssh-keygen -yf t2.out | diff - ${.CURDIR}/rsa_openssh.pub t3: - ssh-keygen -ef ${.CURDIR}/rsa_openssh.pub |\ - ssh-keygen -if /dev/stdin |\ + ssh-keygen -ef ${.CURDIR}/rsa_openssh.pub >${.CURDIR}/rsa_secsh.pub + ssh-keygen -if ${.CURDIR}/rsa_secsh.pub | \ diff - ${.CURDIR}/rsa_openssh.pub + rm -f ${.CURDIR}/rsa_secsh.pub t4: ssh-keygen -lf ${.CURDIR}/rsa_openssh.pub |\ Index: regress/runtests.sh ==================================================================RCS file: /cvs/openssh/regress/runtests.sh,v retrieving revision 1.1 diff -u -r1.1 runtests.sh --- regress/runtests.sh 1 May 2002 03:17:35 -0000 1.1 +++ regress/runtests.sh 22 Jul 2002 12:33:42 -0000 @@ -1,13 +1,45 @@ #!/bin/sh -TEST_SSH_SSH=../ssh -TEST_SSH_SSHD=../sshd -TEST_SSH_SSHAGENT=../ssh-agent -TEST_SSH_SSHADD=../ssh-add -TEST_SSH_SSHKEYGEN=../ssh-keygen -TEST_SSH_SSHKEYSCAN=../ssh-keyscan -TEST_SSH_SFTP=../sftp -TEST_SSH_SFTPSERVER=../sftp-server +pwd=`pwd` +bindir=`dirname $pwd` +PATH="$bindir:$PATH" +export PATH -pmake +TEST_SSH_TRACE=no # Enable for more detail in test +TEST_SSH_QUIET=no # Suppress status output +export TEST_SSH_TRACE TEST_SSH_QUIET +# Path to binaries to test +TEST_SSH_SSH=$bindir/ssh +TEST_SSH_SSHD=$bindir/sshd +TEST_SSH_SSHAGENT=$bindir/ssh-agent +TEST_SSH_SSHADD=$bindir/ssh-add +TEST_SSH_SSHKEYGEN=$bindir/ssh-keygen +TEST_SSH_SSHKEYSCAN=$bindir/ssh-keyscan +TEST_SSH_SFTP=$bindir/sftp +TEST_SSH_SFTPSERVER=$bindir/sftp-server +export TEST_SSH_SSH TEST_SSH_SSHD TEST_SSH_SSHAGENT TEST_SSH_SSHADD +export TEST_SSH_SSHKEYGEN TEST_SSH_SSHKEYSCAN TEST_SSH_SFTP TEST_SSH_SFTPSERVER + +if [ -x `which pmake` ]; then + pmake +else + for test in connect \ + proxy-connect \ + connect-privsep \ + proto-version \ + proto-mismatch \ + exit-status \ + transfer \ + stderr-data \ + stderr-after-eof \ + broken-pipe \ + try-ciphers \ + yes-head \ + agent \ + keyscan \ + sftp \ + forwarding ; do + sh test-exec.sh $pwd $pwd/${test}.sh + done +fi Index: regress/sftp.sh ==================================================================RCS file: /cvs/openssh/regress/sftp.sh,v retrieving revision 1.1 diff -u -r1.1 sftp.sh --- regress/sftp.sh 1 May 2002 03:17:35 -0000 1.1 +++ regress/sftp.sh 22 Jul 2002 12:33:42 -0000 @@ -6,6 +6,12 @@ DATA=/bin/ls COPY=${OBJ}/copy +cat >`pwd`/batch <<EOF +version +get $DATA ${COPY}.1 +put $DATA ${COPY}.2 +EOF + BUFFERSIZE="5 1000 32000 64000" REQUESTS="1 2 10" @@ -13,12 +19,8 @@ for R in ${REQUESTS}; do verbose "test $tid: buffer_size $B num_requests $R" rm -f ${COPY}.1 ${COPY}.2 - ${SFTP} -P ${SFTPSERVER} -B $B -R $R -b /dev/stdin \ - > /dev/null 2>&1 << EOF - version - get $DATA ${COPY}.1 - put $DATA ${COPY}.2 -EOF + ${SFTP} -P ${SFTPSERVER} -B $B -R $R -b `pwd`/batch \ + > /dev/null 2>&1 r=$? if [ $r -ne 0 ]; then fail "sftp failed with $r" @@ -27,3 +29,5 @@ cmp $DATA ${COPY}.2 || fail "corrupted copy after put" done done + +rm -f `pwd`/batch Index: regress/ssh-com.sh ==================================================================RCS file: /cvs/openssh/regress/ssh-com.sh,v retrieving revision 1.1 diff -u -r1.1 ssh-com.sh --- regress/ssh-com.sh 1 May 2002 03:17:35 -0000 1.1 +++ regress/ssh-com.sh 22 Jul 2002 12:33:42 -0000 @@ -63,7 +63,7 @@ # convert and append DSA hostkey ( - echo -n 'ssh2-localhost-with-alias,127.0.0.1,::1 ' + echon 'ssh2-localhost-with-alias,127.0.0.1,::1 ' ${SSHKEYGEN} -if ${SRC}/dsa_ssh2.pub ) >> $OBJ/known_hosts Index: regress/test-exec.sh ==================================================================RCS file: /cvs/openssh/regress/test-exec.sh,v retrieving revision 1.1 diff -u -r1.1 test-exec.sh --- regress/test-exec.sh 1 May 2002 03:17:35 -0000 1.1 +++ regress/test-exec.sh 22 Jul 2002 12:33:42 -0000 @@ -2,7 +2,7 @@ # Placed in the Public Domain. PORT=4242 -USER=`id -un` +USER=`whoami` SUDO #SUDO=sudo @@ -72,6 +72,18 @@ #echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER # helper +echon() +{ + if [ "x`echo -n`" = "x" ]; then + echo -n "$@" + elif [ "x`/bin/echo '\c'`" = "x" ]; then + /bin/echo "$@\c" + else + fatal "Don't know how to echo without newline." + fi + +} + cleanup () { if [ -f $PIDFILE ]; then @@ -111,7 +123,7 @@ fatal () { - echo -n "FATAL: " + echon "FATAL: " fail "$@" cleanup exit $RESULT @@ -169,7 +181,7 @@ # known hosts file for client ( - echo -n 'localhost-with-alias,127.0.0.1,::1 ' + echon 'localhost-with-alias,127.0.0.1,::1 ' cat $OBJ/$t.pub ) >> $OBJ/known_hosts @@ -189,7 +201,7 @@ # create a proxy version of the client config ( cat $OBJ/ssh_config - echo proxycommand ${SSHD} -i -f $OBJ/sshd_proxy + echo proxycommand ${SUDO} ${SSHD} -i -f $OBJ/sshd_proxy ) > $OBJ/ssh_proxy # check proxy config
On Mon, Jul 22, 2002 at 10:57:46PM +1000, Darren Tucker wrote:> As promised, here is what I needed to do to get the regression tests to > work on AIX & HPUX. It goes into a bit of detail in the hope that othersthx!> One other thing: do authorized_keys_root, copy.1 and copy.2 need to be > in CVS?no.> DATA=/bin/ls > COPY=${OBJ}/copy > > +cat >`pwd`/batch <<EOFplease use ${OBJ}/batch instead, ${OBJ} points to a temporary directory (or it should).> - echo proxycommand ${SSHD} -i -f $OBJ/sshd_proxy > + echo proxycommand ${SUDO} ${SSHD} -i -f $OBJ/sshd_proxysshd only works as 'root' for you? this is probably required for PAM. the ${SUDO} should not be necessary on all systems. -m
On Mon, Jul 22, 2002 at 10:57:46PM +1000, Darren Tucker wrote:> * prereqs (pmake, md5sum)md5 should just be needed to generate some random content for files. cp /dev/null ${DATA} for i in 1 2 3 4 5 6; do (date;echo $i) | md5 >> ${DATA} done md5 is not really needed.
Hello All, I want to test OpenSSH in HP-UX box.Regarding regression tests, do anyone have the test scripts. thanks in advance, Kumaresh.> Hello All. > As promised, here is what I needed to do to get the regression tests to > work on AIX & HPUX. It goes into a bit of detail in the hope that others > might be able to get them running on their platforms. I've run these > mods on AIX 4.3.3, HP-UX 11.00, Solaris 8, Redhat 7.3 and OpenBSD 3.0. > > The problems I encountered: > * prereqs (pmake, md5sum) > * bad directory owner/mode causing auth failures > * echo -n doesn't always work > * some "id"'s don't know -n or -u > * some platforms have no /dev/stdin > * some tests AIX fails when sshd runs as non-root user > * path problems > > I used Markus' run-tests.sh script as a starting point. This reduced > the need for pmake. I got md5sum from GNU textutils. Useful pointers: > md5sum: http://www.gnu.org/software/textutils/textutils.html > [bp]make: http://www.crufty.net/ftp/pub/sjg/ > > While testing I turned up LogLevel to DEBUG for the sshd under test. > This showed "bad ownership or modes for directory" in syslog. The > regress directory and all of its parents must be owned by the testing > user or root and must be mode 755 or stricter. (Some of mine were owned > by bin and group writable). > > Some tests use "echo -n" for a echoing without newline. This left -n's > in inconvenient places (eg known_hosts files). I created a "echon" > function in the test driver "test-exec.sh" that will (hopefully) work > everywhere. > > I replaced "id -nu" with "whoami". (Solaris' "id" doesn't know -u or > -n). > > The sftp test uses /dev/stdin to send commands to sftp via the -b > (batch) option. Some platforms (eg AIX & HP-UX) don't have /dev/stdin or > equivalent. I moved the commands to a normal file. > > The call to loginrestricted() in auth.c fails when sshd is running as a > non-root user. I added a "${SUDO}" to ssh_proxy's ProxyCommand. You'll > need to define SUDO in test-exec.sh on AIX or some tests will fail. > > I had problems with paths, so I added more explicit ones. This may not > be necessary. > > One other thing: do authorized_keys_root, copy.1 and copy.2 need to be > in CVS? > > -- > Darren Tucker (dtucker at zip.com.au) > GPG Fingerprint D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69 > Good judgement comes with experience. Unfortunately, the experience > usually comes from bad judgement.---------------------------------------------------------------------------- ----> Index: regress/Makefile > ==================================================================> RCS file: /cvs/openssh/regress/Makefile,v > retrieving revision 1.1 > diff -u -r1.1 Makefile > --- regress/Makefile 1 May 2002 03:17:34 -0000 1.1 > +++ regress/Makefile 22 Jul 2002 12:33:34 -0000 > @@ -39,9 +39,10 @@ > ssh-keygen -yf t2.out | diff - ${.CURDIR}/rsa_openssh.pub > > t3: > - ssh-keygen -ef ${.CURDIR}/rsa_openssh.pub |\ > - ssh-keygen -if /dev/stdin |\ > + ssh-keygen -ef ${.CURDIR}/rsa_openssh.pub >${.CURDIR}/rsa_secsh.pub > + ssh-keygen -if ${.CURDIR}/rsa_secsh.pub | \ > diff - ${.CURDIR}/rsa_openssh.pub > + rm -f ${.CURDIR}/rsa_secsh.pub > > t4: > ssh-keygen -lf ${.CURDIR}/rsa_openssh.pub |\ > Index: regress/runtests.sh > ==================================================================> RCS file: /cvs/openssh/regress/runtests.sh,v > retrieving revision 1.1 > diff -u -r1.1 runtests.sh > --- regress/runtests.sh 1 May 2002 03:17:35 -0000 1.1 > +++ regress/runtests.sh 22 Jul 2002 12:33:42 -0000 > @@ -1,13 +1,45 @@ > #!/bin/sh > > -TEST_SSH_SSH=../ssh > -TEST_SSH_SSHD=../sshd > -TEST_SSH_SSHAGENT=../ssh-agent > -TEST_SSH_SSHADD=../ssh-add > -TEST_SSH_SSHKEYGEN=../ssh-keygen > -TEST_SSH_SSHKEYSCAN=../ssh-keyscan > -TEST_SSH_SFTP=../sftp > -TEST_SSH_SFTPSERVER=../sftp-server > +pwd=`pwd` > +bindir=`dirname $pwd` > +PATH="$bindir:$PATH" > +export PATH > > -pmake > +TEST_SSH_TRACE=no # Enable for more detail in test > +TEST_SSH_QUIET=no # Suppress status output > +export TEST_SSH_TRACE TEST_SSH_QUIET > > +# Path to binaries to test > +TEST_SSH_SSH=$bindir/ssh > +TEST_SSH_SSHD=$bindir/sshd > +TEST_SSH_SSHAGENT=$bindir/ssh-agent > +TEST_SSH_SSHADD=$bindir/ssh-add > +TEST_SSH_SSHKEYGEN=$bindir/ssh-keygen > +TEST_SSH_SSHKEYSCAN=$bindir/ssh-keyscan > +TEST_SSH_SFTP=$bindir/sftp > +TEST_SSH_SFTPSERVER=$bindir/sftp-server > +export TEST_SSH_SSH TEST_SSH_SSHD TEST_SSH_SSHAGENT TEST_SSH_SSHADD > +export TEST_SSH_SSHKEYGEN TEST_SSH_SSHKEYSCAN TEST_SSH_SFTPTEST_SSH_SFTPSERVER> + > +if [ -x `which pmake` ]; then > + pmake > +else > + for test in connect \ > + proxy-connect \ > + connect-privsep \ > + proto-version \ > + proto-mismatch \ > + exit-status \ > + transfer \ > + stderr-data \ > + stderr-after-eof \ > + broken-pipe \ > + try-ciphers \ > + yes-head \ > + agent \ > + keyscan \ > + sftp \ > + forwarding ; do > + sh test-exec.sh $pwd $pwd/${test}.sh > + done > +fi > Index: regress/sftp.sh > ==================================================================> RCS file: /cvs/openssh/regress/sftp.sh,v > retrieving revision 1.1 > diff -u -r1.1 sftp.sh > --- regress/sftp.sh 1 May 2002 03:17:35 -0000 1.1 > +++ regress/sftp.sh 22 Jul 2002 12:33:42 -0000 > @@ -6,6 +6,12 @@ > DATA=/bin/ls > COPY=${OBJ}/copy > > +cat >`pwd`/batch <<EOF > +version > +get $DATA ${COPY}.1 > +put $DATA ${COPY}.2 > +EOF > + > BUFFERSIZE="5 1000 32000 64000" > REQUESTS="1 2 10" > > @@ -13,12 +19,8 @@ > for R in ${REQUESTS}; do > verbose "test $tid: buffer_size $B num_requests $R" > rm -f ${COPY}.1 ${COPY}.2 > - ${SFTP} -P ${SFTPSERVER} -B $B -R $R -b /dev/stdin \ > - > /dev/null 2>&1 << EOF > - version > - get $DATA ${COPY}.1 > - put $DATA ${COPY}.2 > -EOF > + ${SFTP} -P ${SFTPSERVER} -B $B -R $R -b `pwd`/batch \ > + > /dev/null 2>&1 > r=$? > if [ $r -ne 0 ]; then > fail "sftp failed with $r" > @@ -27,3 +29,5 @@ > cmp $DATA ${COPY}.2 || fail "corrupted copy after put" > done > done > + > +rm -f `pwd`/batch > Index: regress/ssh-com.sh > ==================================================================> RCS file: /cvs/openssh/regress/ssh-com.sh,v > retrieving revision 1.1 > diff -u -r1.1 ssh-com.sh > --- regress/ssh-com.sh 1 May 2002 03:17:35 -0000 1.1 > +++ regress/ssh-com.sh 22 Jul 2002 12:33:42 -0000 > @@ -63,7 +63,7 @@ > > # convert and append DSA hostkey > ( > - echo -n 'ssh2-localhost-with-alias,127.0.0.1,::1 ' > + echon 'ssh2-localhost-with-alias,127.0.0.1,::1 ' > ${SSHKEYGEN} -if ${SRC}/dsa_ssh2.pub > ) >> $OBJ/known_hosts > > Index: regress/test-exec.sh > ==================================================================> RCS file: /cvs/openssh/regress/test-exec.sh,v > retrieving revision 1.1 > diff -u -r1.1 test-exec.sh > --- regress/test-exec.sh 1 May 2002 03:17:35 -0000 1.1 > +++ regress/test-exec.sh 22 Jul 2002 12:33:42 -0000 > @@ -2,7 +2,7 @@ > # Placed in the Public Domain. > > PORT=4242 > -USER=`id -un` > +USER=`whoami` > SUDO> #SUDO=sudo > > @@ -72,6 +72,18 @@ > #echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP$SFTPSERVER> > # helper > +echon() > +{ > + if [ "x`echo -n`" = "x" ]; then > + echo -n "$@" > + elif [ "x`/bin/echo '\c'`" = "x" ]; then > + /bin/echo "$@\c" > + else > + fatal "Don't know how to echo without newline." > + fi > + > +} > + > cleanup () > { > if [ -f $PIDFILE ]; then > @@ -111,7 +123,7 @@ > > fatal () > { > - echo -n "FATAL: " > + echon "FATAL: " > fail "$@" > cleanup > exit $RESULT > @@ -169,7 +181,7 @@ > > # known hosts file for client > ( > - echo -n 'localhost-with-alias,127.0.0.1,::1 ' > + echon 'localhost-with-alias,127.0.0.1,::1 ' > cat $OBJ/$t.pub > ) >> $OBJ/known_hosts > > @@ -189,7 +201,7 @@ > # create a proxy version of the client config > ( > cat $OBJ/ssh_config > - echo proxycommand ${SSHD} -i -f $OBJ/sshd_proxy > + echo proxycommand ${SUDO} ${SSHD} -i -f $OBJ/sshd_proxy > ) > $OBJ/ssh_proxy > > # check proxy config > > >
Roumen.Petrov at skalasoft.com
2002-Jul-23 11:58 UTC
[Patch] Improve portability of regression tests
> > >On Mon, Jul 22, 2002 at 10:57:46PM +1000, Darren Tucker wrote: >> * prereqs (pmake, md5sum) > >md5 should just be needed to generate some random content >for files. >OpenSSH use openssl. To genarate random content we can use "openssl rand <NUMBER_OF_BYTES>".> >cp /dev/null ${DATA} >for i in 1 2 3 4 5 6; do > (date;echo $i) | md5 >> ${DATA} >done > > >md5 is not really needed. >
On Tue, 23 Jul 2002 Roumen.Petrov at skalasoft.com wrote:> >On Mon, Jul 22, 2002 at 10:57:46PM +1000, Darren Tucker wrote: > >> * prereqs (pmake, md5sum) > > > >md5 should just be needed to generate some random content > >for files. > > > > OpenSSH use openssl. To genarate random content we can use "openssl rand > <NUMBER_OF_BYTES>".Wasting OpenSSL randomness may be a bit overkill here. After all, the output does not have to be randomly "secure". -- Pekka Savola "Tell me of difficulties surmounted, Netcore Oy not those you stumble over and fall" Systems. Networks. Security. -- Robert Jordan: A Crown of Swords
yes, you could use> > (date;echo $i) | openssl md5 >> ${DATA}
Roumen.Petrov at skalasoft.com
2002-Jul-25 13:22 UTC
[Patch] Improve portability of regression tests - version 2
OpenBSD patch: http://satva.skalasoft.com/~rumen/openssh/temp/regress-openbsd.diff.gz About new patch: - "echo -n ..." is relpased with "echon" function - "id -n..." changed witch "whoami" - "md5sum" in stderr-after-eof.sh => "openssl md5" - Makefile is more common (not only for pmake) - AuthorizedKeysFile is "$HOME/.ssh/authorized_keys_test_$USER" and new variable AUTHORIZED_KEYS_FILE is defined (fix problem with directory permitions) - test "sshd_config" contain line: "Subsystem sftp $SFTPSERVER" - point to newbuild. Tips for portable version: a.) get regress from openbsd cvs: CVS_RSH=ssh cvs -d anoncvs at anoncvs.be.openbsd.org:/cvs get src/regress/usr.bin/ssh b.) apply patch c.) get portable from cvs d.) replace conntent of regress directory with content of openbsd (see point a.) e.) patch portable "Makefile.in" with http://satva.skalasoft.com/~rumen/openssh/temp/regress-portable.diff.gz f.) run: ./configure [options] make make tests ..... NOTES: - (sample): make tests LTESTS="sftp regress" with run all targets t1-t7 defined in regress Makefile plus only "sftp.sh" and "regress.sh" tests. Work around is to move commands from makefile to shell scripts. - first argument of "test-exec.sh" must be absolute path otherwise script (I too) cannot found pidfile.
Markus Friedl
2002-Jul-26 14:41 UTC
[Patch] Improve portability of regression tests - version 2
On Thu, Jul 25, 2002 at 04:22:00PM +0300, Roumen.Petrov at skalasoft.com wrote:> - test "sshd_config" contain line: "Subsystem sftp $SFTPSERVER" -ok, but what test is using this? -m
Roumen.Petrov at skalasoft.com
2002-Jul-29 12:27 UTC
[Patch] Improve portability of regression tests - version 2
Markus Friedl wrote:>On Thu, Jul 25, 2002 at 04:22:00PM +0300, Roumen.Petrov at skalasoft.com wrote: > > >>- test "sshd_config" contain line: "Subsystem sftp $SFTPSERVER" - >> >> > >ok, but what test is using this? >currently sftp.sh call sftp with -P option => we can skip "Subsystem sftp ..." in sshd_config but with Subsystem option test environment is more clean and point to bulld executable, not to installed.