Commit Graph

4974 Commits

Author SHA1 Message Date
usmannasir
e19c466915 Fix account switcher: ng-if creates child scope breaking ng-model binding, use ng-show instead 2026-03-05 05:42:44 +05:00
usmannasir
d1e682885d Fix account switcher: send fromAccount with every API call instead of relying solely on session 2026-03-05 05:39:55 +05:00
usmannasir
a9f48d6781 Fix account switcher: use currentEmail as ng-model so display updates immediately 2026-03-05 05:34:32 +05:00
usmannasir
3705dcc7b8 Add cache-busting query param to webmail JS include 2026-03-05 05:31:21 +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
6085364c98 Fix webmail to match CyberPanel Dovecot/Postfix configuration
- Use correct Dovecot namespace (separator='.', prefix='INBOX.'):
  folders are INBOX.Sent, INBOX.Drafts, INBOX.Deleted Items, etc.
- Quote IMAP folder names with spaces (e.g. "INBOX.Deleted Items")
- Add display_name and folder_type to folder list API response
- Fix SMTP for SSO: use local relay on port 25 (permit_mynetworks)
  since Dovecot has no auth_master_user_separator for port 587
- Fix Sieve SASL PLAIN auth to use clean RFC 4616 format
- Handle ManageSieve unavailability gracefully with helpful logging
- Update frontend to show clean folder names and correct icons
- Auto-prefix new folder names with INBOX. namespace
2026-03-05 03:08:07 +05:00
usmannasir
72f33d3bcd Add integrated webmail client with SSO, contacts, and Sieve rules
Replace SnappyMail link with a custom Django webmail app that provides:
- Full IMAP/SMTP integration (Dovecot + Postfix) with master user SSO
- 3-column responsive UI matching CyberPanel design system
- Compose with rich text editor, attachments, reply/forward
- Contact management with auto-collect from sent messages
- Sieve mail filter rules with ManageSieve protocol support
- Standalone login page for direct webmail access
- Account switcher for admins managing multiple email accounts
- HTML email sanitization (whitelist-based, external image proxy)
- Draft auto-save and per-user settings
2026-03-05 02:49: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
Master3395
b2eb5090e0 Merge pull request #1682 from master3395/v2.4.4
V2.4.4
2026-02-26 21:10:42 +01:00
Master3395
c88752ae44 Merge branch 'usmannasir:v2.4.4' into v2.4.4 2026-02-14 21:57:28 +01:00
usmannasir
41a9d84974 Add testing section to README for OLS feature test suite 2026-02-14 06:29:53 +05:00
usmannasir
0c41d4e41a Add OLS feature test suite (128 tests)
Phase 1 (56 tests): Live environment tests covering binary integrity,
CyberPanel module, Auto-SSL config, LE certificates, SSL listener
auto-mapping, cert serving, HTTPS/HTTP functional tests, .htaccess
processing, VHost config integrity, origin header forwarding, PHP config.

Phase 2 (72 tests): ReadApacheConf directive tests covering Include,
global tuning, listener creation, ProxyPass, IfModule, VHost creation,
SSL deduplication, Directory/Location blocks, PHP version detection,
ScriptAlias, HTTP/HTTPS functional tests, process health, graceful restart.
2026-02-14 06:27:58 +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
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
master3395
dd74ff5c67 Fix issue #1643: Fix downloadFile function to properly parse query parameters
- Changed from incorrect URI splitting to proper request.GET.get() method
- Added proper URL decoding with unquote()
- Fixed both downloadFile and RootDownloadFile functions
- Preserved existing security checks (symlink detection, path traversal prevention)
- Added path normalization for additional security
- Improved error messages to match reported error format

This fixes the 'Unauthorized access: Not a valid file' error when downloading files from the file manager.
2026-01-07 23:46:11 +01:00
master3395
86c937d49a Revert "Refactor: replace url() with path() for Django routes in plugin Installer"
This reverts commit 553b4ccf54.
2026-01-06 19:28:40 +01:00
master3395
553b4ccf54 Refactor: replace url() with path() for Django routes in plugin Installer
- Updated pluginHolder/urls.py to use path() instead of url()
- Added new API routes for plugin installation, uninstallation, enable, and disable
- Compatible with Django 4.x (url() was removed in Django 4.0)

Ref: PR 1644
2026-01-06 19:26:35 +01:00
usmannasir
83da9a7ae4 Merge branch 'v2.4.4' of github.com:usmannasir/cyberpanel into v2.4.4 2026-01-05 16:43:45 +05:00
usmannasir
143a2c2897 cloud api docs 2026-01-05 16:43:10 +05:00
Master3395
6c2aebd27e Merge pull request #1636 from master3395/v2.4.4
Fix SSH Logins and SSH Logs tables, to show the correct way.
2026-01-04 00:58:52 +01:00
master3395
ed5af068ec Remove pagination from SSH Logins and SSH Logs tables, display all results directly 2026-01-04 00:55:25 +01:00
usmannasir
df3841be71 openlitespeed .htaccess module documentation 2025-12-28 22:43:02 +04:00
usmannasir
35770ea2f5 Merge branch 'v2.4.4' of github.com:usmannasir/cyberpanel into v2.4.4 2025-12-28 22:41:49 +04:00
usmannasir
4b97b20f04 openlitespeed .htaccess module documentation 2025-12-28 22:40:56 +04: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
3fc1aba229 fix: update custom OLS binaries and add ModSecurity compatibility
- Update SHA256 checksums for December 2025 OLS build (v1.8.4.1)
- Add RHEL8 module support (cyberpanel_ols_x86_64_rhel8.so)
- Add compatible ModSecurity binaries to prevent ABI crashes
- Auto-detect and replace ModSecurity when custom OLS is installed
- Add auto-rollback feature if new binary fails to start
- Fix OWASP CRS UI toggle detection with multi-location checks

Features included in new binaries:
- PHPConfig support (.htaccess php_value/php_flag)
- Origin header forwarding (CORS/WebSocket support)
- Header unset fix (uses remove_resp_header API)
- Static linking for cross-platform compatibility

Platforms supported:
- Ubuntu 22.04+/Debian 12+ (ubuntu-static)
- AlmaLinux/Rocky/RHEL 9.x (rhel9-static)
- AlmaLinux/Rocky/RHEL 8.x (rhel8-static)
2025-12-27 21:07:16 +05:00
usmannasir
f9e600345f bug fix in n8n deployment 2025-12-26 14:24:13 +05:00
usmannasir
db35838f72 Merge branch 'v2.4.4' of github.com:usmannasir/cyberpanel into v2.4.4 2025-12-25 20:22:45 +04:00
usmannasir
69087dfeda bug fix: improve sub domain page 2025-12-25 20:22:30 +04:00
usmannasir
0a099b1b19 Merge branch 'v2.4.4' of github.com:usmannasir/cyberpanel into v2.4.4 2025-12-18 13:10:48 +05:00
usmannasir
94bf2bdeef Merge branch 'v2.4.4' into v2.4.4-dev 2025-12-18 12:18:37 +05:00
usmannasir
eca0c3cbeb security fixes 2025-12-18 12:18:32 +05:00
usmannasir
a2f9cf99eb Fix ACL child domain permission issues for non-admin users
- Fix checkOwnership() to return explicit 0 instead of None when checking child domain ownership
  This resolves permission failures for non-admin ACL users trying to manage child domains

- Improve fetchChildDomainsMain() with more robust child domain filtering
  Changed from .filter(alais=0) to .all() with explicit check to prevent silent failures

- Add error logging with traceback to fetchChildDomainsMain() for better debugging

These changes allow non-admin users with proper ACL permissions to view and manage
child domains for websites they own.
2025-12-14 17:59:19 +04:00
usmannasir
ea635b5f01 Fix n8n container health check to use fuzzy name matching
The container health check was failing because Docker Compose v1 and v2
use different naming conventions:
- v1: project_service_1 (underscores)
- v2: project-service-1 (hyphens)

Changes:
1. Replaced hardcoded container name formatting with fuzzy matching
2. Added find_container_by_service() helper method for dynamic lookup
3. Updated monitor_deployment() to use dynamic container discovery
4. Container names are now found by normalizing and matching patterns

This fixes "Containers failed to reach healthy state" errors during
n8n deployment from CyberPanel UI.

Ticket References: XKTFREZUR, XCGF2HQUH
2025-11-29 04:56:23 +04:00
usmannasir
36f7068e1d Fix: Use upgrade.py for email filtering tables instead of Django migrations
- Remove Django migration file that caused model resolution errors
- Add CREATE TABLE statements to mailServerMigrations() in upgrade.py
- Tables created: e_catchall, e_server_settings, e_plus_override, e_pattern_forwarding
2025-11-28 15:08:49 +05:00
usmannasir
3c16b934af Fix migration: use raw SQL for tables since existing models lack migrations 2025-11-28 15:05:44 +05:00
usmannasir
082c63bfa9 Add advanced email filtering features: catch-all, plus-addressing, and pattern forwarding
Features:
- Catch-All Email: Forward unmatched emails for a domain to a single address
- Plus-Addressing: Enable user+tag@domain.com delivery with configurable delimiter
- Pattern Forwarding: Wildcard and regex-based email forwarding rules

Implementation:
- New database models: CatchAllEmail, EmailServerSettings, PlusAddressingOverride, PatternForwarding
- New UI pages with AngularJS controllers
- Backend methods in mailserverManager.py with ACL permission checks
- Auto-generates /etc/postfix/virtual_regexp for pattern rules
- Menu items added under Email section
2025-11-28 14:22:34 +05:00
usmannasir
d3621923e5 Fix n8n v1.87.0+ compatibility with OpenLiteSpeed reverse proxy
1. Set NODE_ENV=development for n8n Docker deployments to resolve Origin
   header validation failures.

2. Remove ineffective "RequestHeader set Origin" from vhost configuration
   since OpenLiteSpeed cannot override browser Origin headers anyway.

This is required due to an OpenLiteSpeed architectural limitation - OLS
cannot override browser Origin headers, which n8n v1.87.0+ strictly
validates in production mode. Apache and Nginx can override Origin headers
and work in production mode, but this is not possible with OpenLiteSpeed.

Security Note: This change does NOT reduce security:
- User authentication remains enforced
- Password hashing (bcrypt/argon2) still secure
- HTTPS encryption still active
- Session management secure with N8N_SECURE_COOKIE=true
- CSRF protection still active

Only the origin validation check is bypassed, which fails anyway due to
the OLS limitation.

Ticket References: XKTFREZUR, XCGF2HQUH
2025-11-28 14:16:46 +05:00