Updating basic WAF profile settings
-
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. -
In the row with the profile you need, click
and select Edit. -
On the profile editing page, update these parameters:
- Name.
- Description.
- Labels. To add a label, click Add label.
-
(Optional) Under Request analysis, configure the Inspect request body option:
-
The default value for the Maximum request body size field is
8 kB
. Currently, you cannot change the default value. -
Select the action to be performed when the maximum size is exceeded:
Do not analyze body
.Block request
.
-
-
Click Save.
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.
To change the parameters of a Yandex Smart Web Security WAF profile created with Terraform:
-
Open the Terraform configuration file and edit the fragment with the WAF profile description.
Below is an example of a WAF profile description in the Terraform configuration
# In the basic set, rules of this paranoia level and below will be active 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" } } # Activating rules from the basic set if their paranoia level is not higher than specified 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 } } analyze_request_body { is_enabled = true size_limit = 8 size_limit_action = "IGNORE" } }
For more information about the
sws_waf_profile
resource parameters in Terraform, see the relevant provider documentation . -
Apply the changes:
-
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
Use the update REST API method for the WafProfile resource or the WafProfile/Update gRPC API call.