File: //opt/BCLinux/bse/secure_check/c07_TMOUT
#!/bin/sh
#=======================================================
InsertSection "check TMOUT set"
IS_EXIST=`cat /etc/profile|grep TMOUT= | grep -v "^#" |wc -l`
if [ $IS_EXIST -eq 0 ];then
# tips="TMOUT设置未设置"
# echo "${S3}":"${tips}"
echo "c07" >> $RESULT_FILE
echo "" >> $RESULT_FILE
logtext "WRN_C07_01: $(loadtext TXT_WRN_C07_01)"
logtext "Suggestion: $(loadtext TXT_SUG_C07)"
Display --indent 2 --text "- No TMOUT set... " --result WARNING --color RED
AddHP 0 1
else
cat /etc/profile|grep TMOUT | grep -v "#" | grep "=" |tail -1 | awk -F ";" '{print $1}' | awk -F "=" '{print $2}' |while read TMO
do
if [ -z ${TMO} ];then
Display --indent 2 --text "- No TMOUT set... " --result WARNING --color RED
AddHP 0 1
elif [ ! -z `echo $TMO | sed 's/[0-9]//g'` ];then
Display --indent 2 --text "- Wrong TMOUT set... " --result WARNING --color RED
AddHP 0 1
elif [ ${TMO} -gt 300 ];then
#tips="TMOUT设置未按要求设置,建议设置为小于等于300"
#echo "${S3}":"${tips}"
echo "c07" >> $RESULT_FILE
echo "" >> $RESULT_FILE
logtext "WRN_C07_02: $(loadtext TXT_WRN_C07_02)"
logtext "Suggestion: $(loadtext TXT_SUG_C)"
Display --indent 2 --text "- Wrong TMOUT set, must less than 300... " --result WARNING --color RED
AddHP 0 1
else
logtext "Has right TMOUT set, checking ok"
Display --indent 2 --text "- Has right TMOUT set... " --result OK --color GREEN
AddHP 1 1
fi
done
fi