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 /regress/sftp-chroot.sh | |
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@
Diffstat (limited to 'regress/sftp-chroot.sh')
-rw-r--r-- | regress/sftp-chroot.sh | 26 |
1 files changed, 26 insertions, 0 deletions
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 | ||