- Create WAF and ARL profiles
- Create security profile
- You can use your own Captcha ID, or default one from Yandex Cloud will be used
- See different examples
- For settings descriptions see Yandex Cloud SWS documentation
Condition block structure (used in smart_protection, waf, and rule_condition, advanced_rate_limiter_rules, waf_exclusion_rules) source link:
-
authority block (optional):
- authorities (list of objects with attribute)
-
http_method block (optional):
- http_methods (list of objects with attribute)
-
request_uri block (optional):
-
path block (optional)
-
queries (optional, list):
- key (string, required): Query string key.
- value block (optional)
-
-
headers (optional, list):
- name (string, required): HTTP header name.
- value block (optional)
-
source_ip block (optional):
- ip_ranges_match block (optional):
- ip_ranges (list of strings, optional): IP ranges to match.
- ip_ranges_not_match block (optional):
- ip_ranges (list of strings, optional): IP ranges to exclude.
- geo_ip_match block (optional):
- locations (list of strings, optional): ISO country codes to match.
- geo_ip_not_match block (optional):
- locations (list of strings, optional): ISO country codes to exclude.
- ip_ranges_match block (optional):
GET
Enter into the terraform console
data.yandex_sws_waf_rule_set_descriptor.rule_set
. example
data "yandex_sws_waf_rule_set_descriptor" "rule_set" {
name = "OWASP Core Ruleset"
version = "4.0.0"
}
SET
waf_rules = [{
is_blocking = false
is_enabled = false
rule_id = "owasp-crs-v4.0.0-id944152-attack-java" # Rule ID
}]
- Install YC CLI
- Add environment variables for terraform authentication in Yandex.Cloud
export YC_TOKEN=$(yc iam create-token)
export YC_CLOUD_ID=$(yc config get cloud-id)
export YC_FOLDER_ID=$(yc config get folder-id)
Name | Version |
---|---|
terraform | >= 1.0.0 |
yandex | >= 0.101.0 |
Name | Version |
---|---|
yandex | 0.139.0 |
No modules.
Name | Type |
---|---|
yandex_sws_advanced_rate_limiter_profile.this | resource |
yandex_sws_security_profile.this | resource |
yandex_sws_waf_profile.this | resource |
yandex_client_config.client | data source |
yandex_sws_waf_rule_set_descriptor.rule_set | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
advanced_rate_limiter_rules | List of ARL rules with quotas and conditions. | list(object({ |
[] |
no |
arl_enabled | Advanced Rate Limiter enabled flag. | bool |
false |
no |
captcha_id | Captcha ID (optional). Set empty to use default. | string |
null |
no |
default_action | Default action (ALLOW or DENY). | string |
"DENY" |
no |
description | Description for SWS resources. | string |
null |
no |
folder_id | Folder for SWS resources. | string |
null |
no |
labels | Labels for resources. | map(string) |
{ |
no |
name | Name for resources. | string |
n/a | yes |
security_rules | List of security rules for the Security Profile resource. Each rule object supports: - name (string, required): Name of the security rule. - priority (number, required): Priority of the rule. The smaller the value, the higher is the rule priority. Exactly one of the following blocks may be specified per rule: 1. smart_protection block (optional): - mode (string, required): Protection mode. Possible values: "FULL", "API". - condition block (optional): Conditions when this protection is applied (see detailed structure below). 2. waf block (optional): - mode (string, required): WAF mode. Possible values: "FULL", "API". - condition block (optional): Conditions when WAF rules are applied (see detailed structure below). 3. rule_condition block (optional): - action (string, required): Action to perform if condition matches. Possible values: "ALLOW", "DENY". - condition block (optional): Conditions when this action is applied (see detailed structure below). Condition block structure (used in smart_protection, waf, and rule_condition): - authority block (optional): - authorities (list of objects with attribute) - http_method block (optional): - http_methods (list of objects with attribute) - request_uri block (optional): - path block (optional) - queries (optional, list): - key (string, required): Query string key. - value block (optional) - headers (optional, list): - name (string, required): HTTP header name. - value block (optional) - source_ip block (optional): - ip_ranges_match block (optional): - ip_ranges (list of strings, optional): IP ranges to match. - ip_ranges_not_match block (optional): - ip_ranges (list of strings, optional): IP ranges to exclude. - geo_ip_match block (optional): - locations (list of strings, optional): ISO country codes to match. - geo_ip_not_match block (optional): - locations (list of strings, optional): ISO country codes to exclude. |
list(object({ |
n/a | yes |
waf_analyze_request_body | Analyze request body settings. | object({ |
{ |
no |
waf_core_rule_set | Basic rule set settings. | object({ |
{ |
no |
waf_exclusion_rules | List of exclusion rules. | list(object({ |
[] |
no |
waf_rules | Additional rules for WAF profile. | list(object({ |
[] |
no |
Name | Description |
---|---|
arl_profile_id | The ID of the created ARL profile. |
security_profile_id | The ID of the created security profile. |
waf_profile_id | ID созданного WAF профиля. |