Reviewed-by: Rogal, Marcel <mrogal@noreply.gitea.eco.tsi-dev.otc-service.com> Co-authored-by: qinweiwei <qinweiwei@huawei.com> Co-committed-by: qinweiwei <qinweiwei@huawei.com>
30 KiB
Configuring CC Attack Protection Rules to Defend Against CC Attacks
CC attack protection can limit the access to a protected website based on a single IP address, cookie, or referer. To use this protection, ensure that you have toggled on CC Attack Protection.
A reference table can be added to a CC attack protection rule. The reference table takes effect for all protected domain names.
Prerequisites
You have added the website you want to protect to WAF.
Constraints
- If you set Logic to Include any value, Exclude any value, Equal to any value, Not equal to any value, Prefix is any value, Prefix is not any of them, Suffix is any value, or Suffix is not any of them, select an existing reference table. For details, see Creating a Reference Table to Configure Protection Metrics in Batches.
- It takes several minutes for a new rule to take effect. After a rule takes effect, protection events triggered by the rule will be displayed on the Events page.
Configuring a CC Attack Protection Rule
- Log in to the management console.
- Click
in the upper left corner and select a region or project. - Click
in the upper left corner and choose Web Application Firewall (Dedicated) under Security. - In the navigation pane on the left, click Policies.
- Click the name of the target policy to go to the protection configuration page.
- Click the CC Attack Protection configuration area and toggle it on or off if needed.
- In the upper left corner above the CC Attack Protection rule list, click Add Rule.
- In the displayed dialog box, configure a CC attack protection rule by referring to Table 1.
Table 1 Rule parameters Parameter
Description
Example Value
Rule Description
A brief description of the rule. This parameter is optional.
--
Rate Limit Mode
- Per IP address: A website visitor is identified by the IP address.
- Per user: A website visitor is identified by the key value of Cookie or Header.
- Other: A website visitor is identified by the Referer field (user-defined request source).
NOTE:If you set Rate Limit Mode to Other, set Content of Referer to a complete URL containing the domain name. The Content field supports prefix match and exact match only, but cannot contain two or more consecutive slashes, for example, ///admin. If you enter ///admin, WAF will convert it to /admin.
For example, if you do not want visitors to access www.test.com, set Referer to http://www.test.com.
--
User Identifier
This parameter is mandatory when you select Per user for Rate Limit Mode.
- Cookie: A cookie field name. You need to configure an attribute variable name in the cookie that can uniquely identify a web visitor based on your website requirements. This field does not support regular expressions. Only complete matches are supported.
For example, if a website uses the name field in the cookie to uniquely identify a web visitor, enter name.
- Header: Set the user-defined HTTP header you want to protect. You need to configure the HTTP header that can identify web visitors based on your website requirements.
name
Trigger
The request features to be matched by the rule. If a request matches the features, WAF handles the request according to the configured rule.
- At least one condition is required for the rule to take effect. If multiple conditions are configured, the rule takes effect only when all conditions are met.
- Click Add to add a condition. You can add up to 30 conditions.
Field: Set to Path.
Logic: Set to Include.
Content: Set to /admin/.
Rate Limit
The number of requests allowed from a website visitor in the rate limit period. If the number of requests exceeds the rate limit, WAF takes the action you configure for Protective Action.
10 requests allowed in 60 seconds
Protective Action
The action that WAF will take if the number of requests exceeds Rate Limit you configured. The options are as follows:
- Verification code: WAF allows requests that trigger the rule as long as your website visitors complete the required verification.NOTE:
The cloud load balancer access mode does not support this protective action.
- Block: WAF blocks requests that trigger Rate Limit set in the rule.
- Block dynamically: WAF blocks requests that trigger the rule based on Allowable Frequency, which you configure after the first rate limit period is over.
- Log only: WAF only logs requests that trigger Rate Limit set in the rule.
Block
Application Schedule
- Immediate: The rule works immediately after it is enabled.
- Custom: You can select a time range for the rule to work.
Immediate
Allowable Frequency
This parameter can be set if you select Block dynamically for Protective Action.
WAF blocks requests that trigger the rule based on Rate Limit first. Then, in the following rate limit period, WAF blocks requests that trigger the rule based on Allowable Frequency you configure.
Allowable Frequency cannot be larger than Rate Limit.
NOTE:If you set Allowable Frequency to 0, WAF blocks all requests that trigger the rule in the next rate limit period.
8 requests allowed in 60 seconds
Block Duration
Period of time for which to block the item when you set Protective Action to Block.
600 seconds
Block Page
The page displayed if the request limit has been reached. This parameter is configured only when Protective Action is set to Block.
- If you select Default settings, the default block page is displayed.
- If you select Custom, you can write a custom error message, so that WAF will return this message to website visitors when their requests are blocked.
Custom
Block Page Type
If you select Custom for Block Page, select a type of the block page among options application/json, text/html, and text/xml.
text/html
Page Content
If you select Custom for Block Page, configure the content to be returned.
Page content styles corresponding to different page types are as follows:
- text/html: <html><body>Forbidden</body></html>
- application/json: {"msg": "Forbidden"}
- text/xml: <?xml version="1.0" encoding="utf-8"?><error> <msg>Forbidden</msg></error>
- Click Confirm. You can then view the added CC attack protection rule in the CC rule list.
- After the configuration is complete, you can view the added rule in the protection rule list. Rule Status is Enabled by default.
- If you do not want the rule to take effect, click Disable in the Operation column of the rule.
- To delete a rule you no longer need, click Delete in the Operation column of the rule.
- To modify or copy a rule, click or in the Operation column of the target rule, respectively.
Protection Verification
If you have configured a CC attack protection rule as required in Figure 1 (with Protective Action set to Block) by referring to Table 1 for your domain name www.example.com, take the following steps to verify the protection effect:
- Clear the browser cache and enter the domain name in the address bar to check whether the website is accessible.
- If the website is inaccessible, connect the website domain name to WAF by following the instructions in Step 1: Add Your Website to WAF.
- If the website is accessible, go to Step 2.
- Clear the browser cache, enter http://www.example.com/admin in the address bar, and refresh the page 10 times within 60 seconds. In normal cases, the custom block page will be displayed the eleventh time you refresh the page, and the requested page will be accessible when you refresh the page 60 seconds later.
If you select Verification code for protective action, a verification code is required for visitors to continue the access if they exceed the configured rate limit.
- Return to the WAF console. In the navigation pane on the left, click Events. On the displayed page, check event logs.





