Fortinet black logo

Administration Guide

Block HTTPS downloads of EXE files and log HTTPS downloads of files larger than 500 KB

Block HTTPS downloads of EXE files and log HTTPS downloads of files larger than 500 KB

FortiGate can detect any file larger than the configured limit. See File size filtering for more information.

This configuration will block HTTPS downloads of EXE files and log HTTPS downloads of files larger than 500 KB.

To block HTTPS download of EXE files and log downloads larger than 500 KB:
  1. Configure the DLP file pattern:

    config dlp filepattern
        edit 3
            set name "case3-exe"
            config entries
                edit "exe"
                    set filter-type type
                    set file-type exe
                next
            end
        next
    end
  2. Configure the DLP profile:

    config dlp profile
        edit "profile-case3-type-size"
            config rule
                edit 1
                    set proto http-get
                    set filter-by none
                    set file-type 3
                    set action block
                next
                edit 2
                    set proto http-get
                    set filter-by none
                    set file-size 500
                    set action log-only
                next
            end
        next
    end
  3. Add the DLP profile to a firewall policy:

    config firewall policy
        edit 1
            set srcintf "port2"
            set dstintf "port1"
            set action accept
            set srcaddr "all"
            set dstaddr "all"
            set srcaddr6 "all"
            set dstaddr6 "all"
            set schedule "always"
            set service "ALL"
            set utm-status enable
            set inspection-mode proxy
            set ssl-ssh-profile "custom-deep-inspection"
            set dlp-profile "profile-case3-type-size"
            set logtraffic all
            set nat enable
        next
    end
  4. Download an EXE file using HTTPS. The download is blocked, a replacement message appears, and a DLP log is generated.

Sample log
1: date=2022-02-15 time=11:54:29 eventtime=1644954869682887856 tz="-0800" logid="0954024577" type="utm" subtype="dlp" eventtype="dlp" level="notice" vd="root" ruleid=2 dlpextra="500 kB" filtertype="none" filtercat="file" severity="medium" policyid=1 poluuid="905fb604-7ed4-51ec-0853-79e498591bf8" policytype="policy" sessionid=12082 epoch=901683674 eventid=0 srcip=10.1.100.18 srcport=59520 srccountry="Reserved" srcintf="port2" srcintfrole="undefined" srcuuid="358d0f56-7ed4-51ec-50f7-a5e4525a641d" dstip=51.81.186.201 dstport=443 dstcountry="United States" dstintf="port1" dstintfrole="undefined" dstuuid="358d0f56-7ed4-51ec-50f7-a5e4525a641d" proto=6 service="HTTPS" direction="incoming" action="log-only" hostname="2.na.dl.wireshark.org" url="https://2.na.dl.wireshark.org/win64/Wireshark-win64-3.6.2.exe" agent="curl/7.61.1" filename="Wireshark-win64-3.6.2.exe" filesize=10502090 profile="profile-case3-type-size"

Block HTTPS downloads of EXE files and log HTTPS downloads of files larger than 500 KB

FortiGate can detect any file larger than the configured limit. See File size filtering for more information.

This configuration will block HTTPS downloads of EXE files and log HTTPS downloads of files larger than 500 KB.

To block HTTPS download of EXE files and log downloads larger than 500 KB:
  1. Configure the DLP file pattern:

    config dlp filepattern
        edit 3
            set name "case3-exe"
            config entries
                edit "exe"
                    set filter-type type
                    set file-type exe
                next
            end
        next
    end
  2. Configure the DLP profile:

    config dlp profile
        edit "profile-case3-type-size"
            config rule
                edit 1
                    set proto http-get
                    set filter-by none
                    set file-type 3
                    set action block
                next
                edit 2
                    set proto http-get
                    set filter-by none
                    set file-size 500
                    set action log-only
                next
            end
        next
    end
  3. Add the DLP profile to a firewall policy:

    config firewall policy
        edit 1
            set srcintf "port2"
            set dstintf "port1"
            set action accept
            set srcaddr "all"
            set dstaddr "all"
            set srcaddr6 "all"
            set dstaddr6 "all"
            set schedule "always"
            set service "ALL"
            set utm-status enable
            set inspection-mode proxy
            set ssl-ssh-profile "custom-deep-inspection"
            set dlp-profile "profile-case3-type-size"
            set logtraffic all
            set nat enable
        next
    end
  4. Download an EXE file using HTTPS. The download is blocked, a replacement message appears, and a DLP log is generated.

Sample log
1: date=2022-02-15 time=11:54:29 eventtime=1644954869682887856 tz="-0800" logid="0954024577" type="utm" subtype="dlp" eventtype="dlp" level="notice" vd="root" ruleid=2 dlpextra="500 kB" filtertype="none" filtercat="file" severity="medium" policyid=1 poluuid="905fb604-7ed4-51ec-0853-79e498591bf8" policytype="policy" sessionid=12082 epoch=901683674 eventid=0 srcip=10.1.100.18 srcport=59520 srccountry="Reserved" srcintf="port2" srcintfrole="undefined" srcuuid="358d0f56-7ed4-51ec-50f7-a5e4525a641d" dstip=51.81.186.201 dstport=443 dstcountry="United States" dstintf="port1" dstintfrole="undefined" dstuuid="358d0f56-7ed4-51ec-50f7-a5e4525a641d" proto=6 service="HTTPS" direction="incoming" action="log-only" hostname="2.na.dl.wireshark.org" url="https://2.na.dl.wireshark.org/win64/Wireshark-win64-3.6.2.exe" agent="curl/7.61.1" filename="Wireshark-win64-3.6.2.exe" filesize=10502090 profile="profile-case3-type-size"