Editing basic WAF profile settings
- 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.
- In the row with the profile you need, click
and select Edit. - On the profile editing page, update these basic parameters:
- Name.
- Description.
- Labels. To add a label, click Add label.
- Enable or disable rule sets for the WAF profile.
- For the OWASP Core Rule Set
, select a version. - If multiple rule sets are enabled:
- Select the profile trigger conditions:
- Verdict returned in at least one selected rule set: At least one rule set has recognized the request as a threat.
- Verdict returned in all rule sets: All added rule sets have recognized the request as a threat.
- Arrange rule sets in the order of priority in which the rules will analyze the request. Top positions indicate higher priority.
- Select the profile trigger conditions:
- Click Save.
- If necessary, configure rules in each of the added rule sets.
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.
To change the settings of a Yandex Smart Web Security WAF profile created with Terraform:
-
Open the Terraform configuration file and edit the section describing the WAF profile.
Example of a WAF profile description in the Terraform configuration
# In the basic set, rules of this paranoia level and below will be enabled locals { waf_paranoia_level = 1 } # OWASP Core Rule Set data source data "yandex_sws_waf_rule_set_descriptor" "owasp4" { name = "OWASP Core Ruleset" version = "4.0.0" } # WAF profile resource "yandex_sws_waf_profile" "default" { name = "<WAF_profile_name>" # Basic rule set core_rule_set { inbound_anomaly_score = 2 paranoia_level = local.waf_paranoia_level rule_set { name = "OWASP Core Ruleset" version = "4.0.0" } } # Enabling rules from the basic set if their paranoia level is not higher than the value defined in the waf_paranoia_level variable dynamic "rule" { for_each = [ for rule in data.yandex_sws_waf_rule_set_descriptor.owasp4.rules : rule if rule.paranoia_level <= local.waf_paranoia_level ] content { rule_id = rule.value.id is_enabled = true is_blocking = false } }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 update in the management console
Use the update REST API method for the WafProfile resource or the WafProfile/Update gRPC API call.