Blocking Heavy-Traffic CC Attacks Through CC Attack Protection Rules
A CC attack protection rule can limit access to your website based on the IP address or cookie of a visitor. If the number of access requests from a visitor exceeds the threshold you configure, you can require the visitor to enter a verification code to continue the access, or block the request and return a custom page of certain type to the visitor.
In heave-traffic CC attacks, a single zombie server can send far more packets than a common user does. In this scenario, a rate limiting rule is the most effective method to fend off this type of CC attacks.
This topic provides an example for you to show how to configure an IP-based CC attack protection rule to limit access traffic.
- Website access mode: Cloud mode - CNAME access
- Protected object: domain names
- Billing mode: Yearly/Monthly
- Edition: Standard
- Protection rule: CC attack protection
Process
Procedure |
Description |
---|---|
Sign up for a HUAWEI ID, enable Huawei Cloud services, top up your account, and assign WAF permissions to the account. |
|
Buy WAF and select the region and WAF mode. |
|
Add the website you want to protect to WAF for traffic inspection and forwarding. |
|
Configure and enable CC attack protection rules to mitigate CC attacks against the protected website. |
Preparations
- Before purchasing WAF, create a Huawei account and subscribe to Huawei Cloud. For details, see Registering a HUAWEI ID and Enabling HUAWEI CLOUD Services and Real-Name Authentication.
If you have enabled Huawei Cloud services and completed real-name authentication, skip this step.
- Make sure that your account has sufficient balance, or you may fail to pay to your WAF orders.
- Make sure your account has WAF permissions assigned. For details, see Creating a User Group and Granting Permissions.
Table 1 System policies supported by WAF Role/Policy Name
Description
Category
Dependencies
WAF Administrator
Administrator permissions for WAF
System-defined role
Dependent on the Tenant Guest and Server Administrator roles.
- Tenant Guest: A global role, which must be assigned in the global project.
- Server Administrator: A project-level role, which must be assigned in the same project.
WAF FullAccess
All permissions for WAF
System-defined policy
None.
WAF ReadOnlyAccess
Read-only permissions for WAF.
System-defined policy
Step 1: Buy the Standard Edition Cloud WAF
- Log in to Huawei Cloud management console.
- On the management console page, choose .
- In the upper right corner of the page, click Buy WAF. On the purchase page displayed, complete the purchase by referring to configurations in Table 2.
Table 2 Purchase parameters Parameter
Example Value
Description
WAF Mode
Cloud Mode
Cloud mode - CNAME access is supported. Web services deployed on Huawei Cloud, other clouds, or on-premises can be protected. The protected objects are domain names.
Billing Mode
Yearly/Monthly
Yearly/Monthly is a prepaid billing mode, where you pay in advance for a subscription term and receive a discounted rate. This mode is ideal when the resource use duration is predictable.
Region
CN-Hong Kong
Select the region nearest to your services WAF will protect.
Edition
Standard
This edition is suitable for small and medium-sized websites.
- Confirm the product details and click Buy Now in the lower right corner of the page.
- Check the order details and read the WAF Disclaimer. Then, select the box and click Pay Now.
- On the payment page, select a payment method and pay for your order.
Step 2: Add a Website to WAF
- In the navigation pane on the left, choose Website Settings.
- In the upper left corner of the website list, click Add Website.
- Select Cloud - CNAME and click Configure Now.
- On the Add Website page, set the following parameters and retain the default values for other parameters. Table 3 describes the parameters.
Figure 1 Add Domain Name
Table 3 Mandatory parameters Parameter
Example Value
Description
Protected Domain Name
www.example.com
The domain name you want to add to WAF for protection.
Protected Port
Standard port
The port over which the website service traffic goes.
To protect port 80 or 443, select Standard port from the drop-down list.
Server Configuration
Client Protocol: HTTP.
Server Protocol: HTTP
Server Address: IPv4 XXX.XXX.1.1
Server Port: 80
Server address configuration. You need to configure the client protocol, server protocol, server weights, server address, and server port.
- Client Protocol: protocol used by a client to access a server. The options are HTTP and HTTPS.
- Server Protocol: protocol used by WAF to forward client requests. The options are HTTP and HTTPS.
- Server Address: public IP address (generally corresponding to the A record of the domain name configured on the DNS) or domain name (generally corresponding to the CNAME record of the domain name configured on the DNS) of the web server that a client accesses. The following IP address formats are supported:
- IPv4, for example, XX.XXX.1.1
- IPv6, for example, fe80:0000:0000:0000:0000:0000:0000:0000
- Server Port: service port over which the WAF instance forwards client requests to the origin server.
- Weight: Requests are distributed across backend origin servers based on the load balancing algorithm you select and the weight you assign to each server.
Use Layer-7 Proxy
No
- Yes: Web proxy products for layer-7 request forwarding are used, products such as anti-DDoS, CDN, and other cloud acceleration services.
- No: No layer-7 proxies are not used.
No is used in this example.
- Click Next. The basic information about the domain name is configured.
- Complete steps Whitelist WAF Back-to-Source IP Addresses and Test WAF as prompted.
- Complete DNS resolution.
Configure the CNAME record on the DNS platform hosting your domain name. For details, contact your DNS provider.
The following uses Huawei Cloud DNS as an example to show how to configure a CNAME record. The following configuration is for reference only.
- Copy the CNAME value provided by WAF in Figure 2.
- Click in the upper left corner of the page and choose Networking > Domain Name Service.
- In the navigation pane on the left, choose Public Zones.
- In the Operation column of the target domain name, click Manage Record Set. The Record Sets tab page is displayed.
- In the row containing the desired record set, click Modify in the Operation column.
- In the displayed Modify Record Set dialog box, change the record value.
- Name: Domain name configured in WAF
- Type: Select CNAME-Map one domain to another.
- Line: Default
- TTL (s): The recommended value is 5 min. A larger TTL value will make it slower for synchronization and update of DNS records.
- Value: Change it to the CNAME record copied in 7.a.
- Keep other settings unchanged.
- Click OK.
Step 3: Configure a CC Attack Protection Rule
Configuration example: You can configure such a CC rule to mitigate CC attacks. If an IP address accessed any path under the current domain name more than 1000 times within 30 seconds, this rule will block requests from the IP address for 10 hours. This rule can be used as a preventive configuration for common small and medium-sized websites
- In the navigation pane on the left, choose Policies.
- Click the name of the target policy to go to the protection configuration page.
- In the CC Attack Protection area, enable it.
: enabled
: disabled
- In the upper left corner of the CC Attack Protection rule list, click Add Rule. In the dialog box displayed, configure the CC attack protection rule by referring to Figure 3.
In this example, only some parameters are described. Retain the default values for other parameters. Table 4 describes some parameters.
Table 4 Mandatory parameters Parameter
Example Value
Description
Rate Limit Mode
- Source: 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, WAF 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 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.
- Destination: If this parameter is selected, the following rate limit types are available:
- By rule: If this rule is used by multiple domain names, requests for all these domain names are counted for this rule no matter what IP addresses these requests originate from. If you have added a wildcard domain name to WAF, requests for all domain names matched the wildcard domain name are counted for triggering this rule no matter what IP addresses these requests originate from.
- By domain name: Requests for each domain name are counted separately. If the number exceeds the threshold you configure, the protective action is triggered no matter what IP addresses these requests originate from.
- By URL: Requests for each URL are counted separately. If the number exceeds the threshold you configure, the protective action is triggered no matter what IP addresses these requests originate from.
Trigger
- Field: Path
- Logic: Prefix is
- Content: /login.php
Click Add Conditions and 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 when all conditions are met.
- Field
- Subfield: Configure this field only when IPv4, IPv6, Cookie, Header, or Params is selected for Field.
NOTICE:
A subfield cannot exceed 2,048 bytes.
- Logic: Select the desired logical relationship from the drop-down list.
- Content: Enter or select the content that matches the condition.
Rate Limit
1,000 requests within 30 seconds
All WAF instances
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.
All WAF instances: Requests to on one or more WAF instances will be counted together according to the rate limit mode you select. By default, requests to each WAF instance are counted. If you enable this, WAF will count requests to all your WAF instances for triggering this rule. To enable user-based rate limiting, Per user or Other (Referer must be configured) instead of Per IP address must be selected for Rate Limit Mode. This is because IP address-based rate limiting cannot limit the access rate of a specific user. However, in user-based rate limiting, requests may be forwarded to one or more WAF instances. Therefore, All WAF instances must be enabled for triggering the rule precisely.
Protective Action
Block
The action that WAF will take if the number of requests exceeds Rate Limit you configured. You can select:
- Verification code: WAF allows requests that trigger the rule as long as your website visitors complete the required verification.
- Block: WAF blocks requests that trigger 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 the rule.
- JS Challenge: WAF returns a piece of JavaScript code that can be automatically executed by a normal browser to the client. If the client properly executes the JavaScript code, WAF allows all requests from the client within a period of time (30 minutes by default). During this period, no verification is required. If the client fails to execute the code, WAF blocks the requests.
Block Duration
36,000 seconds
Period of time for which to block the item when you set Protective Action to Block.
- Source: 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, WAF limits traffic rate of the IP address (or user) in the way you configure.
- Confirm the configuration and click Confirm.
Related Information
- For more details, see Configuring a CC Attack Protection Rule.
- The Cloud Mode - Load Balancer access mode is recommended for large enterprise websites that are deployed on Huawei Cloud, have high service stability requirements, and are accessible over domain names or IP addresses. For details, see the following procedure:
- Buy a standard edition cloud WAF instance.
After the purchase is complete, submit a service ticket to enable WAF cloud mode load balancer access mode.
- Connect your website to WAF (Cloud Mode - Load Balancer Access).
- Configure a CC attack protection rule to block heavy-traffic attacks.
- Buy a standard edition cloud WAF instance.
- Dedicated Mode is recommended for large websites that are deployed on Huawei Cloud, have special security requirements, and are accessible over domain names or IP addresses. For details, see the following procedure:
- Dedicated WAF instances are not available in some regions. For details, see Notice on Web Application Firewall (Dedicated Mode) Discontinued. If you have purchased a dedicated WAF instance, skip this step.
- Connect your website to WAF (dedicated mode).
- Configure a CC attack protection rule to block heavy-traffic attacks.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot