59 lines
1.8 KiB
Bash
59 lines
1.8 KiB
Bash
#!/bin/sh
|
|
|
|
#################################################################################
|
|
#
|
|
# Author: Thomas Biege <thomas@suse.de>
|
|
#
|
|
# Lynis comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
|
|
# welcome to redistribute it under the terms of the GNU General Public License.
|
|
# See LICENSE file for usage of this software.
|
|
#
|
|
#################################################################################
|
|
#
|
|
# Checking for processes running as 'nobody'
|
|
#
|
|
#################################################################################
|
|
#
|
|
# TODO:
|
|
#
|
|
################################################################################
|
|
#
|
|
InsertSection "Memory and processes"
|
|
#
|
|
#################################################################################
|
|
#
|
|
# Test : PROC-3625
|
|
# Description : Processes running as 'nobody'
|
|
Register --test-no PROC-3625 --weight L --network NO --description "Processes running as 'nobody'."
|
|
if [ ${SKIPTEST} -eq 0 ]; then
|
|
Display --indent 2 --text "- Starting look-up of 'nobody' processes..."
|
|
logtext "Test: Checking for processes running as 'nobody'"
|
|
|
|
TMP=$(mktemp /tmp/lynis.XXXXXX)
|
|
TMP2=$(mktemp /tmp/lynis.XXXXXX)
|
|
ps -eo uname,pid,comm | tr -s " " | sed "s/ /:/g" > $TMP
|
|
HPMAX=$(wc -l $TMP | cut -d' ' -f1)
|
|
grep '^nobody' $TMP > $TMP2
|
|
|
|
HP=$HPMAX
|
|
for i in $(cat $TMP2)
|
|
do
|
|
HP=$((HP - 1))
|
|
PID=$(echo $i | cut -d: -f2)
|
|
PNAME=$(echo $i | cut -d: -f3)
|
|
Display --indent 4 --text "${PNAME} [PID ${PID}] runs as user 'nobody'" --result WARNING --color RED
|
|
done
|
|
|
|
# echo "AddHP $HP $HPMAX"
|
|
AddHP $HP $HPMAX
|
|
|
|
rm -f $TMP $TMP2
|
|
fi
|
|
#
|
|
#################################################################################
|
|
#
|
|
|
|
wait_for_keypress
|
|
|
|
#
|
|
#================================================================================ |