release:Feb 11, 2026 Editionstatus:Production Verifiedarch:Hybrid Cloud–Premise
Hybrid Cloud Mail Server Architecture
สถาปัตยกรรม Mail Server ระดับ Production บน Home Lab ภายในบ้าน ก้าวข้ามข้อจำกัดของ ISP เช่น ไม่ได้รับ Public IP (ติด CGNAT) และถูกบล็อก Port 25 โดยเชื่อมโยงผ่าน Oracle Cloud VPS Gateway ด้วย Tailscale (WireGuard Mesh) พร้อมเทคนิค PROXY Protocol v2 เพื่อรักษา Real Sender IP ให้กับระบบความปลอดภัย SPF และ Fail2Ban
Network Topology & Blueprint
แผนผังการไหลของข้อมูลระหว่าง Public Cloud, WireGuard Tunnel และ On-Premise
========================================================================================
PUBLIC INTERNET & EXTERNAL ACTORS
========================================================================================
│ │ ▲
[SMTP Port 25] [IMAPS 993 / Subm 587] [Clean IP Delivery]
External Mail Sender Client (Web / Mobile) Target Recipient MX
│ │ │
▼ ▼ │
┌──────────────────────────────────────────────────────────────────────────────────┴──┐
│ ☁️ CLOUD GATEWAY — Oracle Cloud Infrastructure (OCI) Ubuntu Server │
│ • VCN & UFW Firewall: Ingress TCP 25, 587, 993 Open │
│ • Nginx Stream (Layer 4): Multiplexes TCP + proxy_protocol on (Port 25) │
│ • Tailscale Mesh Node: 100.64.0.0/10 WireGuard Encrypted Overlay │
└──────────────────────────────────────────┬──────────────────────────────────────────┘
│
═══════════════════════╧═══════════════════════
🔒 Encrypted WireGuard Tunnel (Tailscale)
Bypasses ISP CGNAT & Residential Port 25 Block
═══════════════════════╤═══════════════════════
│
┌──────────────────────────────────────────▼──────────────────────────────────────────┐
│ 🏠 ON-PREMISE HOME LAB — Residential PC Server (Mailcow Dockerized) │
│ • Postfix / Postscreen: Decodes PROXY Protocol v2 ──► Real Sender IP Restored │
│ • SPF Validation & Fail2Ban: Enforced on Real Client IP │
│ • Dovecot (IMAP/SSL): Direct mailbox sync & user authentication │
│ • Smart Relay Routing: All outbound emails directed to Brevo Relay (Port 587 TLS) │
└──────────────────────────────────────────┬──────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────────────────┐
│ 🚀 SMART RELAY GATEWAY — Brevo Enterprise SMTP Relay (Port 587 TLS) │
│ • Enforces DKIM Signatures & SPF Alignment (High-Reputation Pool) │
│ • Direct TLS Delivery to Gmail, Outlook, Yahoo (Zero Spam Folder drop) │
└─────────────────────────────────────────────────────────────────────────────────────┘Architecture Topology Matrix
| Layer / Zone | Node / Host | Ports & Services | Protocol & Security | Role & Purpose |
|---|---|---|---|---|
| Edge Gateway | Oracle Cloud VPS (OCI) | 25, 587, 993 / TCP | Nginx Stream L4 + PROXY Protocol v2 | Public MX endpoint รับทราฟฟิกขาเข้าและส่งต่อเข้า WireGuard Tunnel |
| Virtual Mesh | Tailscale Overlay Mesh | 41641 / UDP (WireGuard) | WireGuard ChaCha20-Poly1305 | เครือข่ายเสมือนเข้ารหัสจุดต่อจุดระหว่าง Cloud VPS และ On-Premise PC Server |
| Mail Ingress | Home Server: Postfix | 25 (Tailscale IP) | HAProxy PROXY Protocol v2 | ถอดรหัสเพื่อดู IP จริงของผู้ส่ง ใช้ตรวจสอบ SPF และบล็อก Brute-force ผ่าน Fail2Ban |
| Mailbox Access | Home Server: Dovecot | 993 (IMAPS), 587 (Subm.) | TLS 1.3 Passthrough | จัดเก็บกล่องจดหมายและให้ Client เช็กอีเมลด้วยความปลอดภัยสูง |
| Egress Relay | Brevo SMTP Relay | 587 / TCP (TLS) | SASL Auth + DKIM Signing | ส่งอีเมลขาออกสู่ปลายทางด้วย Clean IP Pool ป้องกันการตก Junk/Spam |
Configuration Artifacts & DNS Setup
Nginx Stream (Oracle Cloud VPS)
# /etc/nginx/nginx.conf (Oracle Cloud VPS Gateway)
stream {
server {
listen 25;
proxy_pass 100.x.x.x:25;
proxy_protocol on; # Preserves real client sender IP
}
server {
listen 587;
proxy_pass 100.x.x.x:587;
}
server {
listen 993;
proxy_pass 100.x.x.x:993;
}
}Postfix Postscreen (Home Lab)
# data/conf/postfix/extra.cf (Home Server Mailcow) postscreen_upstream_proxy_protocol = haproxy # smtpd_upstream_proxy_protocol intentionally not set
Cloudflare DNS Records Validation (Feb 11, 2026)
example template| Type | Name / Host | Value / Target | Function |
|---|---|---|---|
| MX | @ | mail.yourdomain.com (Priority 10) | ชี้นำทางอีเมลขาเข้าสู่ Oracle Cloud Gateway IP |
| TXT (SPF) | @ | v=spf1 include:spf.relay-provider.com -all | อนุญาตให้ Smart Relay ส่งอีเมลในนามโดเมนอย่างถูกต้อง |
| TXT (DKIM) | mail._domainkey | k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB... | ลายมือชื่อดิจิทัลรับรองความถูกต้องของเนื้อหาอีเมล (Public Key) |
| TXT (DMARC) | _dmarc | v=DMARC1; p=quarantine; rua=mailto:[email protected] | นโยบายป้องกันการปลอมแปลงชื่อผู้ส่งอย่างเข้มงวด |