Skip to content

Commit b30aace

Browse files
committed
cmk-monitor-*: avoid creation of user session
When using `su`in a systemd service it triggers the creation of a user session in systemd, which causes audio services (e.g. pipewire) to be started. By using `sudo` the created of a `systemd --user` process is avoided and hence to audio services are started. CMK-21932 Change-Id: If03ff9c06e057e8f9d23e5f474d05bcaa7b86505
1 parent 18e19bc commit b30aace

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

agents/check_mk_agent.linux

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,11 +1230,8 @@ section_omd() {
12301230
${MK_RUN_SYNC_PARTS} || return
12311231

12321232
for sitedir in /omd/sites/*; do
1233-
site_version="$(basename "$(realpath "${sitedir}/version")")"
1234-
site=${sitedir#/omd/sites/}
1235-
for script in /omd/versions/"${site_version}"/bin/cmk-monitor-*; do
1236-
[ -e "${script}" ] && [ "$(stat "${script}" -c '%U')" = "root" ] && sudo_as_root OMD_SITE="${site}" "${script}"
1237-
done
1233+
site="${sitedir#/omd/sites/}"
1234+
find -L "/omd/sites/${site}/bin" -type f -user "root" -name "cmk-monitor-*" -exec sudo --non-interactive --user="${site}" {} \;
12381235
done
12391236

12401237
echo '<<<mknotifyd:sep(0)>>>'

bin/cmk-monitor-broker

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
44
# conditions defined in the file COPYING, which is part of this source code package.
55

6-
[ "$(whoami)" = "root" ] && {
7-
# Don't accept further arguments when called as root, since we would put them after an 'su' unseen.
8-
su - "${OMD_SITE:?}" -c "${0}"
9-
exit
10-
}
11-
126
MANAGEMENT_API_PORT="$(grep "^CONFIG_RABBITMQ_MANAGEMENT_PORT=" ~/etc/omd/site.conf | cut -d"'" -f2)"
137
MONITORING_USER="cmk-internal-monitoring"
148
MONITORING_ROLE="monitoring"

0 commit comments

Comments
 (0)