Fortinet white logo
Fortinet white logo

CLI Reference

waf ip-list

waf ip-list

Use this command to define which source IP addresses are trusted clients, undetermined, or distrusted.

  • Trusted IPs—Almost always allowed to access to your protected web servers. Trusted IPs are exempt from many (but not all) of the restrictions that would otherwise be applied by a server policy. To determine skipped scans, see debug flow trace.
  • Neither—If a source IP address is neither explicitly blacklisted or trusted by an IP list policy, the client can access your web servers, unless it is blocked by any of your other configured, subsequent web protection scan techniques. For details, see debug flow trace.
  • Blacklisted IPs—Blocked and prevented from accessing your protected web servers. Requests from blacklisted IP addresses receive a warning message in response. The warning message page includes ID: 70007, which is the ID of all attack log messages about requests from blacklisted IPs.
Because FortiWeb evaluates trusted and blacklisted IP policies before many other techniques, defining these IP addresses can improve performance.

Alternatively, you can block sets of many clients based upon their reputation (see waf ip-intelligence-ignore-x-forwarded-for) or geographical origin (see waf geo-block-list).

To use this command, your administrator account’s access control profile must have either w or rw permission to the wafgrp area. For details, see Permissions.

Syntax

config waf ip-list

edit "<ip-list_name>"

set severity {Low | Medium | High | Info}

set action { alert_deny | block-period | deny_no_log}

set block-period <block_period_int>

set ignore-x-forwarded-for {enable | disable}

set trigger-policy "<trigger-policy_name>"

config members

edit waf ip-list

set group-type {ip-string | ip-group | IP-external}

set ip "<client_ip>"

set ip-group <name>

set type {trust-ip | black-ip | allow-only-ip }

next

end

next

end

Variable Description Default

"<ip-list_name>"

Enter the name of a new or existing rule. The maximum length is 63 characters.

To display the list of existing rules, enter:

edit ?

No default.

action { alert_deny | block-period | deny_no_log}

Select which action FortiWeb will take when it detects a violation of the rule:

  • alert_deny—Block the request (or reset the connection) and generate an alert and/or log message.

  • deny_no_log—Block the request (or reset the connection).

  • block-period—Block subsequent requests from the client for a number of seconds. Also configure block-period.

Note: This setting will be ignored if monitor-mode {enable | disable} is enabled in a server policy.

block-period

block-period <block_period_int>

Enter the number of seconds that you want to block subsequent requests from a client after FortiWeb detects that the client has violated the rule. The valid range is 1–3,600 seconds.

This setting is available only if Action is set to block-period.

60

severity {Low | Medium | High | Info}

When rule violations are recorded in the attack log, each log message contains a Severity Level (severity_level) field. Select which severity level the FortiWeb appliance will use when a blacklisted IP address attempts to connect to your web servers:

  • Low
  • Medium
  • High
  • info
low

trigger-policy "<trigger-policy_name>"

Select which trigger, if any, that the FortiWeb appliance will use when it logs and/or sends an alert email about a blacklisted IP address’s attempt to connect to your web servers. The maximum length is 63 characters. For details, see log trigger-policy.

To display the list of existing trigger policies, enter:

set trigger ?

No default.

ignore-x-forwarded-for {enable | disable}

By default, FortiWeb scans the IP addresses in the X-Forwarded-For header at the HTTP layer. This causes high resource consumption. To enhance the performance, you can enable Ignore X-Forwarded-For so that the IP addresses can be scanned at the TCP layer instead. This avoids HTTP packets being processed unnecessarily.

disable

<entry_index>

Enter the index number of the individual entry in the table. The valid range is 1–9,999,999,999,999,999,999. No default.

group-type {ip-string | ip-group | IP-external}

Select ip-string to enter IP addresses or ranges, or ip-group to reference the IP groups you have created through config server-policy ip-group, or IP-external to reference an external IP address resource you have created through config system external-resource.

ip-string

ip "<client_ip>"

If you have selected ip-string for group-type, then enter one of the following values:

  • A single IP address that a client source IP must match, such as a trusted private network IP address (e.g. an administrator’s computer, 172.16.1.20). Multiple addresses or ranges should be separated with comma ",".
  • A range or addresses (e.g. 1.2.3.4,2001::1,1.2.3.4-1.2.3.40,2001::1-2001::100).
