Skip to content

Commit 5161320

Browse files
committed
Revert^2 "Add Werk #19573: FIX Fix system executables failing due to Checkmk's OpenSSL being loaded via LD_LIBRARY_PATH"
This reverts commit c08a432. Reason for revert: Testing now the cache issues should be resolved. CMK-33201 Change-Id: I569362bac88fab98dc03b2497186c2a7ccd8c3fa
1 parent 08b6cca commit 5161320

12 files changed

Lines changed: 79 additions & 87 deletions

File tree

.werks/19573.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[//]: # (werk v3)
2+
# Fix system executables failing due to Checkmk's OpenSSL being loaded via LD_LIBRARY_PATH
3+
4+
key | value
5+
---------- | ---
6+
date | 2026-04-10T17:16:28.506025+00:00
7+
version | 2.6.0b1
8+
class | fix
9+
edition | community
10+
component | omd
11+
level | 2
12+
compatible | yes
13+
14+
Previously, Checkmk's site environment included `$OMD_ROOT/lib` in `LD_LIBRARY_PATH`
15+
so that Checkmk's own processes could find the bundled shared libraries. The unintended
16+
side effect: system executables invoked from within the site environment (e.g. `ssh`,
17+
`curl`, `openssl`, `zypper`, `systemctl`, `php`) would also pick up Checkmk's bundled
18+
OpenSSL instead of the system's version. On distributions where the two versions were
19+
incompatible, those commands would fail with errors such as:
20+
21+
```
22+
/usr/bin/systemctl: /omd/sites/mysite/lib/libcrypto.so.3: version OPENSSL_3.4.0 not found
23+
```
24+
25+
As a workaround, Checkmk shipped wrapper scripts that unset `LD_LIBRARY_PATH` before
26+
invoking the real system executable for a list of commonly affected commands.
27+
28+
We have now fixed the root cause: all Checkmk-shipped ELF binaries have their RUNPATH
29+
correctly set so they locate their bundled libraries directly, without relying on
30+
`LD_LIBRARY_PATH`. As a result, `$OMD_ROOT/lib` is no longer added to `LD_LIBRARY_PATH`,
31+
and the workaround wrapper scripts have been removed.
32+
33+
`LD_LIBRARY_PATH` still includes `$OMD_ROOT/local/lib` to support native libraries
34+
installed by site users (e.g. via MKPs). If you have placed a native shared library in
35+
`local/lib` that is incompatible with a system executable, that executable may still fail
36+
— but this is a rare edge case and can be resolved by removing the conflicting library.

agents/plugins/mk_site_object_counts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ _query_site() {
2525
site_lib() {
2626
printf "/omd/versions/%s/lib" "$(realpath "/omd/sites/${1}/version" | sed 's|.*/||')"
2727
}
28+
# LD_LIBRARY_PATH is set inline (not exported) as a per-subprocess override pointing to the
29+
# queried site's own lib directory. This is required for backward compatibility with older
30+
# installed site versions whose unixcat binary may lack RPATH and cannot locate its shared
31+
# libraries otherwise. Do not remove until all supported older versions have RPATH set.
2832
echo -e "${2}" | LD_LIBRARY_PATH="$(site_lib "${1}"):${LD_LIBRARY_PATH}" waitmax 3 "$(site_cmd "${1}" unixcat)" "/omd/sites/${1}/tmp/run/live"
2933
}
3034

bazel/cmk/distro/BUILD.bazel

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,3 @@ selects.config_setting_group(
110110
":ubuntu-26.04",
111111
],
112112
)
113-
114-
# These distros either ship too old or too new of a OpenSSL than us.
115-
#
116-
# See omd/packages/omd/BUILD
117-
# See MODULE.bazel for the current version.
118-
selects.config_setting_group(
119-
name = "incompatible-openssl",
120-
match_any = [
121-
":almalinux-8",
122-
":almalinux-9",
123-
":sles-15sp6",
124-
":sles-15sp7",
125-
":ubuntu-22.04",
126-
],
127-
)

bin/cmk-monitor-core

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
OMD_SITE=$(whoami)
77
SITE_VERSION="$(realpath ~/version | sed 's|.*/||')"
8-
LD_LIBRARY_PATH="/omd/versions/${SITE_VERSION}/lib:${LD_LIBRARY_PATH}"
9-
export LD_LIBRARY_PATH
108

119
which timeout >/dev/null 2>&1 && waitmax() { timeout "$@"; }
1210

omd/packages/omd/BUILD

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ load("//bazel/rules:file_from_flag.bzl", "file_from_flag")
77
load("//bazel/rules:replace_string_in_file.bzl", "replace_string_in_file")
88

