Skip to content
Snippets Groups Projects

onevm + onehost: harden sudo command execution

Merged Hahn Axel (hahn) requested to merge 6723-sudo into master
2 files
+ 10
4
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 5
2
@@ -11,12 +11,13 @@
# 2023-06-12 v1.1 <axel.hahn@unibe.ch> show message if no sudo permissions on onehost command exist
# 2023-08-23 v1.2 <axel.hahn@unibe.ch> update help; show help without requirements
# 2023-09-15 v1.3 <axel.hahn@unibe.ch> add detection for disabled hosts; update texts
# 2023-10-20 v1.4 <axel.hahn@unibe.ch> harden sudo command execution
# ======================================================================
. $(dirname $0)/inc_pluginfunctions
self_APPVERSION=1.3
self_APPVERSION=1.4
# ----------------------------------------------------------------------
# functions
@@ -68,7 +69,9 @@ typeset -i iCriticalLimit=$( ph.getValueWithParam 2 c "$@")
# --- get data
cmdout=$( sudo onehost list --csv 2>&1 )
if ! cmdout=$( sudo -n onehost list --csv 2>&1 ); then
ph.abort "UNKNOWN: No sudo permissions to execute onehost commands."
fi
if ! grep "ID,NAME" <<< "$cmdout" >/dev/null; then
ph.setStatus "unknown"
Loading