Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
icinga-checks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
icinga-checks
Merge requests
!196
onevm + onehost: harden sudo command execution
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
onevm + onehost: harden sudo command execution
6723-sudo
into
master
Overview
0
Commits
1
Pipelines
0
Changes
2
Merged
Hahn Axel (hahn)
requested to merge
6723-sudo
into
master
1 year ago
Overview
0
Commits
1
Pipelines
0
Changes
2
0
0
Merge request reports
Viewing commit
46b6a16e
Show latest version
2 files
+
10
−
4
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
46b6a16e
onevm + onehost: harden sudo command execution
· 46b6a16e
Hahn Axel (hahn)
authored
1 year ago
check_onehost
+
5
−
2
View file @ 46b6a16e
Edit in single-file editor
Open in Web IDE
Show full file
@@ -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