From eeef449f558dca141a9b089b790487570547c258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20S?= Date: Tue, 19 Feb 2019 12:02:47 +0100 Subject: [PATCH 1/2] 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. --- evocheck.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/evocheck.sh b/evocheck.sh index ef728bc..ada1416 100755 --- a/evocheck.sh +++ b/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 -- 2.39.2 From 0c41b7a0fdb923720307af0b8e369efc69864abd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20S?= Date: Tue, 19 Feb 2019 14:59:25 +0100 Subject: [PATCH 2/2] IS_HOME_SIZE: Added space when breaking line --- evocheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evocheck.sh b/evocheck.sh index ada1416..bc12ae2 100755 --- a/evocheck.sh +++ b/evocheck.sh @@ -901,7 +901,7 @@ if [ -e /etc/debian_version ]; then 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"\ + verbose "User $homeUser has more than 1G in his home" \ || break fi fi -- 2.39.2