diff options
author | Darren Tucker <dtucker@zip.com.au> | 2013-05-17 09:35:26 +1000 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2013-05-17 09:35:26 +1000 |
commit | f3568fc62b73b50a0a3c8447e4a00f4892cab25e (patch) | |
tree | 5c29466e83c15c43178437c795b65c981e87310b | |
parent | dfea3bcdd7c980c2335402464b7dd8d8721e426d (diff) |
- djm@cvs.openbsd.org 2013/04/18 02:46:12
[Makefile regress/sftp-chroot.sh]
test sshd ChrootDirectory+internal-sftp; feedback & ok dtucker@
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | regress/Makefile | 6 | ||||
-rw-r--r-- | regress/sftp-chroot.sh | 26 |
3 files changed, 34 insertions, 1 deletions
@@ -21,6 +21,9 @@ | |||
21 | save the output from any failing tests. If a test fails the debug output | 21 | save the output from any failing tests. If a test fails the debug output |
22 | from ssh and sshd for the failing tests (and only the failing tests) should | 22 | from ssh and sshd for the failing tests (and only the failing tests) should |
23 | be available in failed-ssh{,d}.log. | 23 | be available in failed-ssh{,d}.log. |
24 | - djm@cvs.openbsd.org 2013/04/18 02:46:12 | ||
25 | [Makefile regress/sftp-chroot.sh] | ||
26 | test sshd ChrootDirectory+internal-sftp; feedback & ok dtucker@ | ||
24 | 27 | ||
25 | 20130516 | 28 | 20130516 |
26 | - (djm) [contrib/ssh-copy-id] Fix bug that could cause "rm *" to be | 29 | - (djm) [contrib/ssh-copy-id] Fix bug that could cause "rm *" to be |
diff --git a/regress/Makefile b/regress/Makefile index 4ac5b4d42..b19c7ae22 100644 --- a/regress/Makefile +++ b/regress/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.64 2013/04/07 02:16:03 dtucker Exp $ | 1 | # $OpenBSD: Makefile,v 1.65 2013/04/18 02:46:12 djm Exp $ |
2 | 2 | ||
3 | REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t8 t9 t-exec | 3 | REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t8 t9 t-exec |
4 | tests: $(REGRESS_TARGETS) | 4 | tests: $(REGRESS_TARGETS) |
@@ -8,6 +8,7 @@ interop interop-tests: t-exec-interop | |||
8 | 8 | ||
9 | clean: | 9 | clean: |
10 | for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done | 10 | for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done |
11 | test -z "${SUDO}" || ${SUDO} rm -f ${SUDO_CLEAN} | ||
11 | rm -rf $(OBJ).putty | 12 | rm -rf $(OBJ).putty |
12 | 13 | ||
13 | distclean: clean | 14 | distclean: clean |
@@ -38,6 +39,7 @@ LTESTS= connect \ | |||
38 | key-options \ | 39 | key-options \ |
39 | scp \ | 40 | scp \ |
40 | sftp \ | 41 | sftp \ |
42 | sftp-chroot \ | ||
41 | sftp-cmds \ | 43 | sftp-cmds \ |
42 | sftp-badcmds \ | 44 | sftp-badcmds \ |
43 | sftp-batch \ | 45 | sftp-batch \ |
@@ -86,6 +88,8 @@ CLEANFILES= t2.out t3.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \ | |||
86 | ssh.log failed-ssh.log sshd.log failed-sshd.log \ | 88 | ssh.log failed-ssh.log sshd.log failed-sshd.log \ |
87 | regress.log failed-regress.log ssh-log-wrapper.sh | 89 | regress.log failed-regress.log ssh-log-wrapper.sh |
88 | 90 | ||
91 | SUDO_CLEAN+= /var/run/testdata_${USER} /var/run/keycommand_${USER} | ||
92 | |||
89 | # Enable all malloc(3) randomisations and checks | 93 | # Enable all malloc(3) randomisations and checks |
90 | TEST_ENV= "MALLOC_OPTIONS=AFGJPRX" | 94 | TEST_ENV= "MALLOC_OPTIONS=AFGJPRX" |
91 | 95 | ||
diff --git a/regress/sftp-chroot.sh b/regress/sftp-chroot.sh new file mode 100644 index 000000000..8c07979b4 --- /dev/null +++ b/regress/sftp-chroot.sh | |||
@@ -0,0 +1,26 @@ | |||
1 | # $OpenBSD: sftp-chroot.sh,v 1.1 2013/04/18 02:46:12 djm Exp $ | ||
2 | # Placed in the Public Domain. | ||
3 | |||
4 | tid="sftp in chroot" | ||
5 | |||
6 | COPY=${OBJ}/copy | ||
7 | CHROOT=/var/run | ||
8 | FILENAME=testdata_${USER} | ||
9 | PRIVDATA=${CHROOT}/${FILENAME} | ||
10 | |||
11 | if [ -z "$SUDO" ]; then | ||
12 | fatal "need SUDO to create file in /var/run, test won't work without" | ||
13 | fi | ||
14 | |||
15 | $SUDO sh -c "echo mekmitastdigoat > $PRIVDATA" || \ | ||
16 | fatal "create $PRIVDATA failed" | ||
17 | |||
18 | start_sshd -oChrootDirectory=$CHROOT -oForceCommand="internal-sftp -d /" | ||
19 | |||
20 | verbose "test $tid: get" | ||
21 | rm -f ${COPY} | ||
22 | ${SFTP} -qS "$SSH" -F $OBJ/ssh_config host:/${FILENAME} $COPY || \ | ||
23 | fatal "Fetch ${FILENAME} failed" | ||
24 | cmp $PRIVDATA $COPY || fail "$PRIVDATA $COPY differ" | ||
25 | |||
26 | $SUDO rm $PRIVDATA | ||