Module: check_mk
Branch: master
Commit: 3ecaf5b4b0210e1c01353e096d3987c27b914350
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3ecaf5b4b0210e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Sep 3 15:11:54 2015 +0200
#2559 FIX job: Trying to read job result files as non root when agent is not executed as
root
---
.werks/2559 | 10 ++++++++++
ChangeLog | 1 +
agents/check_mk_agent.linux | 6 +++++-
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/.werks/2559 b/.werks/2559
new file mode 100644
index 0000000..2243e9e
--- /dev/null
+++ b/.werks/2559
@@ -0,0 +1,10 @@
+Title: job: Trying to read job result files as non root when agent is not executed as
root
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i3
+Date: 1441285840
+
+
diff --git a/ChangeLog b/ChangeLog
index 5c83796..4296d38 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -165,6 +165,7 @@
* 2558 FIX: cmciii.temp: Do not discover air temperature sensors anymore...
* 1290 FIX: brocade_mlx_fan: Fix: Not longer add fans who not are present while
discovery
* 2569 FIX: fixed crash in aix lvm check after volume disappears...
+ * 2559 FIX: job: Trying to read job result files as non root when agent is not
executed as root
Multisite:
* 2385 SEC: Fixed possible reflected XSS on all GUI pages where users can produce
unhandled exceptions...
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index bee6a79..b016e18 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -610,7 +610,11 @@ if pushd $MK_VARDIR/job >/dev/null; then
for username in *
do
if [ -d "$username" ] && cd "$username" ; then
- su "$username" -c "head -n -0 -v *"
+ if [ $EUID -eq 0 ]; then
+ su "$username" -c "head -n -0 -v *"
+ else
+ head -n -0 -v *
+ fi
cd ..
fi
done