Module: check_mk
Branch: master
Commit: 4d585dc76b4c107a2f2fb51ff10927c73bf22f91
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4d585dc76b4c10…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Thu Jan 17 16:23:10 2019 +0100
6957 FIX mk_job: Allow monitoring of jobs of users without login shell
Previously, no shell was specified when changing the user ID to read
the users job files. This made it impossible to monitor jobs of users
without login shell, such as "www-data".
The environment variable SHELL is now passed to su.
Change-Id: I1fec0ed68b3ce959f4622b0b7b8f407b4cbe2178
---
.werks/6957 | 13 +++++++++++++
agents/check_mk_agent.linux | 2 +-
agents/check_mk_agent.openwrt | 2 +-
agents/check_mk_agent.solaris | 6 +++---
4 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/.werks/6957 b/.werks/6957
new file mode 100644
index 0000000..f5c6f5b
--- /dev/null
+++ b/.werks/6957
@@ -0,0 +1,13 @@
+Ttle: mk_job: Allow monitoring of jobs of users without login shell
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1547738482
+Class: fix
+
+Previously, no shell was specified when changing the user ID to read
+the users job files. This made it impossible to monitor jobs of users
+without login shell, such as "www-data".
+The environment variable SHELL is now passed to su.
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index 5e42273..2baf6fa 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -987,7 +987,7 @@ if pushd "$MK_VARDIR/job" >/dev/null; then
do
if [ -d "$username" ] && cd "$username" ; then
if [ $EUID -eq 0 ]; then
- su "$username" -c "head -n -0 -v *"
+ su -s "$SHELL" "$username" -c "head -n -0 -v
*"
else
head -n -0 -v ./*
fi
diff --git a/agents/check_mk_agent.openwrt b/agents/check_mk_agent.openwrt
index 331b93c..71d6381 100755
--- a/agents/check_mk_agent.openwrt
+++ b/agents/check_mk_agent.openwrt
@@ -737,7 +737,7 @@ if pushd $MK_VARDIR/job >/dev/null; then
do
if [ -d "$username" ] && cd "$username" ; then
if [ $EUID -eq 0 ]; then
- su "$username" -c "head -n -0 -v *"
+ su -s "$SHELL" "$username" -c "head -n -0 -v
*"
else
head -n -0 -v *
fi
diff --git a/agents/check_mk_agent.solaris b/agents/check_mk_agent.solaris
index 3420367..c92143a 100755
--- a/agents/check_mk_agent.solaris
+++ b/agents/check_mk_agent.solaris
@@ -166,14 +166,14 @@ if pushd $MK_VARDIR/job >/dev/null; then
for username in *
do
if [ -d "$username" ] && cd "$username" ; then
- count=$(su "$username" -c "ls -1 * | wc -l")
+ count=$(su -s "$SHELL" "$username" -c "ls -1 * | wc
-l")
if [ "$count" -eq "1" ]; then
- filename=$(su "$username" -c "ls -1 *")
+ filename=$(su -s "$SHELL" "$username" -c "ls -1
*")
echo "==> $filename <=="
fi
- su "$username" -c "head -n1000 *"
+ su -s "$SHELL" "$username" -c "head -n1000 *"
cd ..
fi
done