Add support for RHEL 8 and RHEL 9 custom binaries
Update OS detection and binary distribution to support separate binaries for AlmaLinux/RHEL 8 and 9. The new structure uses: - rhel8/ directory for AlmaLinux/RHEL 8.x binaries - rhel9/ directory for AlmaLinux/RHEL 9.x binaries - ubuntu/ directory for Ubuntu/Debian binaries Changes: - Enhanced detectBinarySuffix() to distinguish between RHEL 8 and 9 - Updated binary URLs to use new directory structure - Updated ModSecurity checksums for all OS variants - Applied changes to install, upgrade, and ModSecurity modules This ensures proper ABI compatibility by providing OS-specific builds with correct glibc and library dependencies for each platform.
This commit is contained in:
parent
0eb8ca0d57
commit
20254f467c
|
|
@ -226,18 +226,33 @@ class InstallCyberPanel:
|
||||||
|
|
||||||
def detectBinarySuffix(self):
|
def detectBinarySuffix(self):
|
||||||
"""Detect which binary suffix to use based on OS distribution
|
"""Detect which binary suffix to use based on OS distribution
|
||||||
Returns 'ubuntu' for Ubuntu/Debian systems with libcrypt.so.1
|
Returns 'ubuntu' for Ubuntu/Debian systems
|
||||||
Returns 'rhel' for RHEL/AlmaLinux/Rocky systems with libcrypt.so.2
|
Returns 'rhel8' for RHEL/AlmaLinux/Rocky 8.x systems
|
||||||
|
Returns 'rhel9' for RHEL/AlmaLinux/Rocky 9.x systems
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
# Ubuntu/Debian → ubuntu suffix
|
# Ubuntu/Debian → ubuntu suffix
|
||||||
if self.distro == ubuntu:
|
if self.distro == ubuntu:
|
||||||
return 'ubuntu'
|
return 'ubuntu'
|
||||||
|
|
||||||
# CentOS 8+/AlmaLinux/Rocky/OpenEuler → rhel suffix
|
# CentOS 8+/AlmaLinux/Rocky/OpenEuler → detect version
|
||||||
# These systems use libcrypt.so.2 and GLIBC 2.34+
|
|
||||||
elif self.distro == cent8 or self.distro == openeuler:
|
elif self.distro == cent8 or self.distro == openeuler:
|
||||||
return 'rhel'
|
# Read /etc/os-release to get the version
|
||||||
|
if os.path.exists('/etc/os-release'):
|
||||||
|
with open('/etc/os-release', 'r') as f:
|
||||||
|
os_release = f.read().lower()
|
||||||
|
|
||||||
|
# Extract version number
|
||||||
|
for line in os_release.split('\n'):
|
||||||
|
if 'version_id' in line:
|
||||||
|
version = line.split('=')[1].strip('"').split('.')[0]
|
||||||
|
if version == '9':
|
||||||
|
return 'rhel9'
|
||||||
|
elif version == '8':
|
||||||
|
return 'rhel8'
|
||||||
|
|
||||||
|
# Default to rhel9 if version detection fails
|
||||||
|
return 'rhel9'
|
||||||
|
|
||||||
# CentOS 7 → ubuntu suffix (uses libcrypt.so.1)
|
# CentOS 7 → ubuntu suffix (uses libcrypt.so.1)
|
||||||
elif self.distro == centos:
|
elif self.distro == centos:
|
||||||
|
|
@ -371,10 +386,20 @@ class InstallCyberPanel:
|
||||||
binary_suffix = self.detectBinarySuffix()
|
binary_suffix = self.detectBinarySuffix()
|
||||||
InstallCyberPanel.stdOut(f"Detected OS type: using '{binary_suffix}' binaries", 1)
|
InstallCyberPanel.stdOut(f"Detected OS type: using '{binary_suffix}' binaries", 1)
|
||||||
|
|
||||||
# URLs for custom binaries with OS-specific suffix
|
# URLs for custom binaries with OS-specific paths
|
||||||
BASE_URL = "https://cyberpanel.net"
|
BASE_URL = "https://cyberpanel.net/binaries"
|
||||||
OLS_BINARY_URL = f"{BASE_URL}/openlitespeed-phpconfig-x86_64-{binary_suffix}"
|
|
||||||
MODULE_URL = f"{BASE_URL}/cyberpanel_ols_x86_64_{binary_suffix}.so"
|
# Set URLs based on OS type
|
||||||
|
if binary_suffix == 'rhel8':
|
||||||
|
OLS_BINARY_URL = f"{BASE_URL}/rhel8/openlitespeed-phpconfig-x86_64-rhel8"
|
||||||
|
MODULE_URL = f"{BASE_URL}/rhel8/cyberpanel_ols_x86_64_rhel8.so"
|
||||||
|
elif binary_suffix == 'rhel9':
|
||||||
|
OLS_BINARY_URL = f"{BASE_URL}/rhel9/openlitespeed-phpconfig-x86_64"
|
||||||
|
MODULE_URL = f"{BASE_URL}/rhel9/cyberpanel_ols_x86_64.so"
|
||||||
|
else: # ubuntu
|
||||||
|
OLS_BINARY_URL = f"{BASE_URL}/ubuntu/openlitespeed-phpconfig-x86_64-ubuntu"
|
||||||
|
MODULE_URL = f"{BASE_URL}/ubuntu/cyberpanel_ols_x86_64_ubuntu.so"
|
||||||
|
|
||||||
OLS_BINARY_PATH = "/usr/local/lsws/bin/openlitespeed"
|
OLS_BINARY_PATH = "/usr/local/lsws/bin/openlitespeed"
|
||||||
MODULE_PATH = "/usr/local/lsws/modules/cyberpanel_ols.so"
|
MODULE_PATH = "/usr/local/lsws/modules/cyberpanel_ols.so"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,25 +44,35 @@ class modSec:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def detectBinarySuffix():
|
def detectBinarySuffix():
|
||||||
"""Detect which binary suffix to use based on OS distribution"""
|
"""Detect which binary suffix to use based on OS distribution
|
||||||
|
Returns 'ubuntu' for Ubuntu/Debian systems
|
||||||
|
Returns 'rhel8' for RHEL/AlmaLinux/Rocky 8.x systems
|
||||||
|
Returns 'rhel9' for RHEL/AlmaLinux/Rocky 9.x systems
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
# Check if we're on RHEL/CentOS/AlmaLinux 8+ (uses libcrypt.so.2)
|
# Check if we're on RHEL/CentOS/AlmaLinux (check version)
|
||||||
if os.path.exists('/etc/os-release'):
|
if os.path.exists('/etc/os-release'):
|
||||||
with open('/etc/os-release', 'r') as f:
|
with open('/etc/os-release', 'r') as f:
|
||||||
os_release = f.read().lower()
|
os_release = f.read().lower()
|
||||||
|
|
||||||
# AlmaLinux 9+, Rocky 9+, RHEL 9+, CentOS Stream 9+
|
# Check for RHEL-based distributions
|
||||||
if any(x in os_release for x in ['almalinux', 'rocky', 'rhel']) and 'version="9' in os_release:
|
if any(x in os_release for x in ['almalinux', 'rocky', 'rhel', 'centos stream']):
|
||||||
return 'rhel'
|
# Extract version number
|
||||||
elif 'centos stream 9' in os_release:
|
for line in os_release.split('\n'):
|
||||||
return 'rhel'
|
if 'version_id' in line:
|
||||||
|
version = line.split('=')[1].strip('"').split('.')[0]
|
||||||
|
if version == '9':
|
||||||
|
return 'rhel9'
|
||||||
|
elif version == '8':
|
||||||
|
return 'rhel8'
|
||||||
|
|
||||||
# Check CentOS/RHEL path
|
# Check CentOS/RHEL path (legacy method)
|
||||||
if os.path.exists('/etc/redhat-release'):
|
if os.path.exists('/etc/redhat-release'):
|
||||||
data = open('/etc/redhat-release', 'r').read()
|
data = open('/etc/redhat-release', 'r').read()
|
||||||
# CentOS/AlmaLinux/Rocky 8+ → rhel suffix
|
if 'release 9' in data:
|
||||||
if 'release 8' in data or 'release 9' in data:
|
return 'rhel9'
|
||||||
return 'rhel'
|
elif 'release 8' in data:
|
||||||
|
return 'rhel8'
|
||||||
|
|
||||||
# Default to ubuntu
|
# Default to ubuntu
|
||||||
return 'ubuntu'
|
return 'ubuntu'
|
||||||
|
|
@ -84,12 +94,16 @@ class modSec:
|
||||||
|
|
||||||
# Detect OS and select appropriate ModSecurity binary
|
# Detect OS and select appropriate ModSecurity binary
|
||||||
binary_suffix = modSec.detectBinarySuffix()
|
binary_suffix = modSec.detectBinarySuffix()
|
||||||
|
BASE_URL = "https://cyberpanel.net/binaries"
|
||||||
|
|
||||||
if binary_suffix == 'rhel':
|
if binary_suffix == 'rhel8':
|
||||||
MODSEC_URL = "https://cyberpanel.net/mod_security-compatible-rhel.so"
|
MODSEC_URL = f"{BASE_URL}/rhel8/mod_security-compatible-rhel8.so"
|
||||||
|
EXPECTED_SHA256 = "8c769dfb42711851ec539e9b6ea649616c14b0e85a53eb18755d200ce29bc442"
|
||||||
|
elif binary_suffix == 'rhel9':
|
||||||
|
MODSEC_URL = f"{BASE_URL}/rhel9/mod_security-compatible-rhel.so"
|
||||||
EXPECTED_SHA256 = "db580afc431fda40d46bdae2249ac74690d9175ff6d8b1843f2837d86f8d602f"
|
EXPECTED_SHA256 = "db580afc431fda40d46bdae2249ac74690d9175ff6d8b1843f2837d86f8d602f"
|
||||||
else: # ubuntu
|
else: # ubuntu
|
||||||
MODSEC_URL = "https://cyberpanel.net/mod_security-compatible-ubuntu.so"
|
MODSEC_URL = f"{BASE_URL}/ubuntu/mod_security-compatible-ubuntu.so"
|
||||||
EXPECTED_SHA256 = "115971fcd44b74bc7c7b097b9cec33ddcfb0fb07bb9b562ec9f4f0691c388a6b"
|
EXPECTED_SHA256 = "115971fcd44b74bc7c7b097b9cec33ddcfb0fb07bb9b562ec9f4f0691c388a6b"
|
||||||
|
|
||||||
# Download to temp location
|
# Download to temp location
|
||||||
|
|
|
||||||
|
|
@ -633,34 +633,41 @@ class Upgrade:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def detectBinarySuffix():
|
def detectBinarySuffix():
|
||||||
"""Detect which binary suffix to use based on OS distribution
|
"""Detect which binary suffix to use based on OS distribution
|
||||||
Returns 'ubuntu' for Ubuntu/Debian systems with libcrypt.so.1
|
Returns 'ubuntu' for Ubuntu/Debian systems
|
||||||
Returns 'rhel' for RHEL/AlmaLinux/Rocky systems with libcrypt.so.2
|
Returns 'rhel8' for RHEL/AlmaLinux/Rocky 8.x systems
|
||||||
|
Returns 'rhel9' for RHEL/AlmaLinux/Rocky 9.x systems
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
# Check if we're on RHEL/CentOS/AlmaLinux 8+ (uses libcrypt.so.2)
|
# Check if we're on RHEL/CentOS/AlmaLinux (check version)
|
||||||
if os.path.exists('/etc/os-release'):
|
if os.path.exists('/etc/os-release'):
|
||||||
with open('/etc/os-release', 'r') as f:
|
with open('/etc/os-release', 'r') as f:
|
||||||
os_release = f.read().lower()
|
os_release = f.read().lower()
|
||||||
|
|
||||||
# AlmaLinux 9+, Rocky 9+, RHEL 9+, CentOS Stream 9+
|
# Check for RHEL-based distributions
|
||||||
if any(x in os_release for x in ['almalinux', 'rocky', 'rhel']) and 'version="9' in os_release:
|
if any(x in os_release for x in ['almalinux', 'rocky', 'rhel', 'centos stream']):
|
||||||
return 'rhel'
|
# Extract version number
|
||||||
elif 'centos stream 9' in os_release:
|
for line in os_release.split('\n'):
|
||||||
return 'rhel'
|
if 'version_id' in line:
|
||||||
|
version = line.split('=')[1].strip('"').split('.')[0]
|
||||||
|
if version == '9':
|
||||||
|
return 'rhel9'
|
||||||
|
elif version == '8':
|
||||||
|
return 'rhel8'
|
||||||
|
|
||||||
# Check CentOS/RHEL path
|
# Check CentOS/RHEL path (legacy method)
|
||||||
if os.path.exists(Upgrade.CentOSPath):
|
if os.path.exists(Upgrade.CentOSPath):
|
||||||
data = open(Upgrade.CentOSPath, 'r').read()
|
data = open(Upgrade.CentOSPath, 'r').read()
|
||||||
# CentOS/AlmaLinux/Rocky 8+ → rhel suffix
|
if 'release 9' in data:
|
||||||
if 'release 8' in data or 'release 9' in data:
|
return 'rhel9'
|
||||||
return 'rhel'
|
elif 'release 8' in data:
|
||||||
|
return 'rhel8'
|
||||||
# CentOS 7 → ubuntu suffix (uses libcrypt.so.1)
|
# CentOS 7 → ubuntu suffix (uses libcrypt.so.1)
|
||||||
else:
|
else:
|
||||||
return 'ubuntu'
|
return 'ubuntu'
|
||||||
|
|
||||||
# OpenEuler → rhel suffix
|
# OpenEuler → rhel9 suffix (assuming latest version)
|
||||||
if os.path.exists(Upgrade.openEulerPath):
|
if os.path.exists(Upgrade.openEulerPath):
|
||||||
return 'rhel'
|
return 'rhel9'
|
||||||
|
|
||||||
# Ubuntu/Debian → ubuntu suffix (default for unknown)
|
# Ubuntu/Debian → ubuntu suffix (default for unknown)
|
||||||
return 'ubuntu'
|
return 'ubuntu'
|
||||||
|
|
@ -788,10 +795,20 @@ class Upgrade:
|
||||||
binary_suffix = Upgrade.detectBinarySuffix()
|
binary_suffix = Upgrade.detectBinarySuffix()
|
||||||
Upgrade.stdOut(f"Detected OS type: using '{binary_suffix}' binaries", 0)
|
Upgrade.stdOut(f"Detected OS type: using '{binary_suffix}' binaries", 0)
|
||||||
|
|
||||||
# URLs for custom binaries with OS-specific suffix
|
# URLs for custom binaries with OS-specific paths
|
||||||
BASE_URL = "https://cyberpanel.net"
|
BASE_URL = "https://cyberpanel.net/binaries"
|
||||||
OLS_BINARY_URL = f"{BASE_URL}/openlitespeed-phpconfig-x86_64-{binary_suffix}"
|
|
||||||
MODULE_URL = f"{BASE_URL}/cyberpanel_ols_x86_64_{binary_suffix}.so"
|
# Set URLs based on OS type
|
||||||
|
if binary_suffix == 'rhel8':
|
||||||
|
OLS_BINARY_URL = f"{BASE_URL}/rhel8/openlitespeed-phpconfig-x86_64-rhel8"
|
||||||
|
MODULE_URL = f"{BASE_URL}/rhel8/cyberpanel_ols_x86_64_rhel8.so"
|
||||||
|
elif binary_suffix == 'rhel9':
|
||||||
|
OLS_BINARY_URL = f"{BASE_URL}/rhel9/openlitespeed-phpconfig-x86_64"
|
||||||
|
MODULE_URL = f"{BASE_URL}/rhel9/cyberpanel_ols_x86_64.so"
|
||||||
|
else: # ubuntu
|
||||||
|
OLS_BINARY_URL = f"{BASE_URL}/ubuntu/openlitespeed-phpconfig-x86_64-ubuntu"
|
||||||
|
MODULE_URL = f"{BASE_URL}/ubuntu/cyberpanel_ols_x86_64_ubuntu.so"
|
||||||
|
|
||||||
OLS_BINARY_PATH = "/usr/local/lsws/bin/openlitespeed"
|
OLS_BINARY_PATH = "/usr/local/lsws/bin/openlitespeed"
|
||||||
MODULE_PATH = "/usr/local/lsws/modules/cyberpanel_ols.so"
|
MODULE_PATH = "/usr/local/lsws/modules/cyberpanel_ols.so"
|
||||||
|
|
||||||
|
|
@ -915,13 +932,18 @@ class Upgrade:
|
||||||
|
|
||||||
# Detect OS and select appropriate ModSecurity binary
|
# Detect OS and select appropriate ModSecurity binary
|
||||||
binary_suffix = Upgrade.detectBinarySuffix()
|
binary_suffix = Upgrade.detectBinarySuffix()
|
||||||
|
BASE_URL = "https://cyberpanel.net/binaries"
|
||||||
|
|
||||||
if binary_suffix == 'rhel':
|
if binary_suffix == 'rhel8':
|
||||||
MODSEC_URL = "https://cyberpanel.net/mod_security-compatible-rhel.so"
|
MODSEC_URL = f"{BASE_URL}/rhel8/mod_security-compatible-rhel8.so"
|
||||||
|
EXPECTED_SHA256 = "8c769dfb42711851ec539e9b6ea649616c14b0e85a53eb18755d200ce29bc442"
|
||||||
|
EXPECTED_MD5 = "b7b9eb20de42b7f8c9c8f4c7a019d6ff"
|
||||||
|
elif binary_suffix == 'rhel9':
|
||||||
|
MODSEC_URL = f"{BASE_URL}/rhel9/mod_security-compatible-rhel.so"
|
||||||
EXPECTED_SHA256 = "db580afc431fda40d46bdae2249ac74690d9175ff6d8b1843f2837d86f8d602f"
|
EXPECTED_SHA256 = "db580afc431fda40d46bdae2249ac74690d9175ff6d8b1843f2837d86f8d602f"
|
||||||
EXPECTED_MD5 = "1efa1e442fe8eedf4705584ac194fc95"
|
EXPECTED_MD5 = "1efa1e442fe8eedf4705584ac194fc95"
|
||||||
else: # ubuntu
|
else: # ubuntu
|
||||||
MODSEC_URL = "https://cyberpanel.net/mod_security-compatible-ubuntu.so"
|
MODSEC_URL = f"{BASE_URL}/ubuntu/mod_security-compatible-ubuntu.so"
|
||||||
EXPECTED_SHA256 = "115971fcd44b74bc7c7b097b9cec33ddcfb0fb07bb9b562ec9f4f0691c388a6b"
|
EXPECTED_SHA256 = "115971fcd44b74bc7c7b097b9cec33ddcfb0fb07bb9b562ec9f4f0691c388a6b"
|
||||||
EXPECTED_MD5 = "c3987c41182355c1290530b6553658db"
|
EXPECTED_MD5 = "c3987c41182355c1290530b6553658db"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue