Block ChatGPT using keywords and FQDN
This configuration will block HTTPS upload traffic to the OpenAI server that includes a sensitive keyword. The pre-defined data type, keyword, is used in the Data Leak Prevention (DLP) dictionary.
When utilizing commonly-used SSL-encrypted protocols such as HTTPS, SMTPS, POP3S, IMAPS, and FTPS, SSL inspection must be set to Deep Inspection. See Deep inspection for more information. Additionally, the client machine must have the corresponding deep inspection Certificate Authority (CA) certificate installed. |
Example
In this example, a user is conducting a search on CHATGPT through the Chrome browser on Office computer, using a sensitive keyword that has been configured in the DLP dictionary. The FortiGate intercepts this traffic using deep inspection and prevent the search which contain sensitive keywords because it matches the DLP profile that has been set up on this FortiGate.
When a sensitive keyword is included in HTTPS upload traffic, the request is blocked and a DLP log is generated. See Sample log for a log sample.
Sample topology
To block HTTPS upload traffic that includes sensitive keywords in the GUI:
-
Configure the DLP dictionary:
-
Go to Security Profiles > Data Leak Prevention, select the Dictionaries tab, and click Create New.
-
Set Name to chatgpt.
-
In the Dictionary Entries table click Create New:
-
Set Type to keyword.
-
Set Pattern to fortinet.
-
Enable Case sensitive.
-
Click OK.
-
-
Repeat step c and set Pattern to source code.
-
Click OK.
-
-
Configure the DLP sensor:
-
Go to Security Profiles > Data Leak Prevention, select the Sensors tab, and click Create New.
-
Set Name to chatgpt.
-
In the Sensor Entries section, click Create New.
-
Set the Dictionary to chatgpt and click OK.
-
Click OK.
-
-
Configure the DLP profile:
-
Go to Security Profiles > Data Leak Prevention, select the Profiles tab, and click Create New.
-
Set Name to chatgpt.
-
In the Rules section, click Create New.
-
Configure the following settings:
Name chatgpt Sensors chatgpt Severity Critical Action Block Type Message Protocol HTTP-POST -
Click OK.
-
Click OK to save the profile.
-
-
Configure the firewall address for the OpenAI:
-
Go to Policy & Objects > Addresses and click Create New.
-
Fill out the fields with the following information:
Name chatgpt Type FQDN FQDN chat.openai.com -
Select OK.
-
-
Add the DLP profile and the FQDN address to a firewall policy.
-
Go to Policy & Objects > Firewall Policy and click Create New.
-
Set the Inspection Mode to Proxy-based.
-
Set the Destination to chatgpt.
-
In the Security Profiles section, enable DLP Profile and select chatgpt.
-
Set SSL Inspection to deep-inspection.
-
Configure the other settings as needed.
-
Click OK.
-
To block HTTPS upload traffic that includes sensitive keywords in the CLI:
-
Configure the DLP dictionary:
config dlp dictionary edit "chatgpt" config entries edit 1 set type "keyword" set pattern "source code" set ignore-case enable next edit 2 set type "keyword" set pattern "fortinet" set ignore-case enable next end next end
-
Configure the DLP sensor:
config dlp sensor edit "chatgpt" config entries edit 1 set dictionary "chatgpt" next end next end
-
Configure the DLP profile:
config dlp profile edit "chatgpt" set feature-set proxy config rule edit 1 set name "chatgpt" set severity critical set type message set proto http-post set filter-by sensor set sensor "chatgpt" set action block next end next end
-
Configure the firewall address for the OpenAI:
config firewall address edit "chatgpt" set type fqdn set fqdn "chat.openai.com" next end
-
Add the DLP profile and the FQDN address to a firewall policy:
config firewall policy edit 1 set name "chatgpt" set srcintf "port2" set dstintf "port1" set action accept set srcaddr "all" set dstaddr "chatgpt" set schedule "always" set service "ALL" set utm-status enable set inspection-mode proxy set ssl-ssh-profile "deep-inspection" set dlp-profile "chatgpt" set nat enable next end
Verification:
-
Visit https://chat.openai.com.
-
Search for any phrase that includes keywords set up in the DLP dictionary.
-
Verify that the request failed and an error was generated.
Sample log
An attempt was made to send an HTTP POST request containing sensitive keywords. The request failed, resulting in the generation of a sample log.
1: date=2024-02-08 time=09:01:35 eventtime=1707339694791154478 tz="+1200" logid="0954024576" type="utm" subtype="dlp" eventtype="dlp" level="warning" vd="root" ruleid=1 rulename="chatgpt" dlpextra="Sensor 'chatgpt' matching any: ('chatgpt'=1) >= 1; match." filtertype="sensor" filtercat="message" severity="critical" policyid=2 poluuid="5ab6e22a-c5f9-51ee-280f-1660c776d2a5" policytype="policy" sessionid=727210 epoch=813929908 eventid=1 srcip=13.13.13.13 srcport=56324 srccountry="United States" srcintf="port2" srcintfrole="undefined" srcuuid="d2f06fda-15e7-51ee-0d22-faaf5170dad2" dstip=104.18.37.228 dstport=443 dstcountry="United States" dstintf="port1" dstintfrole="undefined" dstuuid="3881afe6-c5f9-51ee-d384-71da7790e153" proto=6 service="HTTPS" filetype="N/A" direction="outgoing" action="block" hostname="chat.openai.com" url="https://chat.openai.com/backend-api/conversation" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36" httpmethod="POST" referralurl="https://chat.openai.com/c/5c4aa8f6-cb0b-4ab6-81d9-855a7d2223a4" profile="chatgpt"