No default.

ip-group <name>

If you have selected ip-group for group-type, then specify the IP Group you have created through config server-policy ip-group. By using the IP group, you can save the effort to type the IP addresses every time you need to re-use them.

No default.

type {trust-ip | black-ip | allow-only-ip }

Select either:

  • black-ip—The source IP address that is distrusted, and is permanently blocked (blacklisted) from accessing your web servers, even if it would normally pass all other scans.
    Note: If multiple clients share the same source IP address, such as when a group of clients is behind a firewall or router performing network address translation (NAT), blacklisting the source IP address could block innocent clients that share the same source IP address with an offending client.
  • trust-ip—The source IP address is trusted and allowed to access your web servers, unless it fails a previous scan. For details, see Sequence of scans.

By default, if the IP address of a request is neither in the Block IP nor Trust IP list, FortiWeb will pass this request to other scans to decide whether it is allowed to access your web servers. However, you can define the allow-only-ip IP addresses so that such requests can be screened against the Allow Only IPs before they are passed to other scans.

  • allow-only-ip—If the source IP address is a allow-only-ip, it will be passed to other scans to decide whether it's allowed to access your web servers. If not, FortiWeb will take actions according to the trigger policy.
    If the Allow Only range is empty, then the source IP addresses which are not in the Block IP and Trust IP list will be passed directly to other scans.

Requests that are blocked according to the IP Lists will receive a warning message as the HTTP response. The warning message page includes ID: 70007, which is the ID of all attack log messages about requests from blocked IPs.

trust-ip

Example

The following shows the configuration for a trusted host of 192.0.2.0 followed by a blacklisted client of 192.0.2.1.

config waf ip-list

edit "IP-List-Policy1"

config members

edit 1

set ip "192.0.2.0"

next

edit 2

set type black-ip

set ip "192.0.2.1"

set severity Medium

set trigger-policy "TriggerActionPolicy1"

next

end

next

end

Related topics

waf ip-list

waf ip-list

Use this command to define which source IP addresses are trusted clients, undetermined, or distrusted.

  • Trusted IPs—Almost always allowed to access to your protected web servers. Trusted IPs are exempt from many (but not all) of the restrictions that would otherwise be applied by a server policy. To determine skipped scans, see debug flow trace.
  • Neither—If a source IP address is neither explicitly blacklisted or trusted by an IP list policy, the client can access your web servers, unless it is blocked by any of your other configured, subsequent web protection scan techniques. For details, see debug flow trace.
  • Blacklisted IPs—Blocked and prevented from accessing your protected web servers. Requests from blacklisted IP addresses receive a warning message in response. The warning message page includes ID: 70007, which is the ID of all attack log messages about requests from blacklisted IPs.
Because FortiWeb evaluates trusted and blacklisted IP policies before many other techniques, defining these IP addresses can improve performance.

Alternatively, you can block sets of many clients based upon their reputation (see waf ip-intelligence-ignore-x-forwarded-for) or geographical origin (see waf geo-block-list).

To use this command, your administrator account’s access control profile must have either w or rw permission to the wafgrp area. For details, see Permissions.

Syntax

config waf ip-list

edit "<ip-list_name>"

set severity {Low | Medium | High | Info}

set action { alert_deny | block-period | deny_no_log}

set block-period <block_period_int>

set ignore-x-forwarded-for {enable | disable}

set trigger-policy "<trigger-policy_name>"

config members

edit waf ip-list

set group-type {ip-string | ip-group | IP-external}

set ip "<client_ip>"

set ip-group <name>

set type {trust-ip | black-ip | allow-only-ip }

next

end

next

end

Variable Description Default

"<ip-list_name>"

Enter the name of a new or existing rule. The maximum length is 63 characters.

To display the list of existing rules, enter:

edit ?

No default.

action { alert_deny | block-period | deny_no_log}

