From 35a6fb679207230327c67edbbbc658d45c2c3d10 Mon Sep 17 00:00:00 2001 From: master3395 Date: Sat, 10 Jan 2026 03:22:45 +0100 Subject: [PATCH] Fix ModSecurity LMDB dependency crash (Issue #1626) - Always download compatible ModSecurity binary after installation - Removes conditional check for custom_ols_marker - Fixes undefined symbol: mdb_env_create error - Prevents OpenLiteSpeed crashes with SIGSEGV signal 11 - Compatible with Ubuntu 24.04, RHEL 8/9, Debian 11/12 The fix ensures that compatible ModSecurity binaries (built without LMDB dependency or with LMDB statically linked) are always used, preventing the runtime symbol lookup errors that cause crashes. Related: https://github.com/usmannasir/cyberpanel/issues/1626 --- plogical/modSec.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/plogical/modSec.py b/plogical/modSec.py index 1e3c38f1f..ef2c36262 100644 --- a/plogical/modSec.py +++ b/plogical/modSec.py @@ -141,22 +141,24 @@ class modSec: writeToFile.writelines("ModSecurity Installed.[200]\n") writeToFile.close() - # Check if custom OLS binary is installed - if so, replace with compatible ModSecurity - custom_ols_marker = "/usr/local/lsws/modules/cyberpanel_ols.so" - if os.path.exists(custom_ols_marker): - writeToFile = open(modSec.installLogPath, 'a') - writeToFile.writelines("Custom OLS detected, installing compatible ModSecurity...\n") - writeToFile.close() + # Always download and install compatible ModSecurity binary to prevent LMDB dependency crashes + # This fixes the "undefined symbol: mdb_env_create" error that causes OpenLiteSpeed to crash + writeToFile = open(modSec.installLogPath, 'a') + writeToFile.writelines("Downloading compatible ModSecurity binary to prevent LMDB dependency issues...\n") + writeToFile.close() - platform = modSec.detectPlatform() - if modSec.downloadCompatibleModSec(platform): - writeToFile = open(modSec.installLogPath, 'a') - writeToFile.writelines("Compatible ModSecurity installed successfully.\n") - writeToFile.close() - else: - writeToFile = open(modSec.installLogPath, 'a') - writeToFile.writelines("WARNING: Could not install compatible ModSecurity. May experience crashes.\n") - writeToFile.close() + platform = modSec.detectPlatform() + if modSec.downloadCompatibleModSec(platform): + writeToFile = open(modSec.installLogPath, 'a') + writeToFile.writelines("Compatible ModSecurity binary installed successfully.\n") + writeToFile.close() + logging.CyberCPLogFileWriter.writeToFile("Compatible ModSecurity binary installed to prevent LMDB dependency crashes [installModSec]") + else: + writeToFile = open(modSec.installLogPath, 'a') + writeToFile.writelines("WARNING: Could not install compatible ModSecurity binary. Using package-manager binary instead.\n") + writeToFile.writelines("WARNING: If you experience crashes (SIGSEGV signal 11), manually download compatible binary.\n") + writeToFile.close() + logging.CyberCPLogFileWriter.writeToFile("WARNING: Could not install compatible ModSecurity binary - may experience LMDB dependency crashes [installModSec]") return 1 except BaseException as msg: