Blocking Malicious Traffic Through IP Address Blacklist or Whitelist Rules
By default, WAF allows access from all IP addresses. If you find that your website is accessed from malicious IP addresses, you can add a WAF blacklist or whitelist rule to block malicious IP addresses.
The following example shows you how to configure an IP address whitelist or blacklist rule. In this example, we use the WAF cloud CNAME access mode.
- Website access mode: Cloud mode - CNAME access
- Protected object: domain names
- Billing mode: Yearly/Monthly
- Edition: Standard
- Protection rule: blacklist and whitelist settings
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. |
|
Add blacklist and whitelist rules to block malicious IP addresses. |
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
You can use the load balancer access mode only after you purchase the standard, professional, or platinum edition cloud WAF. The following describes how to 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 below.
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
You can select the region nearest to your services WAF will protect.
Edition
Standard
This edition can protect 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 4: Configure an IP Address Blacklist or Whitelist Rule
- In the navigation pane on the left, choose Policies.
- Click the name of the target policy to go to the protection configuration page.
- Choose Blacklist and Whitelist and enable it.
- : enabled
- : disabled
- Above the blacklist and whitelist rule list, click Add Rule and configure a rule as shown in Figure 3.
- IP Address/Range/Group: Select IP address/range. To block multiple IP addresses, select Address group.
- IP Address/Range: Configure the IP addresses or IP address ranges you want to block, for example, 192.168.2.1.
- Protective Action: Select Block.
- Click Confirm.
Related Information
- For details, see Configuring IP Address Blacklist and Whitelist Rules to Block or Allow Specified IP Addresses.
- 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.