Editing a WAF exclusion rule
- In the management console
, select the folder containing the WAF profile. - In the list of services, select Smart Web Security.
- In the left-hand panel, select WAF profiles.
- Select the profile where you want to edit an exclusion rule.
- In the left-hand menu, go to the
Exclusion rules tab. - Next to the rule in question, click
and select Edit. In the window that opens:-
Edit the exclusion rule name and description as needed.
-
Optionally, enable Write logs to log exception rule triggering.
-
Under Scope of use, edit rules from the basic set to which the exclusion will apply:
-
All rules: Exclusion will apply to all rules. -
Selected rules: Exclusion will apply to the selected rules.Click Add rules to select rules from the basic set.
-
-
Under Traffic conditions, specify the traffic the rule will apply to:
-
All traffic: Rule will apply to all traffic. -
On condition: Rule will apply to the traffic defined in the Conditions field:IP: IP address, IP address range, or IP address region.HTTP header: HTTP header string.HTTP body: HTTP body string.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 by selecting all the condition types you need in the Conditions field.
You can also set multiple conditions of the same type at the same time by clicking
and or or in the section with the condition you need.To delete a condition, click
.
-
-
Click Save.
-
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the relevant documentation on the Terraform
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
-
Open the Terraform configuration file and edit the
exclusion_rulesection in theyandex_sws_waf_profiledescription.# 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"] } } }For more information about
sws_waf_profileproperties, see this Terraform provider article. -
Apply the changes:
-
In the terminal, go to the directory where you edited the configuration file.
-
Make sure the configuration file is correct using this command:
terraform validateIf the configuration is correct, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.
-
Apply the changes:
terraform apply -
Type
yesand press Enter to confirm the changes.
-
You can check the resource updates in the management console
Use the update REST API method for the WafProfile resource or the WafProfile/Update gRPC API call.