From 60f504992b8c0fd2cc1632b647737ca76dbc2d17 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Fri, 20 Oct 2023 15:45:06 +0200
Subject: [PATCH] ceph_diskfree harden sudo command execution

---
 check_ceph_diskfree | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/check_ceph_diskfree b/check_ceph_diskfree
index ce3f847..28ab2ef 100755
--- a/check_ceph_diskfree
+++ b/check_ceph_diskfree
@@ -21,11 +21,12 @@
 # 2023-05-09  v1.3  <axel.hahn@unibe.ch>      add help
 # 2023-06-19  v1.4  <axel.hahn@unibe.ch>      no more tmpfile
 # 2023-07-27  v1.5  <axel.hahn@unibe.ch>      update help page
+# 2023-10-20  v1.6  <axel.hahn@unibe.ch>      harden sudo command execution
 # ======================================================================
 
 . $(dirname $0)/inc_pluginfunctions
 
-export self_APPVERSION=1.5
+export self_APPVERSION=1.6
 
 typeset -i iWarning=0
 typeset -i iCritical=0
@@ -68,7 +69,7 @@ typeset -i iWarnLimit=$(     ph.getValueWithParam 70 w "$@")
 typeset -i iCriticalLimit=$( ph.getValueWithParam 90 c "$@")
 
 
-if ! data=$( sudo /bin/ceph df 2>&1 )
+if ! data=$( sudo -n /bin/ceph df 2>&1 )
 then
     echo "$data"
     ph.abort "UNKNOWN: ceph is not available or no sudo permissions to execute ceph commands."
-- 
GitLab