Getting started with a WAF profile
To protect your web apps from external threats, Yandex Smart Web Security implements a Web Application Firewall (WAF).
Create your first WAF profile and connect it to an existing Yandex Smart Web Security security profile.
If you have not configured a security profile yet, create it and connect it to a virtual host of an Yandex Application Load Balancer L7 load balancer. For more information, see Getting started with a security profile.
To get started with WAF:
- Create a WAF profile.
- Configure a basic rule set.
- Create an exclusion rule.
- Connect the WAF profile to a security profile.
Prepare your cloud
Sign up for Yandex Cloud and create a billing account:
- Go to the management console
and log in to Yandex Cloud or create an account if you do not have one yet. - On the Yandex Cloud Billing
page, make sure you have a billing account linked and it has theACTIVE
orTRIAL_ACTIVE
status. If you do not have a billing account, create one.
If you have an active billing account, you can go to the cloud page
Learn more about clouds and folders.
Create a WAF profile
-
In the management console
, select the folder where you want to create your WAF profile. -
In the list of services, select Smart Web Security.
-
Go to the
WAF profiles tab and click Create WAF profile. -
Describe a scenario of using WAF features in your projects and click Submit request.
Once your request is approved, you can proceed to create a WAF profile.
-
Enter a name for the profile, e.g.,
test-waf-profile-1
. -
The WAF profile's default basic rule set is called OWASP Core Rule Set
. To view the rules it includes, click the line with its description. -
Click Create.
Configure a basic rule set
-
On the WAF profile's review page that opens, click Configure basic rule set.
-
Set the preferred Anomaly threshold, which is the sum of anomaly values of the triggered rules that will block the request, e.g.,
Moderate: 25 or higher
.We recommend to start with the anomaly threshold of
25
and gradually reduce it to5
. To reduce the anomaly threshold, address WAF false positives triggered by legitimate requests. To do so, select rules from the basic set and configure exclusion rules. You can use the Only logging (dry-run) mode in the security profile to test various anomaly thresholds. -
Set the preferred Paranoia level, e.g.,
2 and lower
.Paranoia level classifies rules according to their aggression. The higher the paranoia level, the better your protection, but also the higher the probability of WAF false positives.
-
Check the rules you included in the set. Add or delete them as needed. When using rules, pay attention to their anomaly values and paranoia levels.
You can turn any rule from the set into a blocking rule. A request that satisfies such a rule will be blocked regardless of the anomaly threshold you specified. To turn a rule into a blocking rule, click
Create an exclusion rule
-
Go to the
Exclusion rules tab and click Create exclusion rule. -
Enter a name for the exclusion rule, e.g.,
exception-rule-1
. -
Under Scope of use, specify rules from the basic set for which the exclusion will be valid. You can select All rules or specific ones.
-
Under Traffic conditions, select the conditions for the exclusion rule to trigger.
If you leave the Conditions field empty, the exclusion rule will apply to the whole traffic.
-
Click Create.
Connect the WAF profile to a security profile
- Go to the
Security profiles tab. - From the list, select the security profile you want to connect your WAF profile to, e.g.,
test-sp1
. - Click
Add rule. - Enter a name for the rule, e.g.,
waf-rule-1
. - In the Priority field, set a value higher than that of the Smart Protection rules already existing in the security profile, e.g.,
888800
. - (Optional) To test your WAF profile and simulate false positives triggered by legitimate requests, use the Only logging (dry-run) mode in the security profile.
- In the Rule type field, select Web Application Firewall.
- In the WAF profile field, select the
test-waf-profile-1
profile you created earlier. - In the Action field, select Full protection.
- If required, set the conditions for traffic mapping.
- Click Add.