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
This commit is contained in:
master3395
2026-01-10 03:22:45 +01:00
parent ea5be31de5
commit 35a6fb6792

View File

@@ -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: