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. |
|
Purchase 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
WAF provides the cloud mode and dedicated mode instances. For details about the differences between the two modes, see Edition Differences.
- 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
EU-Dublin
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 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.
- Server Port: service port over which the WAF instance forwards client requests to the origin server.
Proxy Your Website Uses
No proxy
- Layer-7 proxy: Web proxy products for layer-7 request forwarding are used, products such as anti-DDoS, CDN, and other cloud acceleration services.
- Layer-4 proxy: Web proxy products for layer-4 forwarding are used, products such as anti-DDoS.
- No proxy: No proxy products are deployed in front of WAF.
In our example, no proxies are used.
- 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. <br/>· 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 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
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.
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.
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.
- 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:
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.