Commit Graph

75 Commits

Author SHA1 Message Date
usmannasir
a9f5decf9d Merge branch 'v2.4.5' into stable 2026-03-06 19:19:16 +05:00
usmannasir
cc9d830507 Fix SMTP relay on AlmaLinux/RHEL: install cyrus-sasl-plain package
Postfix SASL PLAIN auth fails with "No worthy mechs found" on
RHEL/AlmaLinux because cyrus-sasl-plain is not installed by default.
- Add cyrus-sasl-plain to postfix install in install.py
- Auto-install in configureRelayHost() for existing servers
- Add to upgrade.py setupSieve() for existing installations
2026-03-06 18:36:41 +05:00
usmannasir
abc901f1c8 Fix fresh install crash: replace plogical imports in installCyberPanel.py
installSieve() and setupWebmail() imported from plogical module which
doesn't exist during fresh install (CyberPanel code not yet deployed).
- Replace FirewallUtilities.addSieveFirewallRule() with direct firewall-cmd/ufw calls
- Replace generate_pass() with inline secrets.choice() password generation
2026-03-06 17:10:08 +05:00
usmannasir
1e6e60a0e9 Revert webmail.conf ownership to cyberpanel:cyberpanel
CyberPanel Python app runs as cyberpanel user (lscpd is just the web
server). The webmail.conf must be readable by cyberpanel, not lscpd.
2026-03-06 16:29:34 +05:00
usmannasir
7fe521e1b3 Fix webmail.conf ownership: use lscpd:lscpd instead of cyberpanel:cyberpanel
lscpd worker runs as user lscpd, not cyberpanel. The webmail.conf file
(containing master user credentials) was unreadable by lscpd, causing
master auth to silently fail and fall back to empty password auth.
Also fix ownership on existing installs during upgrade.
2026-03-06 16:24:42 +05:00
usmannasir
485dd27257 Fix dovecot-mysql missing on AlmaLinux 9+: use standard packages instead of gf-plus
AlmaLinux 9 uses standard dovecot/dovecot-mysql packages from OS repos,
not dovecot23/dovecot23-mysql from Ghettoforge. Also fix openeuler path
which was missing dovecot-mysql entirely.
2026-03-06 16:17:19 +05:00
usmannasir
1d33ba0107 Improve Sieve: folder dropdown in rules UI, INBOX. prefix fix, robust upgrade regexes
- Replace free text input with folder dropdown for move-to-folder rules
- Auto-prefix INBOX. namespace to folder names in sieve scripts
- Strip INBOX. prefix when parsing sieve scripts back to rules
- Make upgrade setupSieve() regexes more flexible to handle config variations
- Add os.makedirs for conf.d directory in both install and upgrade
- Validate ManageSieve config with both inet_listener and service checks
2026-03-06 03:50:03 +05:00
usmannasir
3a0729156a Fix Sieve storage: add home dir to user_query, sieve plugin paths, and mailbox autocreate
- Add home directory (CONCAT) to dovecot-sql.conf.ext user_query so sieve
  can locate script storage per user
- Add sieve/sieve_dir plugin settings to dovecot.conf templates
- Add lda_mailbox_autocreate/autosubscribe so fileinto creates missing folders
- Update setupSieve() upgrade function to patch all three on existing installs
2026-03-06 03:39:04 +05:00
usmannasir
008cc7da0e Enable Sieve email filtering in install and upgrade for all OS
- Add sieve to dovecot protocols in both dovecot.conf templates
- Add sieve plugin to LDA mail_plugins in dovecot.conf templates
- Write ManageSieve config (20-managesieve.conf) during installSieve()
- Add setupSieve() upgrade function: patches dovecot.conf, installs
  packages (dovecot-sieve/managesieved on Ubuntu, pigeonhole on CentOS),
  writes ManageSieve config, opens firewall port 4190, restarts dovecot
- Call setupSieve() in main upgrade flow
2026-03-06 03:32:04 +05:00
usmannasir
36f0185708 Fix webmail SSO setup in install and upgrade
Install setupWebmail() now creates /etc/cyberpanel dir if missing,
patches dovecot.conf with master passdb block if absent, and skips
gracefully when already configured. Prevents webmail auth failures
on fresh installs where the directory didn't exist yet.

Also adds cybermail_accounts and cybermail_domains CREATE TABLE
statements to upgrade.py applyLoginSystemMigrations() for the
emailDelivery app on existing installs.
2026-03-06 01:15:04 +05:00
usmannasir
7e86659a55 Fix missing mail TLS certs: copy self-signed certs to /etc/pki/dovecot/ at install and upgrade
On Ubuntu, the install creates /etc/pki/dovecot/ directories but never
populates them with certs. Postfix main.cf references these paths for
STARTTLS. Without them, inbound STARTTLS fails and external mail servers
(Gmail etc.) drop the connection, preventing mail delivery.
2026-03-05 05:54:09 +05:00
usmannasir
632dc3fbe9 Fix critical webmail bugs: XSS, SSRF, install ordering, and UI issues
Security fixes:
- Escape plain text body to prevent XSS via trustAsHtml
- Add SSRF protection to image proxy (block private IPs, require auth)
- Sanitize Content-Disposition filename to prevent header injection
- Escape Sieve script values to prevent script injection
- Escape IMAP search query to prevent search injection

Install/upgrade fixes:
- Move setupWebmail() call to after Dovecot is installed (was running
  before doveadm existed, silently failing on every fresh install)
- Make setupWebmail() a static method callable from install.py
- Fix upgrade idempotency: always run dovecot.conf patching and
  migrations even if webmail.conf already exists (partial failure recovery)

Frontend fixes:
- Fix search being a no-op (was ignoring results and just reloading)
- Fix loading spinner stuck forever on API errors (add errback)
- Fix unread count decrementing on already-read messages
- Fix draft auto-save timer leak when navigating away from compose
- Fix composeToContact missing signature and auto-save
- Fix null subject crash in reply/forward
- Clear stale data when switching accounts
- Fix attachment part_id mismatch between parser and downloader

Backend fixes:
- Fix Sieve _read_response infinite loop on connection drop
- Add login check to apiSaveDraft
2026-03-05 05:10:14 +05:00
usmannasir
6a61e294a9 Fix webmail account switcher and improve error handling
- Fix apiSSO() resetting selected account to first one on every call,
  now preserves previously selected account if still valid
- Fix webmail.conf ownership to use cyberpanel:cyberpanel (Django runs
  as cyberpanel user, not nobody)
- Add error notifications when SSO or folder loading fails
2026-03-05 05:01:45 +05:00
usmannasir
fd7960f790 Automate Dovecot master user setup for webmail SSO in install and upgrade
Adds master passdb config to dovecot.conf templates, setupWebmail() to
the installer and upgrade paths to generate credentials and create
/etc/dovecot/master-users and /etc/cyberpanel/webmail.conf automatically.
The upgrade path is idempotent and patches existing dovecot.conf if needed.
2026-03-05 03:39:00 +05:00
usmannasir
39baa9b05e Update cyberpanel_ols module hashes for SIGSEGV crash fix
Rebuilt module fixes NULL pointer dereference in apply_headers() when
OLS generates error responses (4xx/5xx). The get_req_var_by_id() call
for DOC_ROOT crashed because request variables aren't initialized
during error response generation. Fix adds status code guard to skip
header processing for error responses.
2026-03-04 16:46:21 +05:00
usmannasir
050425c019 Update OLS binary hashes for SSL listener auto-map fix
rhel9:  418d2ea06e29c0f847a2e6cf01f7641d5fb72b65a04e27a8f6b3b54d673cc2df
ubuntu: 60edf815379c32705540ad4525ea6d07c0390cabca232b6be12376ee538f4b1b
rhel8:  d08512da7a77468c09d6161de858db60bcc29aed7ce0abf76dca1c72104dc485
2026-02-14 02:22:03 +05:00
usmannasir
78650a6d60 Update OLS binary hashes for SSL listener auto-map fix
New hashes for all 3 platforms after fixing the bug where VHosts with
SSL context but missing listener map entries served the wrong cert.

rhel9:  04921afbad94e7ee69bc93a73985e318df93f28b2b0d578447b0ef43dc6e3818
ubuntu: ae2564742f362d3e34ea814dff37edeb8f8b73ae9ca1484ba78e2453a3987429
rhel8:  855b6bccb4a7893914506a07185cffd834bd31a7f7c080b5b4190283def7fa3e
2026-02-14 01:18:18 +05:00
usmannasir
0c07293d1a Use regex for Auto-SSL config injection to handle any adminEmails value
The previous string replace only matched 'adminEmails               root@localhost'
exactly. On fresh OLS installs where adminEmails may have a different value
or different spacing, the replace would silently fail and Auto-SSL config
would never be injected. Use re.sub to match the adminEmails line regardless
of its value.
2026-02-14 00:43:30 +05:00
usmannasir
cedbbd27e8 Fix Auto-SSL config injection appending garbage to acmeEmail line
The string replace matched only 'adminEmails' keyword instead of the
full existing line 'adminEmails               root@localhost', causing
the remaining '               root@localhost' to trail onto the acmeEmail
line and break ACME account registration.
2026-02-14 00:16:34 +05:00
usmannasir
5e304f9481 Enable Auto-SSL injection during fresh install 2026-02-13 15:46:48 +04:00
usmannasir
aed1f29eb1 Update OLS binary hashes for Ubuntu/RHEL8 and enable Auto-SSL support 2026-02-13 14:47:22 +04:00
usmannasir
6aea18c808 Merge v2.4.4 into stable 2026-02-13 14:14:15 +04:00
usmannasir
5f3b6253a9 Update OLS binary hashes for all 3 platforms (Plesk test verified) 2026-02-13 13:54:25 +04:00
usmannasir
9f244ffca8 Update RHEL 9 OLS binary hash after default VHost wildcard rebuild 2026-02-13 03:10:23 +05:00
usmannasir
fb31c7686c Update OLS binary hashes for Ubuntu and RHEL 8 (default VHost wildcard fix) 2026-02-13 02:59:08 +05:00
usmannasir
dfef3acaac Update OLS binary SHA256 hashes for rebuilt v2.4.4 binaries 2026-02-12 16:07:27 +05:00
usmannasir
7c35b292ad Update OLS binary URLs and hashes to v2.4.4
Universal binaries with all features config-driven (PHPConfig API, Origin
Header Forwarding, ReadApacheConf with Portmap, Auto-SSL ACME v2,
ModSecurity ABI compatibility). Updates install, upgrade, and modSec paths.
2026-02-12 14:08:29 +05:00
usmannasir
06f1f78598 update OLS module to v2.2.0 with progressive throttle
- Update module checksums for all platforms (rhel8, rhel9, ubuntu)
- Simplify module URLs to cyberpanel_ols.so
- Fixed BruteForceAllowedAttempts parsing
- Implemented progressive throttle (2s/5s/15s delays)
2025-12-28 15:24:04 +05:00
usmannasir
30e4d2d28b update OLS module checksums for Phase 2 Brute Force Protection
- Update cyberpanel_ols module URLs to use /binaries/ path structure
- Update SHA256 checksums for all platforms (rhel8, rhel9, ubuntu)
- Enable RHEL 8 module support (was previously disabled)
- Module version 2.2.0 with Phase 2 features
2025-12-28 02:49:41 +05:00
usmannasir
bbd0c4e136 Update OpenLiteSpeed custom binaries to v2.0.5 static builds
Updates binary checksums and URLs for OpenLiteSpeed custom builds with
static linking support. Static-linked binaries provide cross-platform
compatibility (Ubuntu 22/24, RHEL 8/9) by embedding libstdc++ and libgcc,
eliminating version-specific crashes.

Changes:
- Updated all SHA256 checksums for static binary builds
- Simplified URLs: removed /binaries/ subdirectory path
- Added -static suffix to binary filenames
- Added conditional module installation (RHEL 8 has no module)
- Updated version references from v2.0.4 to v2.0.5
- Enhanced installation messages to indicate static linking

Binary checksums (v2.0.5):
- Ubuntu static: 89aaf66474e78cb3c1666784e0e7a417550bd317e6ab148201bdc318d36710cb
- RHEL 9 static: 90468fb38767505185013024678d9144ae13100d2355097657f58719d98fbbc4
- RHEL 8 static: 6ce688a237615102cc1603ee1999b3cede0ff3482d31e1f65705e92396d34b3a
- Ubuntu module: e7734f1e6226c2a0a8e00c1f6534ea9f577df9081b046736a774b1c52c28e7e5
- RHEL 9 module: 127227db81bcbebf80b225fc747b69cfcd4ad2f01cea486aa02d5c9ba6c18109

Benefits:
- Cross-platform compatibility across OS versions
- Automatic checksum verification for security
- Graceful handling of platform-specific limitations
- Simplified download URLs for easier maintenance

Files modified:
- install/installCyberPanel.py
- plogical/upgrade.py
2025-11-18 14:02:39 +05:00
usmannasir
e1eefebbfb Add platform-specific OpenLiteSpeed binaries with SHA256 checksum verification
This update adds automatic platform detection and checksum verification for
OpenLiteSpeed custom binaries during installation and upgrade.

Changes:
- Add detectPlatform() method to detect RHEL 8, RHEL 9, and Ubuntu
- Update binary URLs to use platform-specific paths:
  * RHEL 8: /binaries/rhel8/
  * RHEL 9: /binaries/rhel9/
  * Ubuntu: /binaries/ubuntu/
- Add SHA256 checksum verification to downloadCustomBinary()
- Update installCustomOLSBinaries() to use platform-specific checksums

Binary Versions (OpenLiteSpeed v1.8.4.1 - Module v2.0.4):
- RHEL 8 Module: 1cc71f54d8ae5937d0bd2b2dd27678b47f09f4f7afed2583bbd3493ddd05877f
- RHEL 9 Module: 127227db81bcbebf80b225fc747b69cfcd4ad2f01cea486aa02d5c9ba6c18109
- Ubuntu Module: d070952fcfe27fac2f2c95db9ae31252071bade2cdcff19cf3b3f7812fa9413a
- All Binary: a6e07671ee1c9bcc7f2d12de9e95139315cf288709fb23bf431eb417299ad4e9

Files modified:
- install/installCyberPanel.py
- plogical/upgrade.py
2025-11-17 00:42:28 +05:00
usmannasir
fb76981ff2 Fix Python 3.6 compatibility in binary verification
Replace capture_output parameter with stdout/stderr PIPE for Python 3.6
compatibility. The capture_output parameter was added in Python 3.7 and
causes errors on AlmaLinux 8 which uses Python 3.6.

Changed subprocess.run() calls to use:
- stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True
Instead of:
- capture_output=True, text=True
2025-11-09 20:55:00 +05:00
usmannasir
2e8d9d5e8e conflict fix 2025-11-09 19:34:57 +05:00
usmannasir
6b999e5c8b Fix RHEL 9 binary filenames to match server structure
RHEL 9 binaries use '-rhel' suffix instead of '-rhel9':
- openlitespeed-phpconfig-x86_64-rhel (not rhel9)
- cyberpanel_ols_x86_64_rhel.so (not rhel9.so)

Updated URLs in install and upgrade modules to use correct filenames.
2025-11-09 17:14:47 +05:00
usmannasir
7c6ce4cd72 Fix OS detection to prioritize Ubuntu/Debian check
Ubuntu systems were incorrectly being detected as rhel9. Added explicit
Ubuntu/Debian check at the beginning of detectBinarySuffix() before
checking for RHEL-based distributions.

This ensures Ubuntu and Debian systems are properly identified and use
the correct binaries from the ubuntu/ directory instead of rhel9/.
2025-11-09 17:12:23 +05:00
usmannasir
20254f467c 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.
2025-11-09 12:10:43 +05:00
usmannasir
f7fc75b258 Add binary verification and rollback mechanism for OLS custom binaries
Implement safety checks to verify custom OpenLiteSpeed binaries work before committing to them:

Verification checks:
- Check library dependencies with ldd to detect missing libraries
- Test binary execution with -v flag to ensure it can run
- Detect issues like wrong binary type (ubuntu vs rhel) for the OS

Rollback mechanism:
- Automatically restore original binary from backup if verification fails
- Remove incompatible custom module
- Continue installation with standard OLS if custom binary fails

This prevents installation failures and system downtime when:
- Wrong binary type is downloaded due to OS detection issues
- Library dependencies are missing
- Binary cannot execute on the target system

Changes:
- Added verifyCustomBinary() method to check dependencies and execution
- Added rollbackCustomBinary() method to restore from backup
- Updated installCustomOLSBinaries() to verify and rollback on failure
- Applied to both install/installCyberPanel.py and plogical/upgrade.py

Benefits:
- Zero downtime: System falls back to working binary automatically
- Better error reporting: Shows which libraries are missing
- Safer upgrades: Users won't be left with broken installations
2025-11-07 13:50:47 +05:00
usmannasir
39b74cb9b7 Fix OLS binary compatibility by detecting OS distribution
Add OS detection logic to download correct OpenLiteSpeed binaries based on system type:
- Ubuntu/Debian systems: Download binaries with libcrypt.so.1 (GLIBC 2.35)
- RHEL/AlmaLinux/Rocky 8+/9+: Download binaries with libcrypt.so.2 (GLIBC 2.34)

