Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Web Application Firewall/ Getting Started/ Blocking Heavy-Traffic CC Attacks Through CC Attack Protection Rules

Blocking Heavy-Traffic CC Attacks Through CC Attack Protection Rules

Updated on 2025-02-19 GMT+08:00

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

Preparations

Sign up for a HUAWEI ID, enable Huawei Cloud services, top up your account, and assign WAF permissions to the account.

Step 1: Buy WAF

Buy WAF and select the region and WAF mode.

Step 2: Add a Website to WAF

Add the website you want to protect to WAF for traffic inspection and forwarding.

Step 3: Configure a CC Attack Protection Rule

Configure and enable CC attack protection rules to mitigate CC attacks against the protected website.

Preparations

  1. 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.

  2. Make sure that your account has sufficient balance, or you may fail to pay to your WAF orders.
  3. 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

  1. Log in to Huawei Cloud management console.
  2. On the management console page, choose Security & Compliance > Web Application Firewall.
  3. 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

    You can select the region nearest to your services WAF will protect.

    Edition

    Standard

    This edition is suitable for small and medium-sized websites.

  4. Confirm the product details and click Buy Now in the lower right corner of the page.
  5. Check the order details and read the WAF Disclaimer. Then, select the box and click Pay Now.
  6. On the payment page, select a payment method and pay for your order.

Step 2: Add a Website to WAF

  1. In the navigation pane on the left, choose Website Settings.
  2. In the upper left corner of the website list, click Add Website.
  3. Select Cloud - CNAME and click Configure Now.
  4. 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.

  5. Click Next. The basic information about the domain name is configured.
    Figure 2 Basic settings completed
  6. Complete steps Whitelist WAF Back-to-Source IP Addresses and Test WAF as prompted.
  7. 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.

    1. Copy the CNAME value provided by WAF in Figure 2.
    2. Click in the upper left corner of the page and choose Networking > Domain Name Service.
    3. In the navigation pane on the left, choose Public Zones.
    4. In the Operation column of the target domain name, click Manage Record Set. The Record Sets tab page is displayed.
    5. In the row containing the desired record set, click Modify in the Operation column.
    6. 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.
    7. 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

  1. In the navigation pane on the left, choose Policies.
  2. Click the name of the target policy to go to the protection configuration page.
  3. In the CC Attack Protection area, enable it.

    : enabled

    : disabled

  4. 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.
    Figure 3 Add CC Attack Protection Rule
    Table 4 Mandatory parameters

    Parameter

    Example Value

    Description

    Rate Limit Mode

    Source > Per IP address

    • 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.

  5. Confirm the configuration and click OK.

Related Information

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback