summaryrefslogtreecommitdiff
path: root/regress/usr.bin
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2013-04-18 02:46:13 +0000
committerDamien Miller <djm@cvs.openbsd.org>2013-04-18 02:46:13 +0000
commit2d61037896f7727bb63e4cdb6062455f5d06151e (patch)
tree7bb2cbffbeb223ac80c13463ee035dd6339946bd /regress/usr.bin
parentc9303de54cd3e9822485b683f0866732e6ae34a1 (diff)
test sshd ChrootDirectory+internal-sftp; feedback & ok dtucker@
Diffstat (limited to 'regress/usr.bin')
-rw-r--r--regress/usr.bin/ssh/Makefile6
-rw-r--r--regress/usr.bin/ssh/sftp-chroot.sh26
2 files changed, 31 insertions, 1 deletions
diff --git a/regress/usr.bin/ssh/Makefile b/regress/usr.bin/ssh/Makefile
index b0b8dd90062..7d84e6c4a71 100644
--- a/regress/usr.bin/ssh/Makefile
+++ b/regress/usr.bin/ssh/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.64 2013/04/07 02:16:03 dtucker Exp $
+# $OpenBSD: Makefile,v 1.65 2013/04/18 02:46:12 djm Exp $
REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t8 t9
@@ -31,6 +31,7 @@ LTESTS= connect \
key-options \
scp \
sftp \
+ sftp-chroot \
sftp-cmds \
sftp-badcmds \
sftp-batch \
@@ -75,6 +76,8 @@ CLEANFILES+= authorized_keys_${USER} known_hosts pidfile \
ssh.log failed-ssh.log sshd.log failed-sshd.log \
regress.log failed-regress.log ssh-log-wrapper.sh
+SUDO_CLEAN+= /var/run/testdata_${USER} /var/run/keycommand_${USER}
+
# Enable all malloc(3) randomisations and checks
TEST_ENV= "MALLOC_OPTIONS=AFGJPRX"
@@ -153,6 +156,7 @@ interop: ${INTEROP_TARGETS}
clean:
rm -f ${CLEANFILES}
+ test -z "${SUDO}" || ${SUDO} rm -f ${SUDO_CLEAN}
rm -rf .putty
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/ssh/sftp-chroot.sh b/regress/usr.bin/ssh/sftp-chroot.sh
new file mode 100644
index 00000000000..8c07979b4a0
--- /dev/null
+++ b/regress/usr.bin/ssh/sftp-chroot.sh
@@ -0,0 +1,26 @@
+# $OpenBSD: sftp-chroot.sh,v 1.1 2013/04/18 02:46:12 djm Exp $
+# Placed in the Public Domain.
+
+tid="sftp in chroot"
+
+COPY=${OBJ}/copy
+CHROOT=/var/run
+FILENAME=testdata_${USER}
+PRIVDATA=${CHROOT}/${FILENAME}
+
+if [ -z "$SUDO" ]; then
+ fatal "need SUDO to create file in /var/run, test won't work without"
+fi
+
+$SUDO sh -c "echo mekmitastdigoat > $PRIVDATA" || \
+ fatal "create $PRIVDATA failed"
+
+start_sshd -oChrootDirectory=$CHROOT -oForceCommand="internal-sftp -d /"
+
+verbose "test $tid: get"
+rm -f ${COPY}
+${SFTP} -qS "$SSH" -F $OBJ/ssh_config host:/${FILENAME} $COPY || \
+ fatal "Fetch ${FILENAME} failed"
+cmp $PRIVDATA $COPY || fail "$PRIVDATA $COPY differ"
+
+$SUDO rm $PRIVDATA