Concept 一、核心概念
一句話定義
SSL/TLS 檢測是防火牆解開加密流量(HTTPS)的封包,查看內容是否有病毒或敏感資料,然後再重新加密傳送的技術。
生活化比喻:機場安檢與鎖上的行李箱
想像網路流量是通過機場安檢的行李箱。
1. 一般防火牆 (無 SSL Inspection): 就像安檢人員只看行李箱外面的標籤(IP 標頭)。如果標籤寫著「去銀行」,他就放行。但他無法知道鎖上的行李箱裡面是否藏了違禁品(病毒)。
2. Certificate Inspection (憑證檢測): 安檢人員檢查行李箱的主人身分證(網站憑證),確認是不是假冒的,但還是不打開箱子。
3. Deep Inspection (深度檢測): 安檢人員擁有萬能鑰匙。他打開你的鎖上的行李箱,把每件衣服都翻開檢查有沒有藏炸彈(IPS/防毒掃描),檢查完後,再用海關專用的鎖把箱子鎖回去,才讓你通過。
Mechanism 二、運作原理
1. Certificate Inspection (憑證檢測)
- 檢查對象: 僅檢查 SSL 握手過程中的
Client Hello(SNI) 與Server Certificate(CN/SAN)。 - 優點: 效能極快,不需要在客戶端安裝憑證,不會跳出瀏覽器警告。
- 缺點: 完全無法看到內容。如果病毒透過 HTTPS 下載,防火牆會「瞎掉」。
- 主要用途: 網頁過濾 (Web Filtering) 類別阻擋 (例如:阻擋賭博網站)。
2. Deep Inspection (深度檢測)
- 運作核心: MITM (Man-In-The-Middle,中間人攻擊模式)。
- 流程: FortiGate 假裝是 Server (偽造憑證) 跟 Client 連線;同時假裝是 Client 跟真正的 Server 連線。
- 關鍵挑戰: 瀏覽器會因為憑證是由 FortiGate 簽發而非權威機構 (如 DigiCert) 簽發而報錯。
- 解決方案: 必須將 FortiGate 的 CA 憑證 安裝到所有端點電腦的「受信任的根憑證授權單位」。
隱私權與法律議題 (Privacy)
進行深度檢測等於公司可以看到使用者的所有加密內容(包括網銀帳號密碼)。因此,實務上我們必須設定 Exempt (排除) 清單,針對 Finance & Banking (金融)、Health (醫療) 等類別,只做 Certificate Inspection,不做解密,以符合法規與隱私要求。
Visuals 三、架構視覺化
提示:手機版請左右滑動檢視完整架構圖。
圖一:Certificate Inspection (僅檢查表頭)
2. 判斷類別:賭博網站
3. 動作:Block FG-->>PC: Reset / Drop Connection Note over PC, FG: 連線中斷,不需解密
圖二:Deep Inspection (MITM 中間人解密)
2. 產生偽造憑證 (Issuer: Fortinet CA)
3. 建立兩段加密通道 FG-->>PC: Server Hello + 偽造憑證 (Fortinet CA) Note left of PC: 若 PC 信任 Fortinet CA
則連線建立成功 par 加密通道 1 (PC-FG) PC->>FG: 加密資料 (Request) and 加密通道 2 (FG-Web) FG->>Web: 重新加密資料 (Request) end Note right of FG: **解密檢測區**
Antivirus 掃描
IPS 特徵比對
Data Leak Prevention Web-->>FG: 加密回應 (Response) FG-->>PC: 重新加密回應 (Response)
Use Case 四、實務應用場景與設定
案例背景
企業內網需要開放員工上網,但必須防止員工透過 HTTPS 下載病毒或勒索軟體。同時,財務部門需要訪問銀行網站,基於隱私與相容性,銀行網站不能被解密。
實作步驟 (Configuration Guide)
Step 1: 匯出 CA 憑證並部署到用戶端
為了避免瀏覽器跳出 "不安全" 的警告,需將 FortiGate 的 CA 憑證安裝到電腦。
- 前往 System > Certificates。
- 選擇
Fortinet_CA_SSL(或自建的 CA),點擊 Download。 - (IT 管理員操作) 透過 AD Group Policy (GPO) 將此憑證派送至所有網域電腦的 "受信任的根憑證授權單位"。
Step 2: 設定 SSL/SSH Profile (GUI & CLI)
建立一個新的 Profile,啟用深度檢測,並將金融類別排除。
# CLI Configuration Example
config firewall ssl-ssh-profile
edit "Deep-Inspect-Office"
set comment "Deep inspection for office, exempt banking"
config ssl
set inspect-all deep-inspection // 啟用深度檢測
end
config https
set ports 443
set status deep-inspection
end
config ssl-exempt // 設定排除清單
edit 1
set type fortiguard-category
set fortiguard-category 31 // Category 31 is Finance/Banking
next
edit 2
set type fortiguard-category
set fortiguard-category 34 // Category 34 is Health
next
end
next
end
Step 3: 套用至 Firewall Policy
將剛剛建立的 Profile 套用到上網的策略中。
# CLI Configuration Example
config firewall policy
edit 10
set name "LAN_to_WAN_General"
set srcintf "lan"
set dstintf "wan1"
set srcaddr "all"
set dstaddr "all"
set action accept
set service "ALL"
set utm-status enable
set ssl-ssh-profile "Deep-Inspect-Office"
set av-profile "default" // 必須搭配 AV/IPS 才有意義
set ips-sensor "default"
set nat enable
next
end