99
exports_files([
10-
"use_system_openssl",
1110
"skel.permissions",
1211
"skel/.profile",
1312
"skel/.bashrc",
@@ -41,38 +40,6 @@ pkg_files(
4140
prefix = "bin",
4241
)
4342

44-
# SUP-10161: our openssl is incompatible with some system executables on various sles15sp*
45-
# SUP-26565: Getting an exception error when baking agent almalinux-9+
46-
# SUP-26879: Wrap other tools commonly used by users that require linking to the system openssl
47-
# etc.
48-
WRAPPED_EXECUTABLES = [
49-
"curl",
50-
"dig",
51-
"host",
52-
"nc",
53-
"nmap",
54-
"nslookup",
55-
"pdftoppm",
56-
"php",
57-
"php-cgi",
58-
"php5",
59-
"php5-cgi",
60-
"resolvectl",
61-
"rpmbuild",
62-
"scp",
63-
"ssh",
64-
"systemctl",
65-
"zypper",
66-
]
67-
68-
[pkg_files(
69-
name = "wrapper_" + executable,
70-
srcs = ["use_system_openssl"],
71-
attributes = pkg_attributes(mode = "0755"),
72-
prefix = "bin",
73-
renames = {"use_system_openssl": executable},
74-
) for executable in WRAPPED_EXECUTABLES]
75-
7643
genrule(
7744
name = "omd_man_gz",
7845
srcs = ["omd.8"],
@@ -370,10 +337,7 @@ pkg_tar(
370337
":omdlib_pkg",
371338
":skel",
372339
":xinetd_link",
373-
] + select({
374-
"@cmk//distro:incompatible-openssl": ["wrapper_" + executable for executable in WRAPPED_EXECUTABLES],
375-
"//conditions:default": [],
376-
}),
340+
],
377341
stamp = 1,
378342
visibility = ["//omd:__pkg__"],
379343
)

omd/packages/omd/omdlib/site_user.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def set_environment(site_name: str, config: Config) -> None:
2929
os.environ["USER"] = site_name
3030
os.environ["HOME"] = site_home
3131

32-
os.environ["LD_LIBRARY_PATH"] = f"{site_home}/local/lib:{site_home}/lib"
32+
os.environ["LD_LIBRARY_PATH"] = f"{site_home}/local/lib"
3333

3434
# Special agents / active checks environment
3535
os.environ["PASSWORD_STORE_SECRET_FILE"] = f"{site_home}/etc/password_store.secret"

omd/packages/omd/skel/.profile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export OMD_SITE=###SITE###
44
export OMD_ROOT=###ROOT###
55

66
PATH=$OMD_ROOT/local/bin:$OMD_ROOT/bin:$OMD_ROOT/local/lib/perl5/bin:$PATH
7-
export LD_LIBRARY_PATH=$OMD_ROOT/local/lib:$OMD_ROOT/lib
7+
export LD_LIBRARY_PATH=$OMD_ROOT/local/lib
88

99
# export special agent / active check environment
1010
export PASSWORD_STORE_SECRET_FILE="${OMD_ROOT}/etc/password_store.secret"

omd/packages/omd/use_system_openssl

Lines changed: 0 additions & 16 deletions
This file was deleted.

omd/packages/python3-modules/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ config_setting(
2121
name = module,
2222
srcs = [
2323
"%s_requirements.txt" % module,
24+
":git_wrapper",
2425
"@freetds",
25-
"@omd_packages//omd/packages/omd:use_system_openssl",
2626
"@openssl",
2727
"@python",
2828
],
@@ -41,8 +41,8 @@ config_setting(
4141
build_python_module(
4242
name = "netapp-ontap",
4343
srcs = [
44+
":git_wrapper",
4445
"@freetds",
45-
"@omd_packages//omd/packages/omd:use_system_openssl",
4646
"@openssl",
4747
"@python",
4848
],

omd/packages/python3-modules/build-python3-modules.bzl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ build_cmd = """
7979
# Python binary supplied by bazel build process
8080
export PYTHON_EXECUTABLE=$$PWD/$$EXT_DEPS_PATH/{python_dir}/python/bin/python3
8181
82-
# Workaround for git execution issue
82+
# Workaround for git execution issue: pip may call git for VCS deps, but LD_LIBRARY_PATH
83+
# is set to our OpenSSL which conflicts with system git. The wrapper unsets it.
8384
mkdir -p $$TMPDIR/workdir/$$MODULE_NAME
84-
install -m 755 "$(execpath @omd_packages//omd/packages/omd:use_system_openssl)" "$$TMPDIR/workdir/$$MODULE_NAME/git"
85+
install -m 755 "$(execpath :git_wrapper)" "$$TMPDIR/workdir/$$MODULE_NAME/git"
8586
export PATH="$$TMPDIR/workdir/$$MODULE_NAME:$$PATH"
8687
8788
# Build directory

0 commit comments

Comments
 (0)