Discussion:
[Check_mk (english)] "runas" plugin script : is this still supported ?
Gilles Pion
2018-09-26 08:23:07 UTC
Permalink
Hello,

I'm referring to this (old) announcement:

Check_MK Werk 0928: runas: new plugin script to include and execute
mrpe, local and plugin scripts as different user

Link: http://lists.mathias-kettner.de/pipermail/checkmk-werks-lvl2/2014-May/000146.html

I've tried to implement it without success.

* Contents of "/etc/check_mk/runas.cfg":
mrpe mysql /home/mysql/mrpe_commands.cfg

* Contents of "/home/mysql/mrpe_commands.cfg"
MYSQL-connection-time /home/mysql/bin/check_mysql_health --username
<user> --password <pass> --socket /path/to/socket.sock --mode
connection-time

Here's what happens when manually running agent in trace/debug (-d) mode:

++ eval 'su mysql -c \'\''/home/mysql/bin/check_mysql_health
--username <user> --password <pass> --socket /path/to/socket.sock
--mode connection-time\'\'''
+++ su mysql -c ''\''/home/mysql/bin/check_mysql_health' --username
<user> --password <pass> --socket /path/to/socket.sock --mode
'connection-time'\'''
su: unrecognized option '--username'

Apparently there is a parsing error and the MRPE plugin switches are
passed to the "su" command instead
Gilles Pion
2018-09-26 08:43:02 UTC
Permalink
BTW: it works fine when not using "su" option (but that not what I want)
Marcel Schulte
2018-09-28 21:59:07 UTC
Permalink
Hi Gilles,

open your /usr/bin/check_mk_agent as root in an editor, navigate to
the code section where runas.cfg is opened, navigate further to a line
like this:

cmdline="$PREFIX\'$cmdline\'"

...and remove both backslashes (not more characters, just those two).

Try your test again, does it work now?

If that's the case, please report back and also report your issue,
description like done here in the list, used agent version and
solution to ***@check-mk.org, so that the colleagues know of
this.

HTH,
Marcel
Am Mi., 26. Sep. 2018 um 10:24 Uhr schrieb Gilles Pion
Post by Gilles Pion
Hello,
Check_MK Werk 0928: runas: new plugin script to include and execute
mrpe, local and plugin scripts as different user
Link: http://lists.mathias-kettner.de/pipermail/checkmk-werks-lvl2/2014-May/000146.html
I've tried to implement it without success.
mrpe mysql /home/mysql/mrpe_commands.cfg
* Contents of "/home/mysql/mrpe_commands.cfg"
MYSQL-connection-time /home/mysql/bin/check_mysql_health --username
<user> --password <pass> --socket /path/to/socket.sock --mode
connection-time
++ eval 'su mysql -c \'\''/home/mysql/bin/check_mysql_health
--username <user> --password <pass> --socket /path/to/socket.sock
--mode connection-time\'\'''
+++ su mysql -c ''\''/home/mysql/bin/check_mysql_health' --username
<user> --password <pass> --socket /path/to/socket.sock --mode
'connection-time'\'''
su: unrecognized option '--username'
Apparently there is a parsing error and the MRPE plugin switches are
passed to the "su" command instead
_______________________________________________
checkmk-en mailing list
Manage your subscription or unsubscribe
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en
Gilles Pion
2018-10-01 07:04:29 UTC
Permalink
Post by Marcel Schulte
open your /usr/bin/check_mk_agent as root in an editor, navigate to
the code section where runas.cfg is opened, navigate further to a line
cmdline="$PREFIX\'$cmdline\'"
...and remove both backslashes (not more characters, just those two).
Try your test again, does it work now?
Yes works fine with this patch.

NB: I've made my test with the latest check_mk_agent from 1.5.0p4 and
an older one (1.4.0p22) with exactly the same results

--
Gilles

Loading...