[openssh-commits] [openssh] 02/04: upstream: test ChrootDirectory in Match block

git+noreply at mindrot.org git+noreply at mindrot.org
Sun Jul 30 11:41:54 AEST 2023


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 8eb8899d612440a9b608bee7f916081d3d0b7812
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Fri May 12 06:37:42 2023 +0000

    upstream: test ChrootDirectory in Match block
    
    OpenBSD-Regress-ID: a6150262f39065939f025e546af2a346ffe674c1
---
 regress/sftp-chroot.sh | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/regress/sftp-chroot.sh b/regress/sftp-chroot.sh
index a7766fe6..8a301489 100644
--- a/regress/sftp-chroot.sh
+++ b/regress/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"
@@ -19,10 +19,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

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list