How do I setup and use the Threat API feature on my firewall?
03/26/2020
412 People found this article helpful
97,384 Views
Description
The Threat API feature was released starting in SonicOS 6.2.7. Instead of logging into a firewall, Threat API allows administrators to send lists of URLs or IP addresses to be blocked via command line. Objects can be added or removed to meet the growing needs of the organization. The list is limited to 5,000 entries for all product versions.
Additional notes:
- Threat API settings are only available to the SonicOS administrator. By default, this is the “admin” user.
- HTTPS management must be enabled on the interface that the Threat API call will be coming from.
- SonicOS Threat API requires that the firewall has a Content Filtering System (CFS) license.
Resolution
The Threat API feature is dependent on a valid CFS license. Confirm you have a CFS license:
- For SonicOS 6.5 and later navigate to Manage | Licenses | Premium Content Filtering Service.
- For SonicOS 6.2 and earlier navigate to System | Licenses | Premium Content Filtering Service.
Enable Threat API by going to the internal settings of the firewall.
- When logged into the firewall navigate to the URL. Replace "main.html" with "diag.html". For example: replace tz600.demo.sonicwall.com/main.html with tz600.demo.sonicwall.com/diag.html.
- Click Internal Settings.
- Navigate to Threat API Settings and select Enable Threat API Filtering.

Threats can be added in the following two formats:
- URLs: https://example.com/malware
- IP addresses: 12.35.37.108
For IP addresses in the threat list, SonicOS initially creates a default Threat API address group and then creates an address object (AO) for each IP address in the threat list. The SonicOS administrator configures firewall access rules that reference that address group and block the IP addresses.
To create an access rule:
- For SonicOS 6.5 and later navigate to Manage | Rules | Access Rules. Add an access rule from LAN to WAN. Click Deny as the action. Choose ThreatAPI Block list as the Destination.
- For SonicOS 6.2 and earlier navigate to Firewall | Access Rules. Add an access rule from LAN to WAN. Click Deny as the action. Choose ThreatAPI Block list as the Destination.

For URLs SonicOS adds the URLs to its CFS Threat URI list. The SonicOS administrator enables Threat API Enforcement in the associated CFS Profile and configures a Content Filtering System (CFS) policy to block the URLs in the threat list. After SonicOS receives the initial threat list and creates a Threat URI List Object, the admin adds a CFS Profile Object that references the Threat URI List Object and enables the Enable Threat API Enforcement checkbox.

When a threat is blocked by CFS, the user will see a block message in their browser.
The following commands can be initiated on an administrators computer to automate
URLs:
• GET /threat/block/uri/ – Returns URI blocklist in a simple plain‐text, 1 URI per line format.
• OPTIONS /threat/block/uri/ – Allows restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served.
• POST /threat/block/uri/ – Instantiates the URI blocklist.
• DELETE /threat/block/uri/ – Clears the URI blocklist.
IP Addresses:
• GET /threat/block/ip/ – Returns host IP blocklist in a simple plain‐text, 1 V4/V6 host per line format.
• OPTIONS /threat/block/ip/ – Allows restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served.
• POST /threat/block/ip/ – Instantiates the host IP blocklist.
• PUT /threat/block/ip/ – Adds host(s) to the IP blocklist.
• DELETE /threat/block/ip/ – Deletes all or specified host(s) from the IP blocklist.
To instantiate an IP block lists:
curl -k -i -u admin:password -X POST -d "`printf "1.2.3.4\n1.2.3.5\n"`" https://192.168.1.254/threat/block/ip/
To instantiate a URI block lists:
curl -k -i -u admin:password -X POST -d "`printf "example1.com\nexample2.com\n"`" https://192.168.1.254/threat/block/uri/
To update the IP list:
curl -k -i -u admin:password -X PUT -d "`printf "4.3.2.1\n"`" https://192.168.1.254/threat/block/ip/
To update the URI list:
curl -k -i -u admin:password -X PUT -d "`printf "example.com\n"`" https://192.168.1.254/threat/block/uri/
Delete IP entries:
curl -k -i -u admin:password -X DELETE -d "`printf "1.2.3.4\n1.2.3.5\n"`" https://192.168.1.254/threat/block/ip/
Delete URI entries:
curl -k -i -u admin:password -X DELETE -d "'printf "example.com\n"'" https://192.168.1.254/threat/block/uri/
Related Articles
Categories