Editing basic WAF profile settings
-
In the management console
, select the folder containing the WAF profile. -
Navigate
to Smart Web Security. -
In the left-hand panel, select WAF profiles.
-
In the row with the profile, click
→ Edit. -
On the profile editing page, update these basic parameters:
- Name.
- Description.
- Labels. To add a new label, click Add label.
-
Enable or disable rule sets for the WAF profile.
-
Select a rule set version.
-
If multiple rule sets are enabled:
-
Select the profile trigger conditions:
Verdict DENY returned in at least one selected rule set: At least one rule set has recognized the request as a threat.Verdict DENY returned in each selected rule set: 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.
-
-
Click Save.
-
If required, configure rules in each set you added.
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the guides on the Terraform
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), authenticate using the appropriate method.
To update the parameters of the Yandex Smart Web Security WAF profile you created with Terraform:
-
Open the Terraform configuration file and edit the fragment describing the WAF profile.
Example of a WAF profile description in the Terraform configuration
# Declaring local variables locals { # In the basic set, rules of this paranoia level and below will be enabled waf_paranoia_level = 1 # OWASP Core Ruleset identification ruleset_name = "OWASP Core Ruleset" ruleset_version = "4.0.0" ruleset_id = "OWASP_CRS_4_0_0" ruleset_type = "CORE" } # OWASP Core Rule Set data source data "yandex_sws_waf_rule_set_descriptor" "source" { name = local.ruleset_name version = local.ruleset_version } # WAF profile resource "yandex_sws_waf_profile" "default" { name = "waf-profile-owasp" # Rule set rule_set { action = "DENY" is_enabled = true priority = 1 # Basic rule set core_rule_set { inbound_anomaly_score = 2 paranoia_level = local.waf_paranoia_level rule_set { name = local.ruleset_name version = local.ruleset_version id = local.ruleset_id type = local.ruleset_type } } } # 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.source.rules : rule if rule.paranoia_level <= local.waf_paranoia_level ] content { rule_id = rule.value.id is_enabled = true is_blocking = false } } }For more on the properties of the
yandex_sws_waf_profileresource, see this provider guide. -
Apply the changes:
-
In the terminal, navigate to the configuration file directory.
-
Make sure the configuration is correct using this command:
terraform validateIf the configuration is valid, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
-
Apply the configuration changes:
terraform apply -
Type
yesand press Enter to confirm the changes.
-
You can check the update in the management console
Use the update REST API method for the WafProfile resource or the WafProfile/Update gRPC API call.