Getting started with Yandex Smart Web Security
Smart Web Security protects your infrastructure from cybersecurity threats at application layer L7 of the OSI model. These may include DDoS attacks, bots, and SQL injections. In addition, you can enable DDoS protection at levels L3 and L4 using Yandex DDoS Protection.
Smart Web Security is an assortment of tools you can use either separately or in a combination for optimized protection for your resources. The main Smart Web Security component is a security profile to which you can connect:
- Basic rules. For simple traffic filtering based on certain conditions.
- Smart Protection rules. To analyze traffic with machine learning and behavioral analysis algorithms.
- WAF profile rules. Allow using rule sets to counter common security threats, such as OWASP Core Rule Set (CRS). Rule sets protect web apps from many known threats, e.g., SQL injections, command injections, cross-site scripting, unauthorized access to server resources, and more.
- CAPTCHA. After you have checked traffic with rules, you can additionally route it to Yandex SmartCaptcha for protection against bots and spam.
- ARL profile. To limit the number of requests to the protected resource based on various conditions.
To protect resources, you need to connect a security profile to a virtual host or an Ingress controller in Yandex Application Load Balancer.
To get started with the service:
- Prepare your cloud
- Create and check a security profile
- Connect the security profile to a virtual host
- (Optional) Create and connect a WAF profile
- (Optional) Create and connect an ARL profile
- Configure the L7 network load balancer for additional protection
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 and check a security profile
Create your first security profile and connect it to an existing virtual host of an L7 load balancer in Yandex Application Load Balancer.
If you have no L7 load balancer configured, you can deploy a test infrastructure.
Create a security profile
-
In the management console
, select the folder you want to create a profile in. -
In the list of services, select Smart Web Security.
-
Click Create and select From a preset template.
A preset profile includes:
- Basic default rule enabled for all traffic with the
Deny
action type. - Smart Protection rule enabled for all traffic with the
Full protection
action type.
Tip
Creating a pre-configured profile with full Smart Protection is preferable. This will ensure the highest level of security for your resource being protected.
- Basic default rule enabled for all traffic with the
-
Enter a name for the profile, e.g.,
test-sp1
. -
In the Action for the default base rule field, select
Deny
. -
Click Create.
Check your security profile settings
-
Select the
test-sp1
profile you created earlier. -
Make sure the Security rules tab contains a rule with the following parameters:
- Type:
Smart Protection
. - Action:
Full protection
. - Conditions:
All traffic
.
This rule sends all incoming traffic of the protected resource for automatic analysis using ML and behavioral analysis algorithms. As a result of automatic analysis:
- Legitimate requests are routed to the protected resource.
- Illegitimate requests and attacks are blocked.
- Suspicious requests are sent to SmartCaptcha for additional verification.
- Type:
Connect the security profile to the virtual host
-
At the top right, click
Connect to host. -
In the window that opens, select:
-
Virtual host. You can connect the security profile to multiple virtual hosts at once.
To connect the profile to another L7 load balancer, click Add load balancer.
-
Click Connect.
You will see the connected virtual host under Connected hosts.
Create and connect a WAF profile
WAF allows using rule sets to protect web applications from various information attacks.
Create a WAF profile
- In the management console
, select the folder you want to create a WAF profile in. - In the list of services, select Smart Web Security.
- Go to the WAF profiles tab and click Create WAF profile.
- Enter a name for the profile, e.g.,
test-waf-profile-1
. - By default, the WAF profile includes a basic rule set 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 Set up a basic rule set.
-
Set the Anomaly threshold, which is the sum of anomaly values of the triggered rules that will block the request, e.g.,
Moderate: 25 and more
.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 required Paranoia level, e.g.,
2 or 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 exception 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 either select
All rules
or specify particular rules. -
Under Traffic conditions, select the triggering conditions for the exclusion rule.
If you leave the Conditions field empty, the exclusion rule will apply to all 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 Type field, select
Web Application Firewall
. - In the WAF profile field, select the previously created
test-waf-profile-1
. - In the Action field, select
Full protection
. - If required, set the conditions for traffic mapping.
- Click Add.
Create and connect an ARL profile
ARL allows limiting the number of requests to the protected resource to avoid an overload.
Create an ARL profile
- In the management console
, select the folder you want to create your ARL profile in. - In the list of services, select Smart Web Security.
- Go to the
ARL profiles tab and click Create ARL profile. - Enter a name for the profile, e.g.,
test-arl-profile-1
. - Add profile description and labels if needed.
- Click Create.
Configure rules
-
On the ARL profile's review page that opens, click Add rule.
-
Enter a name for the rule, e.g.,
arl-rule-1
. -
In the Priority field, set the rule's priority within the ARL profile, e.g.,
1000
. -
(Optional) To test the ARL rule, enable the Only logging (Dry run) mode. Requests will not be blocked in this mode.
-
Under Traffic conditions, select
All traffic
orOn condition
. -
To set traffic conditions, select one or more items from the Conditions list:
IP
: IP address, IP address range, or IP address region.HTTP header
: HTTP header string.Host
: Domain receiving the request.HTTP method
: Request method.Cookie
: Cookie header string.
-
Under Request counting, select how to count requests for limit application purposes:
No grouping
: Count each request separately.Grouping by property
: Count the number of request groups sharing one or more common properties.
-
Select a grouping property:
Request path
: Request path.HTTP method
: Request method.IP address
: IP address the request originates from.Region
: IP address region of the requests.Host
: Domain receiving the request.HTTP cookie
: String in the cookie header.HTTP header
: HTTP header string.Query params
: String in query parameters.
-
(Optional) Enable Case-sensitive to put properties with the same values in different cases into different groups.
-
Specify the request limit and select the time interval, e.g.,
1000
requests per1
minute. -
Click Save rule.
Connect your ARL profile to a security profile
- Go to the
Security profiles tab. - From the list, select the security profile you want to connect your ARL profile to, e.g.,
test-sp1
. - Click
Edit. - In the ARL profile list, select the previously created
test-arl-profile-1
. - Click Save.
Configure the L7 load balancer for additional protection
To enhance DDoS protection of your applications, consider these additional tips:
- Configure autoscaling. This will allow you to dynamically adapt to the increased load and optimize traffic redistribution.
- Place resource units in multiple availability zones.
- Use the secure HTTPS protocol: configure a listener to automatically redirect requests from HTTP to HTTPS.
- Ensure protection at the lower OSI model level: enable basic DDOS protection at L3 and L4 to prevent some attacks at an earlier stage.
These measures, in addition to setting up Smart Web Security, will increase the resilience of your services to potential threats and ensure security of your applications.