📘 Tuần 8 – SSL/TLS Decryption và Certificate Management
📘 Tuần 8 – SSL/TLS Decryption và Certificate Management
🗺️ Sơ đồ – SSL Decryption Flow
(SSL Proxy) participant Server as 🌐 Web Server
(facebook.com) Note over Client,Server: Không có SSL Decryption (Trước) Client->>Server: HTTPS Request (mã hóa 🔒) Server-->>Client: HTTPS Response (mã hóa 🔒) Note over PA: ❌ Không nhìn thấy nội dung!
Virus/Malware đi qua dễ dàng Note over Client,Server: Có SSL Decryption (Sau khi bật) Client->>PA: HTTPS Request PA->>PA: 🔓 Decrypt (dùng CA cert của Palo Alto) PA->>Server: HTTPS Request (re-encrypt) Server-->>PA: HTTPS Response PA->>PA: 🔍 Scan: AV, IPS, App-ID, URL Filter PA-->>Client: HTTPS Response (re-encrypt với PA cert) Note over PA: ✅ Nhìn thấy toàn bộ nội dung
Virus bị phát hiện và chặn
📚 Lý thuyết cơ bản
🔰 Tại sao cần SSL Decryption?
💡 Vấn đề: Ngày nay 90%+ traffic là HTTPS (mã hóa). Firewall truyền thống không nhìn thấy bên trong → Virus, malware, dữ liệu nhạy cảm đều lọt qua dễ dàng. SSL Decryption = Palo Alto đóng vai "man-in-the-middle" hợp pháp: 1. Tạo certificate tạm thời thay thế cert của website. 2. Giải mã traffic → quét nội dung → mã hóa lại. 3. Client không biết, thấy kết nối HTTPS bình thường (chỉ thấy CA là của Palo Alto).
🔰 Hai loại SSL Decryption
| Loại | Dùng khi | Mô tả |
|---|---|---|
| SSL Forward Proxy | Client → Internet (Outbound) | Decrypt traffic từ LAN ra Internet |
| SSL Inbound Inspection | Internet → Server nội bộ (Inbound) | Decrypt traffic vào server của bạn |
🔰 Certificate trong PAN-OS
| Loại cert | Dùng cho |
|---|---|
| CA Certificate | Ký cert giả cho SSL Forward Proxy |
| SSL/TLS Service Profile | Bảo vệ Management GUI, GlobalProtect |
| Device Certificate | Xác thực thiết bị với Panorama/Cloud |
⚠️ Quan trọng: Để SSL Decryption hoạt động, phải push CA Certificate của Palo Alto vào tất cả máy client (qua Group Policy AD hoặc thủ công). Nếu không, browser sẽ cảnh báo "Certificate Not Trusted".
🛠️ Thực hành
Bước 1: Tạo CA Certificate trên Palo Alto
textadmin@PA-LAB-01> configure
# Tạo self-signed CA certificate để ký cho SSL Decryption
# GUI: Device → Certificate Management → Certificates → Generate
# Chọn: Certificate Authority = Yes (BẮT BUỘC)
# Qua CLI:
admin@PA-LAB-01# request certificate generate ca yes certificate-name "PA-LAB-CA" signed-by "" country VN state HCM locality HCM organization "Lab Corp" common-name "PA-LAB-CA"
Bước 2: Tạo SSL/TLS Decryption Profile
text# GUI: Objects → Decryption Profiles → Add
admin@PA-LAB-01# set profiles decryption "Decrypt-Profile-Default" ssl-forward-proxy block-if-no-resource yes
admin@PA-LAB-01# set profiles decryption "Decrypt-Profile-Default" ssl-forward-proxy block-expired-certificate yes
admin@PA-LAB-01# set profiles decryption "Decrypt-Profile-Default" ssl-forward-proxy block-untrusted-issuer yes
Bước 3: Tạo Decryption Policy
text# Decrypt traffic Trust → Untrust (HTTPS ra Internet)
admin@PA-LAB-01# set rulebase decryption rules "Decrypt-Outbound" from Trust
admin@PA-LAB-01# set rulebase decryption rules "Decrypt-Outbound" to Untrust
admin@PA-LAB-01# set rulebase decryption rules "Decrypt-Outbound" source any
admin@PA-LAB-01# set rulebase decryption rules "Decrypt-Outbound" destination any
admin@PA-LAB-01# set rulebase decryption rules "Decrypt-Outbound" service any
admin@PA-LAB-01# set rulebase decryption rules "Decrypt-Outbound" type ssl-forward-proxy
admin@PA-LAB-01# set rulebase decryption rules "Decrypt-Outbound" profile Decrypt-Profile-Default
admin@PA-LAB-01# set rulebase decryption rules "Decrypt-Outbound" action decrypt
# Không decrypt banking/healthcare (ưu tiên privacy)
admin@PA-LAB-01# set rulebase decryption rules "No-Decrypt-Finance" from Trust
admin@PA-LAB-01# set rulebase decryption rules "No-Decrypt-Finance" to Untrust
admin@PA-LAB-01# set rulebase decryption rules "No-Decrypt-Finance" category financial-services
admin@PA-LAB-01# set rulebase decryption rules "No-Decrypt-Finance" action no-decrypt
admin@PA-LAB-01# commit
Bước 4: Export CA cert và push vào máy Client
text# Export CA cert để import vào máy client
# GUI: Device → Certificate Management → Certificates → chọn PA-LAB-CA → Export
# Trên máy Windows Client (hoặc qua GPO):
# certmgr.msc → Trusted Root Certification Authorities → Import PA-LAB-CA.crt
Cấu hình SSL/TLS Service Profile cho Management GUI
text# Tạo certificate cho GUI
admin@PA-LAB-01# request certificate generate signed-by "PA-LAB-CA" certificate-name "PA-MGMT-CERT" country VN common-name "192.168.1.1"
# Tạo SSL/TLS Service Profile
admin@PA-LAB-01# set shared ssl-tls-service-profile "MGMT-SSL-Profile" certificate PA-MGMT-CERT
admin@PA-LAB-01# set shared ssl-tls-service-profile "MGMT-SSL-Profile" min-version tls1-2
admin@PA-LAB-01# set shared ssl-tls-service-profile "MGMT-SSL-Profile" max-version max
# Áp dụng cho Management
admin@PA-LAB-01# set deviceconfig system ssl-tls-service-profile MGMT-SSL-Profile
admin@PA-LAB-01# commit
Kiểm tra Decryption
text# Xem decrypted sessions
admin@PA-LAB-01> show session all filter ssl-decrypt yes
# Xem decryption log
admin@PA-LAB-01> show log decryption
🔒 Bảo mật cần nhớ
- ✅ Không decrypt traffic banking/healthcare → bảo vệ quyền riêng tư.
- ✅ Dùng TLS 1.2 tối thiểu – disable TLS 1.0, 1.1.
- ✅ Kiểm tra expiry date của CA certificate thường xuyên.
- ✅ Push CA cert vào máy client qua Group Policy AD cho môi trường doanh nghiệp.
📖 Case thực tế
Công ty bị nhiễm ransomware dù đã có AV profile. Điều tra phát hiện ransomware download payload qua HTTPS → AV không quét được vì traffic mã hóa. Sau khi bật SSL Decryption + AV Profile: - Traffic HTTPS bị decrypt → AV quét → phát hiện payload độc hại → chặn. - Không bật SSL Decryption = 90% traffic "mù" với firewall. 👉 SSL Decryption là BẮT BUỘC để AV/IPS thực sự có hiệu quả trong mạng hiện đại.
📅 Tuần 8/12 – PAN-OS Administration Lab trên PnetLab