DMZ (Demilitarized Zone) là gì?
DMZ (Khu phi quân sự hóa) là một mạng con (subnetwork) nằm giữa mạng nội bộ tin cậy (Internal Network/LAN) và mạng không tin cậy (Internet/External Network). Mục đích: Cô lập các dịch vụ phải công khai ra Internet (Web server, Mail server, DNS, VPN Gateway, API Gateway) để nếu bị tấn công, kẻ xâm nhập không thể trực tiếp truy cập mạng nội bộ nhạy cảm.
Kiến trúc DMZ - 3 Mô hình phổ biến
1. Single Firewall (Three-legged) - Phổ biến SMB
Internet
│
▼
[Firewall] ←── 3 Interface: Outside (Internet), DMZ, Inside (LAN)
│
├── Outside: Untrust
├── DMZ: Web Server, Mail Server, DNS, VPN Gateway (Public IP hoặc NAT)
└── Inside: LAN nội bộ (Database, AD, File Server, Workstation)
- Ưu: Đơn giản, rẻ, dễ quản trị
- Nhược: Single point of failure, firewall phải xử lý toàn bộ traffic
2. Dual Firewall (Screened Subnet) - Tiêu chuẩn Enterprise
Internet
│
▼
[External Firewall] ←── Chỉ cho phép traffic đến DMZ (Port 80/443, 25, 53...)
│
▼
[DMZ Network] ←── Web, Mail, DNS, Proxy, VPN, API Gateway
│
▼
[Internal Firewall] ←── Chỉ cho phép DMZ → Inside traffic cụ thể (App→DB, Management)
│
▼
[Internal LAN] ←── Database, AD, ERP, HR, Workstation (Private IP)
- Ưu: Defense in depth, cô lập lớp, external FW chặn tải lớn, internal FW enforce least privilege
- Nhược: Chi phí cao, phức tạp, latency thêm 1 hop
3. Cloud/Modern DMZ (AWS/Azure/GCP)
- Public Subnet (DMZ equivalent): ALB/NLB, NAT Gateway, Bastion Host, API Gateway, WAF, CloudFront
- Private Subnet (Internal): App Server (EC2/ECS/EKS), Database (RDS), Cache (ElastiCache)
- Security Groups + NACL thay thế firewall vật lý
- AWS Network Firewall / Azure Firewall / GCP Cloud Armor: Managed L3-L7 inspection
- Zero Trust: Không còn DMZ truyền thống → Identity-based micro-segmentation (ZTNA, BeyondCorp, Verified Access)
Chức năng & Lợi ích của DMZ
| Chức năng | Mô tả |
|---|---|
| Buffer Zone | Hấp thụ tấn công từ Internet, bảo vệ Internal LAN |
| Service Exposure | Cho phép Public service (Web, Email, DNS, VPN) truy cập được mà không mở port thẳng vào LAN |
| Traffic Inspection | External FW inspect inbound, Internal FW inspect outbound từ DMZ (Data exfiltration detection) |
| Compliance | PCI DSS, NIST 800-53, ISO 27001 yêu cầu tách biệt hệ thống công khai và nội bộ |
| Failover/HA | DMZ service có thể failover độc lập với Internal |
Dịch vụ thường đặt trong DMZ
- Web Server / Reverse Proxy: Nginx, Apache, IIS, Cloudflare/WAF origin
- Mail Server / Mail Gateway: Exchange Edge, Postfix, Proofpoint, Mimecast
- DNS Authoritative: BIND, PowerDNS, Cloudflare, Route53
- VPN Gateway / ZTNA Connector: Cisco AnyConnect, Pulse Secure, Zscaler ZPA, Tailscale
- API Gateway: Kong, Apigee, AWS API Gateway, Azure API Management
- FTP/SFTP Gateway: File transfer với partner
- Proxy / Forward Proxy: Squid, Blue Coat, Zscaler (outbound inspection)
- Honeypot / Deception: Canary tokens, Thinkst Canary
Rủi ro & Thách thức bảo mật DMZ
| Rủi ro | Mô tả | Giảm thiểu |
|---|---|---|
| DMZ Compromise | Server trong DMZ bị hack → làm điểm đệm tấn công Internal | Hardening CIS Benchmark, Patch management, EDR, Network segmentation, Internal FW egress control |
| Lateral Movement | Từ DMZ pivot vào Internal qua trust relationship, shared credential, vuln | Zero Trust: No implicit trust, micro-segmentation, mTLS, Just-in-Time access |
| Data Exfiltration | Kẻ tấn công dùng DMZ server làm trung chuyển dữ liệu đánh cắp | Internal FW deny all egress từ DMZ trừ cần thiết, DLP, TLS Inspection, DNS monitoring |
| Misconfiguration | Rule quá rộng (Any-Any), port mở không cần, default credential | IaC (Terraform/Ansible), Policy as Code (OPA), Continuous compliance (CSPM) |
| DDoS | DMZ là mặt tiền hứng chịu DDoS | Cloud DDoS (Shield, Cloudflare, Akamai), Rate limiting, Anycast, Scrubbing center |
| Supply Chain | Code/Container image trong DMZ bị inject malicious code | SBOM, SLSA, Sigstore, Image signing, Admission controller (Kyverno, OPA Gatekeeper) |
Triển khai DMZ an toàn - Best Practice 2024
- Network Segmentation chặt chẽ: VLAN/VXLAN riêng cho DMZ, Internal, Mgmt, Backup. Không route trực tiếp DMZ ↔ Internal
- Dual Firewall (hoặc FW + Cloud FW): External FW (Internet→DMZ), Internal FW (DMZ→Internal)
- Least Privilege Rule:
- External→DMZ: Chỉ port/service cần thiết (80/443, 25, 53, 443/1194 VPN)
- DMZ→Internal: Chỉ App Server→DB Server (port cụ thể), Management→Jump Host
- DMZ→Internet: Chỉ update/repo, DNS, NTP, threat intel feed. Block all else
- Internal→DMZ: Chỉ admin/management, CI/CD deploy
- Server Hardening: CIS Benchmark, Minimal OS, No unnecessary service, SSH key only, Auditd, File Integrity Monitoring (AIDE/Tripwire/Wazuh)
- Encryption Everywhere: TLS 1.3 (External→DMZ, DMZ→Internal), mTLS service-to-service, Encrypt at rest (LUKS, EBS encryption)
- Monitoring & Detection:
- VPC Flow Logs / NetFlow → SIEM
- Traffic Mirroring → NDR (Zeek/Suricata/Corelight)
- EDR trên mọi DMZ host
- WAF logs, API Gateway logs → SIEM
- UEBA: Phát hiện behavior bất thường (beaconing, data staging, unusual port)
- Automation & Response: SOAR playbook isolate compromised DMZ host, block IP, revoke cert, rotate key
- Regular Penetration Test & BAS: Red team DMZ, Breach & Attack Simulation liên tục
- Immutable Infrastructure: Cattle not pets. Deploy mới thay vì patch live. Blue/Green, Canary
DMZ vs Zero Trust Network Access (ZTNA)
| Đặc điểm | Traditional DMZ | Zero Trust / ZTNA |
|---|---|---|
| Trust Model | Network-based (IP/Zone) | Identity-based (User+Device+Context) |
| Access Control | Firewall Rule (IP/Port) | Policy Engine (PDP) + PEP (Proxy/Agent) |
| Visibility | L3/L4 (some L7) | L7 Application-aware, Data-aware |
| Remote Access | VPN → DMZ → Internal | ZTNA Connector → App trực tiếp (No network access) |
| Lateral Movement | Dễ dàng nếu compromise DMZ | Khó khăn: No network adjacency, micro-segment |
| Cloud Native | Khó (cần VM/FW appliance) | Native (Identity Provider + Proxy/Connector) |
Xu hướng: DMZ vẫn cần cho public-facing service (Web, DNS, Email), nhưng truy cập quản trị và nội bộ chuyển sang ZTNA. Kết hợp: DMZ cho ingress public, ZTNA cho egress/management.
Kết luận
DMZ là kiến trúc bảo mật mạng cơ bản để cô lập dịch vụ công khai. Triển khai đúng đòi hỏi: Dual firewall/Cloud FW, least privilege rule, server hardening, encryption, monitoring (NDR/SIEM), automation, regular testing. Trong kỷ nguyên Cloud/Zero Trust, DMZ vật lý chuyển thành Public Subnet + Security Groups + Network Firewall + ZTNA, nhưng nguyên tắc cốt lõi "cô lập, kiểm soát, giám sát" vẫn không đổi.