sécurité root

This commit is contained in:
2026-03-18 08:07:45 +01:00
parent 790052dfe5
commit 78e2f5ea1e
2 changed files with 8 additions and 1 deletions

View File

@@ -19,6 +19,13 @@ CRITICAL=95
MOUNTS=("/" "/var" "/home")
LOG_BIN="/opt/monitoring/bin/log-cli.php"
# --- Vérification ROOT ---
if [ "${EUID}" -ne 0 ]; then
echo "ERREUR : Ce script doit être exécuté en tant que root." >&2
$LOG_BIN ERROR "internal_error" "Tentative d'exécution sans privilèges root."
exit 1
fi
for mount in "${MOUNTS[@]}"; do
if ! mountpoint -q "$mount"; then continue; fi