Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormboelen <michael@cisofy.com>2015-03-17 16:55:03 +0300
committermboelen <michael@cisofy.com>2015-03-17 16:55:03 +0300
commit332277b7e1ac575ceaed4e48ccd25adf91f60b64 (patch)
treeea5a0bf4179cb286a024427feab4cf9306a3ef7e /include/tests_shells
parentad413346de543bd6780e41f65ce4422a0a08152c (diff)
Enhance timeout check and ensure there are .sh files in /etc/profile.d
Diffstat (limited to 'include/tests_shells')
-rw-r--r--include/tests_shells31
1 files changed, 18 insertions, 13 deletions
diff --git a/include/tests_shells b/include/tests_shells
index d588ed76..e80858aa 100644
--- a/include/tests_shells
+++ b/include/tests_shells
@@ -119,11 +119,12 @@
fi
if [ -f /etc/profile ]; then
- FIND=`cat /etc/profile | grep '\(export[ \t]*\)\?TMOUT=' | tr -d ' ' | tr -d '\t' | grep -v "^#" | sed 's/export//' | sed 's/#.*//'`
+ FIND=`cat /etc/profile | grep '\(export[ \t]*\)\?TMOUT\( \)\?=\( \)\?' | tr -d ' ' | tr -d '\t' | grep -v "^#" | sed 's/export//' | sed 's/#.*//' | awk -F= '{ print $2 }'`
if [ ! "${FIND}" = "" ]; then
N=0; IDLE_TIMEOUT=1
for I in ${FIND}; do
logtext "Output: ${I}"
+ report "session_timeout_value[]=${I}"
N=`expr ${N} + 1`
done
if [ ${N} -eq 1 ]; then
@@ -140,21 +141,25 @@
fi
if [ -d /etc/profile.d ]; then
- FIND=`cat /etc/profile.d/*.sh 2> /dev/null | grep '\(export[ \t]*\)\?TMOUT=' | tr -d ' ' | tr -d '\t' | grep -v "^#" | sed 's/export//' | sed 's/#.*//'`
+ FIND=`ls /etc/profile.d/*.sh 2> /dev/null`
if [ ! "${FIND}" = "" ]; then
- N=0; IDLE_TIMEOUT=1
- for I in ${FIND}; do
- logtext "Output: ${I}"
- N=`expr ${N} + 1`
- done
- if [ ${N} -eq 1 ]; then
- logtext "Result: found TMOUT value configured in one of the files in /etc/profile.d directory"
+ FIND=`cat /etc/profile.d/*.sh 2> /dev/null | grep '\(export[ \t]*\)\?TMOUT=' | tr -d ' ' | tr -d '\t' | grep -v "^#" | sed 's/export//' | sed 's/#.*//' | awk -F= '{ print $2 }'`
+ if [ ! "${FIND}" = "" ]; then
+ N=0; IDLE_TIMEOUT=1
+ for I in ${FIND}; do
+ logtext "Output: ${I}"
+ report "session_timeout_value[]=${I}"
+ N=`expr ${N} + 1`
+ done
+ if [ ${N} -eq 1 ]; then
+ logtext "Result: found TMOUT value configured in one of the files in /etc/profile.d directory"
+ else
+ logtext "Result: found several TMOUT values configured in one of the files in /etc/profile.d directory"
+ fi
+ report "session_timeout_method[]=profile"
else
- logtext "Result: found several TMOUT values configured in one of the files in /etc/profile.d directory"
+ logtext "Result: could not find TMOUT setting in /etc/profile.d/*.sh"
fi
- report "session_timeout_method[]=profile"
- else
- logtext "Result: could not find TMOUT setting in /etc/profile.d/*.sh"
fi
else
logtext "Result: skip /etc/profile.d directory test, directory not available on this system"