How to enable Keyword Blocking using a Content Filter
Description
How to block keywords using a Content Filter.
Â
Scope
Â
FortiGate.
Solution
Â
Navigate to Security Profiles -> Web Filter, edit the Web Filter Profile in use, enable the Web Content Filter, and select 'Create New'.Â
Â

The user is prompted to enter a keyword or a regular expression that will be blocked by the search engines. Enable the filter by toggling Status and selecting OK.Â
Â

Â
After performing the above, the activity will be blocked in all search engines except Google Search. Execute the commands below to block keywords in the Google search engine:
Â
config web-proxy profile
edit "web_profile"
set strip-encoding enable
next
end
Â
config web-proxy global
set proxy-fqdn "default.fqdn"
set webproxy-profile "web_profile"
endThese commands should be used in a proxy inspection-based profile only. The above options in the CLI are not available in FortiOS 5.4. Â
Note:
If this Web Filter is intended to inspect sites that use HTTPS, then deep inspection is required on the Firewall Policy.
If deep inspection is not enabled, the FortiGate is not able to view inside the encrypted session, and the content filter may not work as intended.
More details can be seen in the documentation for this feature:
Administration Guide - Deep inspection
To do the troubleshooting, use the commands below:
Â
diag debug reset
diagnose debug urlfilter src-addr x.x.x.x <- The source IP.
diag debug appl urlfilter -1
diag debug console timestamp enable
diag debug enable
Â

Â

Â
As seen above, both Google and Bing search engines block search queries containing a blocked keyword.Â
Â
Note:
This solution does not work for HTTPS/3 because this protocol uses QUIC to establish the connection. Block UDP port 443 or block the QUIC protocol in the application to force the clients to use HTTPS/2 over TCP.
Â
See the following article for assistance with blocking Google searches for particular words. It might help to block a Google search for a particular word:
Technical Tip: How to block users from searching for a specific word on Google
Related article:
Technical Tip: How to enable Keyword Blocking using a Content Filter.
