Tường lửa (Firewall) là gì?
Firewall là thiết bị/phần mềm bảo mật giám sát và kiểm soát lưu lượng mạng đến/đi dựa trên tập quy tắc xác định trước. Nó thiết lập rào cản giữa mạng tin cậy (internal) và mạng không tin cậy (Internet/DMZ), quyết định Allow (cho phép), Deny/Drop (từ chối), hoặc Reject (từ chối và gửi ICMP/TCP RST về nguồn).
Phân loại Firewall theo thế hệ & công nghệ
| Loại | Lớp OSI | Cơ chế | Ưu/NHược điểm | Ví dụ |
| Packet Filtering (Gen 1) | L3/L4 | Lọc theo IP src/dst, port, protocol (ACL tĩnh) | Nhanh, rẻ / Không hiểu context, dễ bypass | Router ACL, iptables/nftables cơ bản |
| Stateful Inspection (Gen 2) | L3/L4 + State | Theo dõi state table (SYN, SYN-ACK, ACK, ESTABLISHED) | Hiểu session / Không inspect payload L7 | Cisco ASA, FortiGate (chế độ legacy), Check Point |
| Application/Proxy Firewall (Gen 3) | L7 | Proxy kết nối, hiểu giao thức (HTTP, DNS, SMTP, FTP) | Inspect sâu / Latency cao, không scale mọi protocol | Blue Coat Proxy, F5 ASM, ModSecurity (WAF) |
| Next-Gen Firewall NGFW (Gen 4+) | L3-L7 | App-ID (Layer 7), User-ID, IPS, SSL Decrypt, Sandbox, Threat Intel, SD-WAN | Toàn diện, context-aware / Đắt, phức tạp, cần tuning | Palo Alto, FortiGate, Check Point, Cisco Firepower, Sophos XGS |
| Cloud-Native / FWaaS | L3-L7 | Firewall as a Service, SASE/SSE component, elastic scale | Zero hardware, global PoP / Vendor lock-in, data sovereignty | Zscaler, Cloudflare Magic Firewall, AWS Network Firewall, Azure Firewall, Palo Alto Prisma Access |
Cơ chế hoạt động chi tiết
- Packet Ingress: Gói tin đến interface
- Pre-processing: Check interface, zone, routing, NAT
- Session Lookup: Tra session table (stateful) - nếu match → forward
- Policy Lookup: Duyệt rule theo thứ tự top-down (first match win)
- Match criteria: Source/Dest Zone, IP, User, Application, Service/Port, URL Category, Time
- Action: Allow, Deny, Drop, Reset-both, Reset-client, Reset-server
- Security Profiles (NGFW): Nếu Allow → áp dụng profile:
- Antivirus/Anti-malware (file scanning)
- IPS (Signature + Anomaly)
- URL Filtering / DNS Security
- File Blocking (PE, APK, ISO...)
- Data Filtering (DLP pattern: CCN, SSN, PII)
- WildFire/Sandbox (static + dynamic analysis)
- SSL/TLS Decryption (Forward Proxy / Inbound Inspection): Giải mã để inspect
- Logging & Forwarding: Gửi log đến Syslog/SIEM, Panorama, Cloud Logging
- Egress: Forward gói tin ra interface outbound
Triển khai Firewall - Best Practice
1. Thiết kế kiến trúc (Network Segmentation)
- Zone-based: Untrust (Internet), DMZ, Server, User, Mgmt, Guest, IoT, OT/ICS
- Default Deny: Chặn tất cả inter-zone, chỉ allow rule cụ thể (least privilege)
- Choke points: Tất cả traffic cross-zone phải qua firewall
2. Cấu hình Rule Base (Rule Order quan trọng)
# Thứ tự ưu tiên khuyến nghị:
1. Management Access (Allow specific Mgmt IP → FW Mgmt IP: SSH/HTTPS)
2. Critical Services (DNS, NTP, DHCP Relay, AD/LDAP, Monitoring)
3. Explicit Deny (Known bad: GeoIP block, Threat Intel feed, Tor exit nodes)
4. Business Applications (Allow specific App-ID/User/Zone/Port)
5. SSL Decrypt Rules (Decrypt outbound,exclude financial/health)
6. Catch-all Deny & Log (Deny any any any any → Log)
3. SSL Decryption (Quan trọng - >85% traffic là HTTPS)
- Forward Proxy: FW đóng vai "Man-in-the-Middle" tin cậy, re-sign cert bằng CA nội bộ (cần push CA cert đến endpoint qua GPO/MDM)
- Loại trừ: Banking, Health, Government sites (legal/privacy), Certificate Pinning apps
- Performance: Cần hardware SSL offload card hoặc dedicated decrypt node
4. High Availability (HA)
- Active/Passive (A/P): Failover < 1s, state sync (session, routing, config)
- Active/Active (A/A): Load balancing, cần symmetric routing
- Heartbeat: Dedicated HA link (cáp trực tiếp), monitor critical interfaces
5. Quản trị tập trung & Automation
- Panorama (Palo Alto), FortiManager, Check Point SmartConsole, Cisco FMC
- Infrastructure as Code: Terraform Provider, Ansible Collection, API/REST
- GitOps: Policy as Code, PR review, CI/CD test rule trước khi push
So sánh Top Firewall Doanh nghiệp (2024 Gartner Magic Quadrant)
| Vendor | Điểm mạnh | Phù hợp |
| Palo Alto Networks | App-ID tốt nhất, WildFire sandbox, Prisma SASE ecosystem, AIOps | Enterprise lớn, Cloud-first, cần visibility sâu |
| Fortinet (FortiGate) | ASIC SPU tự研发, hiệu năng/giá tốt, Security Fabric tích hợp sâu (Switch, AP, Endpoint) | Mid-large, chi phí hiệu quả, campus/branch |
| Check Point | Kernel-level inspection, Infinity Architecture, quản trị tập trung mạnh (SmartConsole) | Tổ chức có team SecOps mature, data center |
| Cisco (Firepower/FTD, Meraki) | Tích hợp Cisco ecosystem (ISE, Stealthwatch, Umbrella, SecureX) | Shop Cisco, branch office (Meraki cloud-managed) |
| Sophos (XGS) | Xstream SSL/TLS decrypt, synchronized security với Intercept X Endpoint | SMB/Mid-market, MSP, muốn unified console |
Kiểm thử & Đảm bảo chất lượng
- Penetration Test: External/Internal, Firewall rule review, Evasion test
- Breach & Attack Simulation (BAS): AttackIQ, SafeBreach, Cymulate - chạy liên tục
- Rule Recertification: Review quarterly - xóa rule unused > 90 ngày, merge rule trùng lặp
- Firmware/Threat Sig Update: Auto-update signature, firmware staged rollout (lab → pilot → prod)