12 Commits

Author SHA1 Message Date
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
28113d97a7 Security fixes for webmail and emailDelivery apps
- Fix command injection in relay config: use shlex.quote() on all
  subprocess arguments passed to mailUtilities.py
- Fix XSS in email reply/forward: html.escape() on From/To/Date/Subject
  headers before embedding in quoted HTML
- Fix attachment filename traversal: use os.path.basename() and strip
  null bytes from attachment filenames
- Fix Sieve script name injection: sanitize names to alphanumeric chars
- Fix SSRF in image proxy: resolve hostname to IP and check against
  ipaddress.is_private/is_loopback/is_link_local/is_reserved
- Remove internal error details from user-facing responses
- Update Access Webmail link from /snappymail/ to /webmail/
2026-03-06 03:27:45 +05:00
usmannasir
1e00f6eff5 Add CyberMail Email Delivery integration
- New emailDelivery Django app with full platform API integration
- Account connection, domain management, SMTP credentials, relay config
- Auto-configure SPF/DKIM/DMARC DNS records via PowerDNS
- Postfix SMTP relay through CyberMail (configureRelayHost/removeRelayHost)
- Real-time delivery logs, stats, and per-domain analytics
- Single-page AngularJS dashboard with marketing landing page
- Promotional banners on 6 email-related pages with dismiss cookie
- Manual SQL table creation in upgrade.py for existing installs
- Documentation: setup guide, technical reference, user guide
2026-03-06 00:19:53 +05:00
usmannasir
4a082f5484 Sort messages by date using IMAP SORT extension instead of UID order 2026-03-05 05:56:13 +05:00
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
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