Help Center> Web Application Firewall> FAQs> Service Interruption Check> How Do I Whitelist IP Address Ranges of Cloud WAF?
Updated on 2024-02-01 GMT+08:00

How Do I Whitelist IP Address Ranges of Cloud WAF?

In cloud CNAME access mode, to let WAF take effect, configure ACL rules on the origin server to trust only the back-to-source IP addresses of all your cloud WAF instances. This prevents hackers from attacking the origin server through the server IP addresses.

ACL rules must be configured on the origin server to whitelist WAF back-to-source IP addresses. Otherwise, your website visitors will frequently receive 502 or 504 error code when your website is connected to WAF.

What Are Back-to-Source IP Addresses?

From the perspective of a server, all web requests originate from WAF. The IP addresses used by WAF forwarding are back-to-source IP addresses of WAF. The real client IP address is written into the X-Forwarded-For (XFF) HTTP header field.

  • There will be more WAF IP addresses due to scale-out or new clusters. For your legacy domain names, WAF IP addresses usually fall into several class C IP addresses (192.0.0.0 to 223.255.255.255) of two to four clusters.
  • Generally, these IP addresses do not change unless clusters in use are changed due to DR switchovers or other scheduling switchovers. Even when WAF cluster is switched over on the WAF background, WAF will check the security group configuration on the origin server to prevent service interruptions.
Figure 1 Back-to-source IP address

WAF Back-to-Source IP Address Check Mechanism

A back-to-source IP address, or WAF IP address, is randomly allocated from the back-to-source IP address range. When WAF forwards requests to the origin server, WAF will check the IP address status. If the IP address is abnormal, WAF will remove it and randomly allocate a normal one to receive or send requests.

Why Do I Need to Whitelist the WAF IP Address Ranges?

All web requests originate from a limited quantity of WAF IP addresses. The security software on the origin server may most likely regard these IP addresses as malicious and block them. Once WAF IP addresses are blocked, the website may fail to be accessed or it opens extremely slowly. To fix this, add the WAF IP addresses to the whitelist of the security software.

After you connect your website to WAF, uninstall other security software from the origin server or allow only the requests from WAF to access your origin server. This ensures normal access and protects the origin server from hacking.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner of the management console and select a region or project.
  3. Click in the upper left corner and choose Web Application Firewall under Security & Compliance.
  4. In the navigation pane, choose Website Settings.
  5. Above the website list, click WAF Back-to-Source IP Addresses.

    Figure 2 WAF Back-to-Source IP Addresses

  6. In the displayed dialog box, click Copy to copy all the addresses.
  7. Open the security software on the origin server and add the copied IP addresses to the whitelist.

    • If your origin servers are deployed on the Huawei Cloud ECSs, see Whitelisting WAF IP Addresses on Origin Servers That Are Deployed on Huawei Cloud ECSs.
    • If your origin servers use Huawei Cloud ELB, see Whitelisting WAF IP Addresses on Origin Servers That Use Huawei Cloud ELB.
    • If you also use Cloud Firewall (CFW) on Huawei Cloud, refer to Adding a Protection Rule.
    • If your website is deployed on servers on other cloud vendors, whitelist the WAF IP addresses in the corresponding security group and access control rules.
    • If only the personal antivirus software is installed on the origin server, the software does not have the interface for whitelisting IP addresses. If the origin server provides external web services, install the enterprise security software on or use Huawei Cloud Host Security Service (HSS) for the server. These products identify the sockets of some IP addresses with a large number of requests and occasionally disconnect the connections. Generally, the IP addresses of WAF are not blocked.

Whitelisting WAF IP Addresses on Origin Servers That Are Deployed on Huawei Cloud ECSs

If your origin server is deployed on a Huawei Cloud ECS, perform the following steps to configure a security group rule to allow only the WAF back-to-source IP addresses to access the origin server.

  1. Log in to the management console.
  2. Click in the upper left corner of the management console and select a region or project.
  3. Click in the upper left corner of the page and choose Compute > Elastic Cloud Server.
  4. Locate the row containing the ECS hosting your website. In the Name/ID column, click the ECS name to go to the ECS details page.
  5. Click the Security Groups tab. Then, click Change Security Group.
  6. Click the security group name to view the details.
  7. Click the Inbound Rules tab and click Add Rule. Then, specify parameters in the Add Inbound Rule dialog box. For details, see Table 1. Figure 3 shows an example.

    Figure 3 Add Inbound Rule
    Table 1 Inbound rule parameters

    Parameter

    Description

    Protocol & Port

    Protocol and port for which the security group rule takes effect. If you select TCP (Custom ports), enter the origin server port number in the text box below the TCP box.

    Source

    Add all WAF back-to-source IP addresses copied in Step 6 one by one.

    NOTE:

    One inbound rule can contain only one IP address. To configure an inbound rule for each IP address, click Add Rule to add more rules. A maximum of 10 rules can be configured.

  8. Click OK.

    Then, the security group rules allow all inbound traffic from the WAF back-to-source IP addresses.

Whitelisting WAF IP Addresses on Origin Servers That Use Huawei Cloud ELB

If your origin server is deployed on backend servers of a Huawei Cloud ELB load balancer, perform the following steps to configure an access control list to allow only the WAF back-to-source IP addresses to access the origin server.

  1. Log in to the management console.
  2. Click in the upper left corner of the management console and select a region or project.
  3. Click in the upper left corner of the page and choose Networking > Elastic Load Balance.
  4. Locate the load balancer you want. In the Listener column, click the listener name to go to the details page.
  5. In the Access Control row of the target listener, click Configure.

    Figure 4 Listener list

  6. In the displayed dialog box, select Whitelist for Access Control.

    1. Click Create IP Address Group and add the dedicated WAF instance IP addresses obtained in Step 6 to the group being created.
    2. Select the IP address group created in 6.a from the IP Address Group drop-down list.

  7. Click OK.

Service Interruption Check FAQs

more