Created on 01-26-2022 05:25 AM Edited on 09-30-2024 12:31 AM By Jean-Philippe_P
Description
This article describes the correct usage of 'URL Path Regex' and 'Host Regex Pattern' for Explicit Proxy.
Scope
FortiGate.
Solution
Consider an example where the following sites must be matched.
Note that the word 'example' is purposely placed both in the domain name and in the directory path.
There are two possible ways to match them, depending on situational requirements:
Using the 'Host Regex Pattern', FortiOS can handle the match with .*example.*, or example.* because the host part of all 4 of the URLs contains the word 'example' before the path (delimited by the first '/' ). To set this up, the destination address is enough.
However:
When the address typed is 'URL Path Regex', there is no match for the words used in the path.
To match the path part of the URL (/test/example), 'URL Path Regex' needs to be used.
For example:
The filters may differ according to needs, but having this object defined and used in a policy is not enough.
The unit needs to:
When using URL Path Regex, the configuration should look like this for an explicit proxy rule:
config firewall proxy-address
edit "addr-connect"
set type method
set host "all"
set method connect
next
edit "example_path"
set host "all"
set path ".*example.*"
next
end
config firewall policy
edit 1
set type explicit-web
set dstintf "any"
set srcaddr "addr-connect" <- For passing CONNECT first.
set dstaddr "all"
set action accept
set schedule "always"
set service "webproxy"
set explicit-web-proxy "web-proxy"
set logtraffic all
set ssl-ssh-profile "custom-deep-inspection" <- Necessary.
next
edit 2
set type explicit-web
set dstintf "any"
set srcaddr "all"
set dstaddr "example_path" <----- Match for 'example' in the URL path.
set action accept
set schedule "always"
set service "webproxy"
set explicit-web-proxy "web-proxy"
set utm-status enable
set logtraffic all
set webcache enable
set ssl-ssh-profile "custom-deep-inspection" <----- Necessary.
set av-profile "default"
next
For FortiGate, an additional firewall policy is needed for this:
config firewall policy
edit 1
set srcintf "any"
set dstintf "any"
set srcaddr "all"
set dstaddr "example_path"
set action accept
set schedule "always"
set service "ALL"
set ssl-ssh-profile "custom-deep-inspection" <----- Necessary.
next
end
For transparent proxy traffic, one policy with set dstaddr 'example_path' is sufficient to match both 'example' in the hostname and URL path.
Make the following note when creating a URL pattern otherwise, it will not block or allow the URL:
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 2024 Fortinet, Inc. All Rights Reserved.