summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2020-01-23 03:42:41 +0000
committerDarren Tucker <dtucker@dtucker.net>2020-01-23 15:49:09 +1100
commit7e1323102b1b04eef391b01e180710a2d408a7ab (patch)
tree5673b29371ed23cd997566971ae93c0bd60f7d06 /regress
parent84de1c27f845d15c859db44e7070a46f45504b66 (diff)
upstream: Check for and warn about StrictModes permission problems. ok tb@
OpenBSD-Regress-ID: 4841704ccdee50ee7efc6035bc686695c6ac2991
Diffstat (limited to 'regress')
-rw-r--r--regress/test-exec.sh25
1 files changed, 24 insertions, 1 deletions
diff --git a/regress/test-exec.sh b/regress/test-exec.sh
index b448192e1..c26e47f7f 100644
--- a/regress/test-exec.sh
+++ b/regress/test-exec.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: test-exec.sh,v 1.70 2020/01/21 08:06:27 djm Exp $ 1# $OpenBSD: test-exec.sh,v 1.71 2020/01/23 03:42:41 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4#SUDO=sudo 4#SUDO=sudo
@@ -444,6 +444,29 @@ EOF
444# be abused to locally escalate privileges. 444# be abused to locally escalate privileges.
445if [ ! -z "$TEST_SSH_UNSAFE_PERMISSIONS" ]; then 445if [ ! -z "$TEST_SSH_UNSAFE_PERMISSIONS" ]; then
446 echo "StrictModes no" >> $OBJ/sshd_config 446 echo "StrictModes no" >> $OBJ/sshd_config
447else
448 # check and warn if excessive permissions are likely to cause failures.
449 unsafe=""
450 dir="${OBJ}"
451 while test ${dir} != "/"; do
452 perms=`ls -ld ${dir}`
453 case "${perms}" in
454 ?????w????*|????????w?*) unsafe="${unsafe} ${dir}" ;;
455 esac
456 dir=`dirname ${dir}`
457 done
458 if ! test -z "${unsafe}"; then
459 cat <<EOD
460
461WARNING: Unsafe (group or world writable) directory permissions found:
462${unsafe}
463
464These could be abused to locally escalate privileges. If you are
465sure that this is not a risk (eg there are no other users), you can
466bypass this check by setting TEST_SSH_UNSAFE_PERMISSIONS=1
467
468EOD
469 fi
447fi 470fi
448 471
449if [ ! -z "$TEST_SSH_SSHD_CONFOPTS" ]; then 472if [ ! -z "$TEST_SSH_SSHD_CONFOPTS" ]; then