diff --git a/tests/run b/tests/run index dce27bd..b05c449 100755 --- a/tests/run +++ b/tests/run @@ -276,6 +276,41 @@ function testWriteAccessToAutocreatedDirs() { assertTrue "dir with spaces write access" $? } +function testWriteAccessToLimitedChroot() { + # Modified sshd_config with chrooted home subdir + tmpConfig="$(mktemp)" + sed 's/^ChrootDirectory.*/ChrootDirectory %h\/sftp/' \ + < "$testDir/../files/sshd_config" > "$tmpConfig" + + # Set correct permissions on chroot + tmpScript="$(mktemp)" + cat > "$tmpScript" < "$redirect" 2>&1 + + waitForServer "$containerName" + assertTrue "waitForServer" $? + + runSftpCommands "$containerName" "test" \ + "cd upload" \ + "mkdir test" \ + "exit" + assertTrue "runSftpCommands" $? + + docker exec "$containerName" test -d /home/test/sftp/upload/test + assertTrue "limited chroot write access" $? +} + function testBindmountDirScript() { mkdir -p "$containerTmpDir/custom/bindmount" echo "mkdir -p /home/custom/bindmount && \