diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2023-05-12 06:37:43 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2023-05-12 06:37:43 +0000 |
commit | aa69316e8d62c130da86729fe0f2a58a92e9320f (patch) | |
tree | 0a74e00415538c1ebbd3bd52c2609ad81bb20f84 /regress | |
parent | e10064be9ea27daabee66a565b3e270f40307046 (diff) |
test ChrootDirectory in Match block
Diffstat (limited to 'regress')
-rw-r--r-- | regress/usr.bin/ssh/sftp-chroot.sh | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/regress/usr.bin/ssh/sftp-chroot.sh b/regress/usr.bin/ssh/sftp-chroot.sh index f9a7743eaa9..5dc360f57d1 100644 --- a/regress/usr.bin/ssh/sftp-chroot.sh +++ b/regress/usr.bin/ssh/sftp-chroot.sh @@ -1,4 +1,4 @@ -# $OpenBSD: sftp-chroot.sh,v 1.8 2021/09/01 00:50:27 dtucker Exp $ +# $OpenBSD: sftp-chroot.sh,v 1.9 2023/05/12 06:37:42 djm Exp $ # Placed in the Public Domain. tid="sftp in chroot" @@ -15,10 +15,29 @@ fi $SUDO sh -c "echo mekmitastdigoat > $PRIVDATA" || \ fatal "create $PRIVDATA failed" -start_sshd -oChrootDirectory=$CHROOT -oForceCommand="internal-sftp -d /" +echo "ForceCommand internal-sftp -d /" >> $OBJ/sshd_config + +start_sshd -oChrootDirectory=$CHROOT verbose "test $tid: get" ${SFTP} -S "$SSH" -F $OBJ/ssh_config host:/${FILENAME} $COPY \ >>$TEST_REGRESS_LOGFILE 2>&1 || \ fatal "Fetch ${FILENAME} failed" cmp $PRIVDATA $COPY || fail "$PRIVDATA $COPY differ" + +stop_sshd + +verbose "test $tid: match" +cat << EOF >> $OBJ/sshd_config +Match All + ChrootDirectory $CHROOT +EOF +start_sshd +$SUDO sh -c "echo orpheanbeholder > $PRIVDATA" || \ + fatal "create $PRIVDATA failed" +${SFTP} -S "$SSH" -F $OBJ/ssh_config host:/${FILENAME} $COPY \ + >>$TEST_REGRESS_LOGFILE 2>&1 || \ + fatal "Fetch ${FILENAME} failed" +cmp $PRIVDATA $COPY || fail "$PRIVDATA $COPY differ" + +stop_sshd |