Select which action FortiWeb will take when it detects a violation of the rule:

  • alert_deny—Block the request (or reset the connection) and generate an alert and/or log message.

  • deny_no_log—Block the request (or reset the connection).

  • block-period—Block subsequent requests from the client for a number of seconds. Also configure block-period.

Note: This setting will be ignored if monitor-mode {enable | disable} is enabled in a server policy.

block-period

block-period <block_period_int>

Enter the number of seconds that you want to block subsequent requests from a client after FortiWeb detects that the client has violated the rule. The valid range is 1–3,600 seconds.

This setting is available only if Action is set to block-period.

60

severity {Low | Medium | High | Info}

When rule violations are recorded in the attack log, each log message contains a Severity Level (severity_level) field. Select which severity level the FortiWeb appliance will use when a blacklisted IP address attempts to connect to your web servers:

  • Low
  • Medium
  • High
  • info
low

trigger-policy "<trigger-policy_name>"

Select which trigger, if any, that the FortiWeb appliance will use when it logs and/or sends an alert email about a blacklisted IP address’s attempt to connect to your web servers. The maximum length is 63 characters. For details, see log trigger-policy.

To display the list of existing trigger policies, enter:

set trigger ?

No default.

ignore-x-forwarded-for {enable | disable}

By default, FortiWeb scans the IP addresses in the X-Forwarded-For header at the HTTP layer. This causes high resource consumption. To enhance the performance, you can enable Ignore X-Forwarded-For so that the IP addresses can be scanned at the TCP layer instead. This avoids HTTP packets being processed unnecessarily.

disable

<entry_index>

Enter the index number of the individual entry in the table. The valid range is 1–9,999,999,999,999,999,999. No default.

group-type {ip-string | ip-group | IP-external}

Select ip-string to enter IP addresses or ranges, or ip-group to reference the IP groups you have created through config server-policy ip-group, or IP-external to reference an external IP address resource you have created through config system external-resource.

ip-string

ip "<client_ip>"

If you have selected ip-string for group-type, then enter one of the following values:

  • A single IP address that a client source IP must match, such as a trusted private network IP address (e.g. an administrator’s computer, 172.16.1.20). Multiple addresses or ranges should be separated with comma ",".
  • A range or addresses (e.g. 1.2.3.4,2001::1,1.2.3.4-1.2.3.40,2001::1-2001::100).
No default.

ip-group <name>

If you have selected ip-group for group-type, then specify the IP Group you have created through config server-policy ip-group. By using the IP group, you can save the effort to type the IP addresses every time you need to re-use them.

No default.

type {trust-ip | black-ip | allow-only-ip }

Select either:

  • black-ip—The source IP address that is distrusted, and is permanently blocked (blacklisted) from accessing your web servers, even if it would normally pass all other scans.
    Note: If multiple clients share the same source IP address, such as when a group of clients is behind a firewall or router performing network address translation (NAT), blacklisting the source IP address could block innocent clients that share the same source IP address with an offending client.
  • trust-ip—The source IP address is trusted and allowed to access your web servers, unless it fails a previous scan. For details, see Sequence of scans.

By default, if the IP address of a request is neither in the Block IP nor Trust IP list, FortiWeb will pass this request to other scans to decide whether it is allowed to access your web servers. However, you can define the allow-only-ip IP addresses so that such requests can be screened against the Allow Only IPs before they are passed to other scans.

  • allow-only-ip—If the source IP address is a allow-only-ip, it will be passed to other scans to decide whether it's allowed to access your web servers. If not, FortiWeb will take actions according to the trigger policy.
    If the Allow Only range is empty, then the source IP addresses which are not in the Block IP and Trust IP list will be passed directly to other scans.

Requests that are blocked according to the IP Lists will receive a warning message as the HTTP response. The warning message page includes ID: 70007, which is the ID of all attack log messages about requests from blocked IPs.

trust-ip

Example

The following shows the configuration for a trusted host of 192.0.2.0 followed by a blacklisted client of 192.0.2.1.

config waf ip-list

edit "IP-List-Policy1"

config members

edit 1

set ip "192.0.2.0"

next

edit 2

set type black-ip

set ip "192.0.2.1"

set severity Medium

set trigger-policy "TriggerActionPolicy1"

next

end

next

end

Related topics