[AUTH-9308] Skip testing some files when systemd is used

This commit is contained in:
mboelen 2016-03-24 17:16:14 +01:00
parent d7c8233dd4
commit 0779005b46
1 changed files with 29 additions and 27 deletions

View File

@ -825,35 +825,37 @@
FOUND=0 FOUND=0
TEST_PERFORMED=0 TEST_PERFORMED=0
# Check inittab if [ ${HAS_SYSTEMD} -eq 0 ]; then
LogText "Test: Searching /etc/inittab" # Check inittab
if [ -f /etc/inittab ]; then LogText "Test: Searching /etc/inittab"
TEST_PERFORMED=1 if [ -f /etc/inittab ]; then
LogText "Result: file /etc/inittab exists" TEST_PERFORMED=1
LogText "Test: checking presence sulogin for single user mode" LogText "Result: file /etc/inittab exists"
FIND=`egrep "^~~:S:(respawn|wait):/sbin/sulogin" /etc/inittab` LogText "Test: checking presence sulogin for single user mode"
FIND2=`egrep "^su:S:(respawn|wait):/sbin/sulogin" /etc/inittab` FIND=`egrep "^~~:S:(respawn|wait):/sbin/sulogin" /etc/inittab`
if [ ! "${FIND}" = "" -o ! "${FIND2}" = "" ]; then FIND2=`egrep "^su:S:(respawn|wait):/sbin/sulogin" /etc/inittab`
FOUND=1 if [ ! "${FIND}" = "" -o ! "${FIND2}" = "" ]; then
LogText "Result: found sulogin, so single user is protected" FOUND=1
LogText "Result: found sulogin, so single user is protected"
fi
else
LogText "Result: file /etc/inittab does not exist"
fi fi
else
LogText "Result: file /etc/inittab does not exist"
fi
# Check init # Check init
LogText "Test: Searching /etc/sysconfig/init" LogText "Test: Searching /etc/sysconfig/init"
if [ -f /etc/sysconfig/init ]; then if [ -f /etc/sysconfig/init ]; then
TEST_PERFORMED=1 TEST_PERFORMED=1
LogText "Result: file /etc/sysconfig/init exists" LogText "Result: file /etc/sysconfig/init exists"
LogText "Test: checking presence sulogin for single user mode" LogText "Test: checking presence sulogin for single user mode"
FIND=`grep "^SINGLE=/sbin/sulogin" /etc/sysconfig/init` FIND=`grep "^SINGLE=/sbin/sulogin" /etc/sysconfig/init`
if [ ! "${FIND}" = "" ]; then if [ ! "${FIND}" = "" ]; then
FOUND=1 FOUND=1
LogText "Result: found sulogin, so single user is protected" LogText "Result: found sulogin, so single user is protected"
fi
else
LogText "Result: file /etc/sysconfig/init does not exist"
fi fi
else
LogText "Result: file /etc/sysconfig/init does not exist"
fi fi
# Systemd support # Systemd support
@ -894,7 +896,7 @@
AddHP 2 2 AddHP 2 2
fi fi
else else
LogText "Result: No inittab or init file found, unsure if system is protected" LogText "Result: no tests performed"
fi fi
fi fi
# #