Step 4: Whitelist Back-to-Source IP Addresses of Dedicated WAF Instances
To let your dedicated WAF instances take effect, configure ACL rules on the origin server to trust only the back-to-source IP addresses of all your dedicated 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, or your website visitors will frequently receive 502 or 504 error code after your website is connected to a dedicated WAF instance.
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 back-to-source IP address of the dedicated instance to access the origin server.
- In the navigation pane on the left, choose Instance Management > Dedicated Engine to go to the dedicated WAF instance page.
- In the IP Address column, obtain the IP address of each dedicated WAF instance under your account.
- Click
in the upper left corner of the page and choose Compute > Elastic Cloud Server. - 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.
- Select the Security Groups tab. Then, click Change Security Group.
- In the Change Security Group dialog box displayed, select a security group or create a security group.
- Click the security group name to view the details.
- Select the Inbound Rules tab and click Add Rule. Then, specify parameters in the Add Inbound Rule dialog box.
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
Subnet IP address of each dedicated WAF instance you obtain in 2. Configure an inbound rule for each IP address.
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. You can add up to 10 rules.
- Click OK.
Now, the security group allows all inbound traffic from the back-to-source IP addresses of all your dedicated WAF instances.
To check whether the configuration takes effect, use the Telnet tool to check whether a connection to the origin server service port bound to the IP address protected by WAF is established.
For example, run the following command to check whether the connection to the origin server service port 443 bound to the IP address protected by WAF is established. If the connection cannot be established over the service port but the website is still accessible, the security group inbound rules take effect.
Telnet Origin server IP address 443
If your origin server uses Huawei Cloud ELB to distribute traffic, perform the following steps to configure an access control policy to allow only the IP addresses of the dedicated WAF instances to access the origin server:
- In the navigation pane on the left, choose Instance Management > Dedicated Engine to go to the dedicated WAF instance page.
- In the IP Address column, obtain the IP address of each dedicated WAF instance under your account.
- Click
in the upper left corner of the page and choose Networking > Elastic Load Balance. - Locate the row containing the load balancer configured for your dedicated WAF instance and click the load balancer name in the Name column.
- In the Access Control row of the target listener, click Configure. Figure 1 Listener list
- In the displayed dialog box, select Whitelist for Access Control.
- Click OK.
Now, the access control policy allows all inbound traffic from the back-to-source IP addresses of your dedicated WAF instances.
To check whether the configuration takes effect, use the Telnet tool to check whether a connection to the origin server service port bound to the IP address protected by WAF is established.
For example, run the following command to check whether the connection to the origin server service port 443 bound to the IP address protected by WAF is established. If the connection cannot be established over the service port but the website is still accessible, the security group inbound rules take effect.
Telnet Origin server IP address 443
What is your overall rating for this page?
Thank 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