forked from evolix/evocheck
Closes #11 Added IS_HOME_SIZE
We loop for all sysadmins home dir (using evomaintenance trap) and calculate their home size. By default warn if more than 1G.
This commit is contained in:
parent
9be91392f3
commit
eeef449f55
21
evocheck.sh
21
evocheck.sh
|
@ -107,6 +107,7 @@ IS_EVOACME_LIVELINKS=1
|
|||
IS_APACHE_CONFENABLED=1
|
||||
IS_MELTDOWN_SPECTRE=1
|
||||
IS_OLD_HOME_DIR=1
|
||||
IS_HOME_SIZE=1
|
||||
|
||||
#Proper to OpenBSD
|
||||
IS_SOFTDEP=1
|
||||
|
@ -886,6 +887,26 @@ if [ -e /etc/debian_version ]; then
|
|||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$IS_HOME_SIZE" = 1 ]; then
|
||||
# Can be changed in evocheck.cf
|
||||
homeDir=${homeDir:-/home}
|
||||
homeMaxSize=${homeMaxSize:-1048576}
|
||||
# If the user has an evomaintenance profile trap he is
|
||||
# considered a sysadmin
|
||||
for homeProfile in ${homeDir}/*/.profile; do
|
||||
if grep -q "evomaintenance.sh" "$homeProfile"; then
|
||||
homeSize=$(du -s "${homeProfile%%.profile}" \
|
||||
| awk '{print $1}')
|
||||
homeUser=$(stat "$homeProfile" -c %U)
|
||||
if [ "$homeSize" -gt "$homeMaxSize" ]; then
|
||||
echo 'IS_HOME_SIZE FAILED!'
|
||||
verbose "User $homeUser has more than 1G in his home"\
|
||||
|| break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue