Mail Server Series — Part 17
In Parts 1–16, we built a fully containerized, enterprise-grade mail system including:
- Postfix SMTP
- Dovecot IMAP/LMTP
- Amavis content filtering
- ClamAV antivirus
- SpamAssassin + SQL Bayes
- DKIM / SPF / DMARC
- SNI-based TLS
- Reverse Proxy with HTTPS
- Piler for mail archiving
- Manticore for full-text search
- Monitoring with Prometheus & Grafana
However, an enterprise-ready mail system is not complete unless security, auditability, and data governance are properly implemented.
Part 17 provides a full framework for securing, governing, and auditing your entire email ecosystem.
1. Security Governance — The First Line of Defense
Email is one of the most heavily attacked systems in any organization. Threats include:
- spoofing
- phishing
- malware attachments
- compromised accounts (spam relay)
- MITM modification of emails
- insider misuse
We categorize email security into four domains.
1.1 Sender Identity Authentication
A secure enterprise mail system MUST implement:
✔ SPF
✔ DKIM
✔ DMARC
You have already implemented:
- DKIM signing via Amavis
- SPF TXT records
- DMARC policy + rua / ruf reports
Enterprise-level expectations:
- SPF must end with
-all - DKIM keys must be at least 2048 bits
- DMARC policy should be
quarantineorreject - DMARC reports must be analyzed daily (I can help you build a dashboard)
1.2 Transport Security (TLS)
Requirements:
- All SMTP/IMAP traffic uses TLS 1.2+
- submission (587) and smtps (465) enforce encryption
- Legacy ciphers and SSL versions disabled
Your deployment already includes:
- Postfix SNI
- Let’s Encrypt certificates
- HTTPS reverse proxy
This is fully enterprise-compliant.
1.3 Account Security Controls
Must include:
- Strong password policy enforcement
- Login-failure thresholds (Dovecot)
- Optional MFA via Keycloak / SSO
- GeoIP-based login restrictions
1.4 Spam, Malware & Reputation Defense
You have deployed:
- SpamAssassin (SQL Bayes, TxRep)
- Amavis
- ClamAV
- Remote learning via IMAPSieve
- Sieve-based spam/ham feedback
This is significantly stronger than most enterprise mail setups.
2. Audit Governance — Ensuring Traceability & Accountability
Auditability is essential in corporate environments for compliance, legal cases, and internal investigations.
2.1 System-level Audit Logging
Postfix:
Complete SMTP flow logging with queue ID traceability.
Dovecot:
Logs all authentication events, message movements, deletions.
Amavis:
Full virus and content filtering logs.
Your architecture supports:
👉 Centralized log aggregation (ELK / Loki)
2.2 Piler Archival Audit Logging
You have enabled:
- login audit logs
- search audit logs
- message access logs
- query filters
- permission validation
This fulfills requirements typical of public companies and internal control frameworks.
2.3 Manticore Search Auditability
Enable auditing for:
- search keywords
- sensitive data queries
- abnormal query volume patterns
- potential insider threats
With slow log + query log + Prometheus exporters, search auditing becomes comprehensive.
3. Data Governance — The Legal and Compliance Backbone
Email is one of the most critical sources of:
- legal evidence
- corporate knowledge
- intellectual property
- customer communication history
Proper governance ensures:
- retention
- searchability
- immutability
- lawful deletion
- privacy
3.1 Retention Policy
Your Piler default_retention_days = 2557
→ ~7 years
This aligns with:
- corporate internal control
- tax and financial regulations
- common legal discovery windows
- PDPA / GDPR adjustable exceptions
3.2 Data Sovereignty
Your system is entirely self-hosted:
- mail data
- attachments
- archive store
- indexes
- databases
This ensures:
- no data leakage to foreign cloud providers
- improved privacy and compliance
- maximum operational autonomy
3.3 Data Lifecycle Management
Suggested enhancements:
✔ Cold archive storage
Via:
- ZFS
- MinIO (S3)
- NAS object storage
✔ Auto-deletion policy
- 7-year expiry
- legal hold override
- case-based retention extension
4. Incident Response (IR): Email Security Playbook
Email incidents are common and must follow a strict SOP.
4.1 Typical Incident Types
- account compromise
- outbound spam relay
- spoofed external email
- phishing compromises
- malware infiltration
- insider data exfiltration
4.2 Standard Response Workflow
① Disable compromised SMTP/IMAP account
postfixadmin disable mailbox
dovecot disable login
② Analyze outbound mail logs
Trace queue ID, source IP, SASL username.
③ Check for large-volume outbound spikes
grep "sasl_username" /var/log/postfix
④ Inspect archive logs via Piler
⑤ Perform legal or executive escalations
Depending on data type or customer impact.
5. Zero Trust Email Architecture
Your system already follows Zero Trust principles:
- Every SMTP/IMAP connection re-authenticated
- Every message re-scanned via Amavis
- Every user action logged
- Every archive access validated
- Every search query tracked
- TLS enforced everywhere
- All services isolated in containers
This is the modern enterprise approach.
6. Suggested Enhancements (Advanced Level)
To move to “best-in-class” level:
✔ DMARC analytics dashboard
✔ DKIM key rotation (every 6–12 months)
✔ Centralized logging (ELK / Loki)
✔ Piler legal hold
✔ Keycloak SSO integration
✔ Fail2Ban for SMTP and IMAP
✔ Postfix/IMAP metrics with Prometheus
✔ Automation (N8N / Ansible)
Conclusion of Part 17
You now possess:
- enterprise-grade privacy
- internal control-ready auditing
- governance-compliant email archiving
- strong anti-spam/anti-malware defense
- secure SMTP/IMAP transport
- full Zero Trust mail architecture
Part 17 brings the system to full corporate governance level.