Managing traffic sources
Smart Web Security allows you to configure request processing rules according to the source of traffic. For example, you can separately process requests from the Tor network, VPNs, anonymous networks, public proxies, or from individual countries.
All this is done with the help of preset Yandex Cloud IP address lists. These lists group IP addresses and networks together based on a particular characteristic, e.g., being Tor or VPN. The service maintains and regularly updates the lists.
This guide describes how to set up common traffic filtering rules based on source.
Setup steps
- Create a security profile.
- Set up a rule for Tor, proxy, and anonymous networks.
- Set up a rule for VPN traffic.
- Set up a rule based on regions.
- Check the order of executing the rules.
- Connect a security profile to the resources.
- Test the rules in logging mode.
- Activate the production mode.
Required paid resources
- Fee for the number of requests to Smart Web Security based on plans detailed in Yandex Smart Web Security pricing policy.
- Fee for the infrastructure of the protected resource depending on its location.
This guide assumes that you already have a configured web resource in your Yandex Cloud infrastructure. If your web resource is located in a different infrastructure, connect it to a proxy server as per Setting up basic protection in Smart Web Security.
Create a security profile
This guide uses a ready-made security profile template.
-
In the management console
, select the folder the protected resources are in. -
Go to Smart Web Security.
-
In the left-hand panel, select Security profiles.
-
Click Create profile and select From a preset template.
A preset profile includes:
- Basic default rule enabled for all traffic with the
Allowaction type. - Smart Protection rule,
sp-rule-1, enabled for all traffic with theFull protectionaction type.
- Basic default rule enabled for all traffic with the
-
Enter a name for the profile, e.g.,
sources-manage. -
Enable test mode for the
sp-rule-1Smart Protection rule:- For Action for the default base rule, select
Allow. - Click
next tosp-rule-1and select Edit. - Enable Only logging.
- Click Save changes.
- For Action for the default base rule, select
-
Under Fine-tuning ML models, do not withdraw your consent to the use of HTTP request info to improve your machine learning models. Otherwise, Smart Web Security will not be getting the data it needs to investigate security incidents.
-
Click Create.
Set up a rule for Tor, proxy, and anonymous networks
Such traffic is identified with the help of the is_tor, is_proxy, and is_anonymous lists.
- Open the security profile you created earlier.
- Click
Add rule. - Enter a name for the rule, e.g.,
traffic-sources-rule. - Enable Only logging.
- Set a higher priority than the Smart Protection rules, e.g.,
9100. - Specify the rule settings:
- Type:
Base. - Traffic:
On condition. - Conditions:
IP. - Conditions for IP:
IP belongs to the list.
- Type:
- For the
is_torlist, selectDeny. - Create a separate rule or add an additional condition for the
is_proxyandis_anonymouslists with theShow CAPTCHAaction. - Click Add.
This set of rules helps block traffic from Tor immediately and, separately, check requests from public proxies and anonymous networks via SmartCaptcha.
Set up a rule for VPN traffic
VPN traffic is identified with the help of the is_vpn and is_ml_vpn lists.
You can set separate processing rules for such traffic as per your security policy: allow, block, require CAPTCHA, or apply further restrictions in the ARL profile.
Warning
VPN traffic detection is based on Yandex Cloud IP addresses and does not guarantee complete accuracy. False positives and false negatives are a possibility. Your decision to block VPN traffic should align with your business scenarios, as some of your real users may be using VPN.
- In the security profile, click
Add rule. - Enter a name for the rule, e.g.,
vpn-traffic-rule. - Enable Only logging.
- Set up priority for the rule to be executed in the right order relative to other rules in the lists.
- Specify the rule settings:
- Type:
Base. - Traffic:
On condition. - Conditions:
IP. - Conditions for IP:
IP belongs to the list.
- Type:
- Select the list:
is_vpnoris_ml_vpn. - Select the VPN traffic action:
Allow: If VPN traffic is allowed.Deny: If VPN traffic has to be blocked.Show CAPTCHA: If further verification is required.
- Click Add.
To limit the request rate for VPN traffic, create an ARL profile and add to it a rule with conditions for the is_vpn and is_ml_vpn lists.
Set up a rule based on regions
- In the security profile, click
Add rule. - Enter a name for the rule, e.g.,
geo-traffic-rule. - Enable Only logging.
- Set a higher priority than the Smart Protection rules but with due consideration for existing list-based rules.
- Specify the rule settings:
- Type:
Base. - Traffic:
On condition. - Conditions:
IP. - IP conditions:
IP belongs to regionorIP does not belong to region.
- Type:
- Select the countries of interest using the two-letter code, e.g.,
RU,KZ,BY. - Select an action:
Allow: To allow traffic.Deny: To bock traffic.Show CAPTCHA: To send requests to SmartCaptcha.
- Click Add.
If your service targets only a few countries, it is best to use the IP does not belong to region condition. Then you can explicitly specify allowed regions and restrict the rest of the traffic.
Check the order of executing the rules
Security profile rules are applied on first-to-trigger basis. Therefore, specify the processing order ahead of time:
- First come the allowing rules for trusted traffic.
- Then, rules for high-risk sources.
- Then, rules based on regions.
- After that, the Smart Protection rules and other general rules.
For more on the order of executing the rules, click here.
Test the rules in logging mode
Keep the new rules in the Only logging mode for a few days. During which period:
- Analyze which requests are covered by the rules.
- Estimate the share of legitimate traffic.
- Update your lists, regions, and actions.
Use logs and the service's monitoring capabilities for your analysis. For more information, see Configuring logging via Smart Web Security and Monitoring in Smart Web Security.
Activate the production mode
After testing, disable Only logging for the rules. Keep on monitoring and updating the rules as needed.