This fixes the "libcrypt.so.2: cannot open shared object file" error that occurred
when Ubuntu systems tried to use RHEL-compiled binaries.

Changes:
- Added detectBinarySuffix() method to both installCyberPanel.py and upgrade.py
- Updated binary URLs to use https://cyberpanel.net with OS-specific suffix
- Module URL: cyberpanel_ols_x86_64_{ubuntu|rhel}.so
- Binary URL: openlitespeed-phpconfig-x86_64-{ubuntu|rhel}

Binary compatibility matrix:
- Ubuntu 20.04/22.04/24.04, Debian 10+, CentOS 7 → ubuntu binaries
- AlmaLinux 8+/9+, Rocky 8+/9+, RHEL 8+/9+, OpenEuler → rhel binaries
2025-11-07 12:52:15 +05:00
usmannasir
2952791761 Lower download size threshold to support smaller module files
Reduce minimum file size from 1MB to 10KB to allow the module file
(~35KB) to pass validation. The 1MB threshold was too strict and only
appropriate for the main OLS binary. Now displays size in KB or MB
appropriately.
2025-11-05 09:24:34 +05:00
usmannasir
32a7442dba Fix download verification logic for custom OLS binaries
Change download verification to check file existence and size instead of
relying on return code. The wget command succeeds but install_utils.call()
may not return 0. Now verifies downloaded file exists and is at least 1MB.
2025-11-05 06:08:48 +05:00
usmannasir
73ec9950ec Fix OLS binary download URL
Remove 'downloads' path from OLS binary URL to match correct location
2025-11-05 05:57:01 +05:00
usmannasir
e4a06a8aaf Fix custom module download URL
Correct the module URL to https://cyberpanel.net/cyberpanel_ols_x86_64.so
2025-11-05 05:56:27 +05:00
usmannasir
f907351873 Add custom OpenLiteSpeed binary installation with .htaccess PHP config support
Integrate custom OLS binaries during installation to enable Apache-style
php_value/php_flag directives in .htaccess files. The installer now:

- Downloads custom OLS binary and module from cyberpanel.net
- Creates backup of existing binaries before replacement
- Installs custom binaries with enhanced .htaccess support
- Configures CyberPanel module in OpenLiteSpeed config
- Gracefully falls back to standard OLS if download fails
- Only installs on x86_64 architecture

Features enabled by custom binaries:
- Apache-style .htaccess support
- php_value and php_flag directives
- Enhanced header control
- Better Apache compatibility
2025-11-05 05:38:31 +05:00
usmannasir
99b0476358 Merge branch 'v2.4.4' into stable 2025-10-27 19:54:08 +05:00
usmannasir
ac6db0e575 bug fix: python 3.6 compatibility 2025-10-10 17:26:50 +05:00
usmannasir
e4b2584ae0 Fix AlmaLinux 8 installation: Add python-dotenv to requirements (v2.4.4)
- Install python-dotenv in virtual environment during CyberPanel setup
- Fixes Django's inability to load .env file on AlmaLinux 8
- Resolves "Access denied for user 'cyberpanel'@'localhost'" errors
- Added to all installation paths (normal, DEV, and after_install)

This ensures Django can properly load database credentials from .env file
on AlmaLinux 8 systems where python-dotenv was missing.
2025-10-10 01:00:22 +05:00
usmannasir
f34377394d Fix AlmaLinux 8 installation: Add python-dotenv to requirements
- Install python-dotenv in virtual environment during CyberPanel setup
- Fixes Django's inability to load .env file on AlmaLinux 8
- Resolves "Access denied for user 'cyberpanel'@'localhost'" errors
- Added to all installation paths (normal, DEV, and after_install)

This ensures Django can properly load database credentials from .env file
on AlmaLinux 8 systems where python-dotenv was missing.
2025-10-10 00:57:24 +05:00
usmannasir
d540b24c8f bug fix: alma8 install 2025-10-10 00:09:42 +05:00
usmannasir
26425dd397 bug fix: allowed host issue 2025-09-15 12:07:15 +05:00
Master3395
1a82700f51 Update PHP version references and improve AlmaLinux 9 compatibility
- Changed PHP symlink from version 8.0 to 8.3 in various scripts to ensure compatibility with the latest PHP version.
- Updated documentation links in the FAQ to point to the new community support page.
- Added checks and fixes for MariaDB installation issues specific to AlmaLinux 9.
- Enhanced the installation script to support additional PHP versions and improve overall installation reliability.
2025-09-15 01:25:52 +02:00