| Description | This article describes how to block a file based on any pattern using DLP (Data Leak Prevention). |
| Scope | FortiGate v7.2. |
| Solution |
Data Leak Prevention is not enabled by default. It has to be enabled from the Feature Visibility under Settings. Once this is enabled, the DLP feature will be visible under Security Profiles.
config dlp dictionary edit "dic-pattern" set match-type match-all config entries edit 1 set type "keyword" set pattern "test" <----- Pattern to check for any attachment. set repeat enable set comment "block_test-more_than_4" next end next end
config dlp sensor edit "sensor-dic-pattern" config entries edit 1 set dictionary "dic-pattern" <----- Dictionary created above. set count 4 <----- Set the count to check for. If a pattern 'test' occurs more than 4 times in an attachment, it will be blocked. next end next
config dlp profile edit "Profile_block_pattern" set feature-set proxy config rules edit 3 set name "Block-pattern-Test" set type message set proto smtp pop3 imap http-post nntp mapi set filter-by sensor set sensor "sensor-dic-pattern" <----- Sensor created above. set action block next end next end
config firewall policy edit 1 set status enable set srcintf "LAN" set dstintf "WAN" set inspection-mode proxy
Example log for the configuration above:
date=2023-05-01 time=10:33:48 eventtime=1682930028111513197 tz="+0200" type="utm" subtype="dlp" eventtype="dlp" level="warning" vd="root"
The logs above were generated while trying to upload a doc file to a Gmail attachment with the 'test' word included in the doc more than 4 times. Note: In newer FortiGate versions such as v7.4.x and v7.6.x, the DLP option is not available under Security Profiles and Feature Visibility to access from the GUI. To configure Data Loss Prevention UTM on FortiGate firewall policies, add /utm/dlp to the URL or IP address used to access FortiGate. When multiple VDOMs are enabled, the VDOM name may need to be specified in the URL /utm/dlp?vdom=<vdom name>. For example, the URL used to access DLP using the GUI is https://10.5.210.81/utm/dlp. |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.