Editing a rule in an ARL profile
You can edit ARL rules only in an ARL profile. Basic rules, as well as Smart Protection and WAF rules, are edited in a security profile.
- In the management console
, select the folder with the ARL profile. - In the list of services, select Smart Web Security.
- In the left-hand panel, select
ARL profiles. - Select the profile where you want to edit a rule.
- Next to the rule in question, click
and select Edit. In the window that opens:-
Edit the basic rule settings:
- Name.
- Description.
- Rule priority. The smaller the value, the higher is the rule priority.
- Dry run (logging without request blocking) settings.
-
Under Conditions for traffic, 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, IP address region, or address list.HTTP header: HTTP header string.Request URI: Request path.Host: Domain receiving the request.HTTP method: Request method.Cookie: Cookie header string.
You can set multiple conditions by selecting all the condition types you need in the Conditions field.
You can also set multiple conditions of the same type by clicking
and or or in the section with the condition you need.To delete a condition, click
.
-
-
Change the request counting method and grouping properties:
-
No grouping: To count each request individually. -
Grouping by property: To count request groups sharing one or more common properties.-
Select a grouping property:
Automatic grouping Grouping by key Request path: Request path.HTTP cookie: Cookie header string.HTTP method: Request method.HTTP header: HTTP header string.IP address: Source IP address of the request.Query params: String in the request parameters.Region: IP address region of the requests.Host: Domain receiving the request.To group by key, specify the key value.
-
Optionally, enable
Case-sensitiveto put properties with the same values in different cases into different groups.
-
Specify a request limit or request limit per group, as well as a time interval (
1 secondto60 minutes) for the limit. All requests above the limit will get blocked. -
-
Click Save rule.
-
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 edit a rule in an ARL profile:
-
Open the Terraform configuration file and edit the
advanced_rate_limiter_rulesection in theyandex_sws_advanced_rate_limiter_profiledescription.# ARL profile resource "yandex_sws_advanced_rate_limiter_profile" "arl-profile" { name = "<profile_name>" description = "<profile_description>" # Rule 1 advanced_rate_limiter_rule { name = "<new_rule_name>" priority = <new_rule_priority> description = "<new_rule_description>" dry_run = true static_quota { action = "DENY" limit = <new_rule_limit> period = <new_rule_period> condition { request_uri { path { exact_match = "/api" } } } } } # Rule 2 advanced_rate_limiter_rule { name = "<rule_name>" priority = <rule_priority> description = "<rule_description>" dry_run = true static_quota { action = "DENY" limit = <rule_limit> period = <rule_period> condition { source_ip { geo_ip_match { locations = ["ru", "kz"] } } } } } }For more information about the
yandex_sws_advanced_rate_limiter_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 AdvancedRateLimiterProfile resource or the AdvancedRateLimiterProfile/Update gRPC API call.