Help Center/ Edge Security/ User Guide/ Security Protection/ Protection Policy/ Configuring Protection Policies/ Configuring CC Attack Protection Rules to Defend Against CC Attacks
Updated on 2024-12-17 GMT+08:00

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. To use this protection, ensure that you have toggled on CC Attack Protection (its status should be ).

Prerequisites

A protected website has been added. For details, see Adding a Website to EdgeSec.

Constraints

  • It takes several minutes for a new rule to take effect. After the rule takes effect, protection events triggered by the rule will be displayed on the Events page.
  • A reference table can be added to a CC attack protection rule. The reference table takes effect for all protected domain names.
  • A CC attack protection rule offers protective actions such as Verification code and Block for your choice. For example, you can configure a CC attack protection rule to block requests from a visit for 600 seconds if the visitor accessed a URL (for example, /admin*) of your website over 10 times within 60 seconds.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner of the page and choose Content Delivery & Edge Computing > CDN and Security.
  3. In the navigation pane on the left, choose Edge Security > Website Settings. The Website Settings page is displayed.
  4. In the Policy column of the row containing the target domain name, click the number to go to the Policies page.

    Figure 1 Website list

  5. In the CC Attack Protection configuration area, change Status as needed and click Customize Rule to go to the CC Attack Protection page.

    Figure 2 CC Attack Protection configuration area

  6. In the upper left corner of the CC Attack Protection page, click Add Rule.
  7. 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 Name

    Name of the rule

    test

    Rule Description

    A brief description of the rule. This parameter is optional.

    --

    Set Effective Time

    • Immediate: The rule takes effect immediately.
    • Time Segment: The rule takes effect after the set time segment.
    • Periodically: The rule takes effect in the specified period of each day.

    --

    Priority

    User-defined priority. The value ranges from 1 to 100.

    --

    Rate Limit Mode

    Requests from a specific source are limited. For example, if traffic from an IP address (or user) exceeds the rate limit you configure in this rule, EdgeSec limits traffic rate of the IP address (or user) in the way you configure.

    • Per IP address: A website visitor is identified by the IP address.
    • Per user: A website visitor is identified by the cookie value.

    --

    User Identifier

    Cookie field name, which is required when Rate Limit Mode is set to Per user.

    --

    Trigger

    Click Add to add conditions. At least one condition is required, but up to 30 conditions are allowed. If you add more than one condition, the rule will only take effect if all of the conditions are met.

    • Fields: include geolocation, path, IP address, cookie, header, Params, and HTTP code.
      NOTE:

      When Rate Limit Mode is set to Per user and the user identifier is Cookie, the fields in the trigger conditions cannot be geographical locations.

    • Subfield: Configure this field only when Cookie, Header, or Params is selected for Field.
      NOTICE:

      The length of a subfield cannot exceed 2,048 bytes. Only digits, letters, underscores (_), and hyphens (-) are allowed.

    • Logic: Select a logical relationship from the drop-down list.
      NOTE:

      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.

    • Content: Enter or select the content that matches the condition.

    Path Include /admin

    Rate Limit

    The maximum requests that a website visitor can initiate within the configured period. If the configured rate limit has been reached, EdgeSec will respond according to the protective action configured.

    10 requests allowed in 60 seconds

    Protective Action

    The action that EdgeSec will take if the number of requests exceeds Rate Limit you configured. The options are as follows:

    • Verification code: EdgeSec allows requests that trigger the rule as long as your website visitors complete the required verification. Currently, verification code supports English.
    • Block: EdgeSec blocks requests that trigger the rule.
    • Log only: EdgeSec only logs requests that trigger the rule.

    Block

    Block Page

    The page displayed if the maximum number of requests 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, a custom error message is displayed.

    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>

    Protection duration

    User-defined protection duration. The value ranges from 1 to 65535.

    --

  8. Click OK. You can then view the added CC attack protection rule in the CC rule list.

    • To disable a rule, click Disable in the Operation column of the rule. The default Rule Status is Enabled.
    • To modify a rule, click Modify in the row containing the rule.
    • To delete a rule, click Delete in the row containing the rule.

Configuration Example - Verification Code

If domain name www.example.com has been connected to EdgeSec, perform the following steps to verify that EdgeSec CAPTCHA verification is enabled.

  1. Add a CC attack protection rule with Protection Action set to Verification code.

    Figure 3 Verification code

  2. Enable CC attack protection.

    Figure 4 CC Attack Protection configuration area

  3. Clear the browser cache and access http://www.example.com/admin/.

    If you access the page 10 times within 60 seconds, a verification code is required when you attempt to access the page for the eleventh time. You need to enter the verification code to continue the access.

    There is a delay before the blocking takes effect. If the operation proceeds too quickly, the eleventh visiting attempt may not be blocked.

  4. Go to the EdgeSec console. In the navigation pane on the left, choose Events. View the event on the Events page.