Adding a WAF exclusion rule
- In the management console
, select the folder the WAF profile is in. - In the list of services, select Smart Web Security.
- In the left-hand panel, select WAF profiles.
- Select the profile you want to add an exclusion rule to.
- In the left-hand menu, go to the
Exclusion rules tab and click Create exception rule. In the window that opens:-
Name the exclusion rule.
-
(Optional) Enter a description.
-
(Optional) Enable Write logs to log exception rule triggering.
-
Under Scope of use, select rules from the basic set for which the exclusion will be valid:
-
All rules
: Exclusion will be valid for all rules. -
Selected rules
: Exclusion will be valid for the selected rules.Click Add rules to select rules from the basic set.
-
-
Under Traffic conditions, specify which traffic the rule will be used to analyze:
-
All traffic
: The rule will be used to analyze the whole traffic. -
On condition
: The rule will be used to analyze the traffic specified in the Conditions field:IP
: IP address, IP address range, or IP address region.HTTP header
: HTTP header string.HTTP body
: String in the HTTP body.Request URI
: Request path.Host
: Domain receiving the request.HTTP method
: Request method.Cookie
: Cookie header string.
You can set multiple conditions of the same type. To do this, select all the condition types you need in the Conditions field.
You can also set multiple conditions of the same type at the same time. To do this, click
and or or in the section with the condition you need.To delete a condition, click
.
-
-
Click Create.
-
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the documentation on the Terraform
If you don't have Terraform, install it and configure the Yandex Cloud provider.
-
Open the Terraform configuration file and edit the fragment with
yandex_sws_waf_profile
description: add a section namedexclusion_rule
with a WAF exclusion rule.# WAF profile resource "yandex_sws_waf_profile" "default" { name = "waf-profile-default" core_rule_set { inbound_anomaly_score = 2 paranoia_level = local.waf_paranoia_level rule_set { name = "OWASP Core Ruleset" version = "4.0.0" } } ... # Exclusion rule exclusion_rule { name = "<exclusion_rule_name>" exclude_rules { exclude_all = <true_or_false> rule_ids = ["rule_1_ID","rule_2_ID"] } } }
Where:
exclusion_rule
: Exclusion rule:name
: Exclusion rule name.exclude_rules
: Exclusion rule parameters:exclude_all
: Exclusion will be valid for all rules. The possible values arefalse
ortrue
.rule_ids
: List of IDs for rules from the basic set for which the exclusion will be valid. To specify individual rules, setexclude_all
tofalse
.
For more information about the
sws_waf_profile
resource parameters in Terraform, see the relevant provider documentation . -
Create resources:
-
In the terminal, change to the folder where you edited the configuration file.
-
Make sure the configuration file is correct using the command:
terraform validate
If the configuration is correct, the following message is returned:
Success! The configuration is valid.
-
Run the command:
terraform plan
The terminal will display a list of resources with parameters. No changes are made at this step. If the configuration contains errors, Terraform will point them out.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
in the terminal and press Enter.
-
You can check the updates of your resources in the management console