diff options
author | Darren Tucker <dtucker@zip.com.au> | 2013-05-17 01:35:26 +0200 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2013-05-17 01:35:26 +0200 |
commit | f3568fc62b73b50a0a3c8447e4a00f4892cab25e (patch) | |
tree | 5c29466e83c15c43178437c795b65c981e87310b /regress/sftp-chroot.sh | |
parent | - dtucker@cvs.openbsd.org 2013/04/07 02:16:03 (diff) | |
download | openssh-f3568fc62b73b50a0a3c8447e4a00f4892cab25e.tar.xz openssh-f3568fc62b73b50a0a3c8447e4a00f4892cab25e.zip |
- 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 '')
-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 @@ +# $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 |