Help Center> Web Application Firewall> Best Practices> Combining AAD and WAF to Get All-Round Protection

Combining AAD and WAF to Get All-Round Protection

How the Combination Works

  • Advanced Anti-DDoS (AAD) works as a proxy and uses AAD IP address to forward requests to origin servers. All public network traffic is diverted to the AAD IP address so that the origin server is hidden from the public. This protects origin servers from DDoS attacks.

    Objects supported by AAD: domain names of web applications on HUAWEI CLOUD, other cloud platforms, or on-premises data centers

  • Web Application Firewall (WAF) keeps web services stable and secure. It examines all HTTP and HTTPS requests to detect and block the following attacks: Structured Query Language (SQL) injection, cross-site scripting (XSS), web shells, command and code injections, file inclusion, sensitive file access, third-party vulnerability exploits, Challenge Collapsar (CC) attacks, malicious crawlers, and cross-site request forgery (CSRF).
    WAF offers the cloud, dedicated, and ELB mode to protect websites. You can add either domain names or IP addresses to WAF. Before you start, get familiar with the following differences:
    • Cloud mode: protects your web applications on HUAWEI CLOUD, other cloud platforms, or on-premises data centers through domain names.
    • Dedicated or ELB mode: protects your web applications on HUAWEI CLOUD through domain names or IP addresses.

You can deploy both AAD and WAF to protect your websites hosted on HUAWEI CLOUD, other clouds, or in on-promises data centers. The combination of AAD and WAF can protect your website against DDoS attacks (such as NTP flood, SYN flood, ACK flood, ICMP flood, and HTTP Get flood attacks), web application attacks (such as SQL injection, cross-site scripting, web shells, command/code injection, file inclusion, sensitive file access, third-party application vulnerability attacks, CC attacks, malicious crawler scanning, and cross-site request forgery). Figure 1 shows the configuration.

Figure 1 WAF configuration when a proxy is used

If you configure AAD and WAF for your website, website traffic goes to AAD first. AAD scrubs incoming traffic and forwards clean traffic to WAF. WAF blocks attacks and forwards only the normal traffic to the origin server. In this way, two layers of protection are implemented on your website.

The configurations are as follows:

  • Cloud mode

    Resolve the website domain name to AAD and change the AAD back-to-source IP address to WAF CNAME record. To prevent others from configuring your domain names on WAF in advance (this will cause interference on your domain name protection), add the subdomain name and TXT record on your DNS management platform.

  • Dedicated mode

    Point the website domain name to AAD and change the AAD back-to-source IP address to the EIP bound to the load balancer configured for your dedicated WAF instance.

  • ELB mode

    Resolve the website domain name to AAD and change the AAD back-to-source IP address to the EIP bound to the load balancer configured for the dedicated WAF instance.

Prerequisites

You have purchased an AAD instance, connected your website service to the instance, and completed the configurations shown in Table 1.

Table 1 Configurations required in different WAF modes

Deployment Mode

Description

Cloud mode

  1. You have purchased a cloud WAF instance.
  2. You have added the website domain name to your cloud WAF instance and configured other details, including origin server IP address and port.
  3. You have obtained the permissions from the DNS service provider to add domain names.
  4. (Optional) You have whitelisted WAF back-to-source IP addresses. If non-HUAWEI CLOUD security software is used on the origin server, whitelist the WAF back-to-source IP addresses to prevent normal traffic from being blocked. For details, see Configuring an Access Control Policy on an ECS or ELB to Protect Origin Servers.
NOTICE:

To ensure that the WAF policy takes effect for the real source IP address, ensure that Yes is selected for Proxy Configured when you add the domain name to WAF. For details, see Viewing Basic Information

Dedicated mode

  1. You have purchased a dedicated WAF instance.
  2. You have added website domain name to your dedicated WAF instance and configured other details, including origin server IP address and port.
  3. You have configured a load balancer for the dedicated WAF instance.
  4. You have bound an EIP to the load balancer.
  5. You have whitelisted back-to-source IP addresses of dedicated WAF instances.

ELB mode

  1. You have purchased a load-balancing WAF instance.
  2. You have added the domain name to the load-balancing WAF instance.
  3. You have bound a load balancer to the load-balancing WAF instance.
  4. You have whitelisted back-to-source IP addresses of the load-balancing WAF instance.

Cloud WAF Configuration

The methods to configure the DNS server are similar. The following uses HUAWEI CLOUD AAD as an example.

  1. Obtain settings of CNAME, Subdomain Name, and TXT Record.

    1. Log in to the management console.
    2. Go to the Website Settings page by following the steps shown in Figure 2.
      Figure 2 Accessing to the Website Settings page
    3. In the Protected Website column, click the domain name you want to go to the Basic Information page.
    4. On the page for configuring basic domain information, click in the row where the CNAME is located to copy CNAME. In the row of Access Status, click How to Access. In the Access Guide dialog box, copy Subdomain Name and TXT Record.
      Figure 3 Domain name access information

  2. Change the AAD back-to-source IP address.

    1. Click at the top of the page and choose Security & Compliance > DDoS Mitigation. In the navigation pane on the left, choose Advanced Anti-DDoS > Domain Name Access to go to the domain name configuration page.
    2. In the Operation column of the target domain name, click Edit. On the displayed page, set Origin Server IP Address/Domain Name to the copied WAF CNAME record. Figure 4 shows an example.
      Figure 4 Domain configuration
    3. Click OK.

  3. (Optional) Add a WAF subdomain name and TXT record at your DNS provider.

    To prevent others from configuring your domain names on WAF in advance (this will cause interference on your domain name protection), this step is recommended.

    1. Access the DNS resolution page, as shown in Figure 5.
      Figure 5 DNS page
    2. In the upper right corner of the page, click Add Record Set. The Add Record Set page is displayed. Figure 6 shows an example.
      • Name: TXT record copied in 1.d.
      • Type: Select TXT – Specify text records.
      • Alias: Select No.
      • 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: Add quotation marks to the TXT record copied in 1.d and paste them in the text box, for example, TXT record.
      • Keep other settings unchanged.
      Figure 6 Adding a record set
    3. Click OK.

  4. (Optional) Ping the IP address of your domain name to check whether the new DNS settings take effect.

    It takes some time for the new DNS settings to take effect. If ping fails, wait for 5 minutes and ping again.

Dedicated/ELB WAF Configuration

Perform the following steps to complete configurations on HUAWEI CLOUD AAD:

  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 Security & Compliance > DDoS Mitigation.
  4. In the navigation pane on the left, choose Advanced Anti-DDoS > Domain Name Access to go to the Domain Name Access page.
  5. In the row containing the domain name you want, click Modify in the Operation column.
  6. In the Modify Domain Name dialog box, change the origin server IP address. Figure 7 shows an example.

    Figure 7 Changing the origin server IP address

  7. Click OK.

Verification

If Access Status is Accessible, the traffic destined for your website domain name or IP address is routed to WAF.

If WAF detects 20 access requests to a website within 5 minutes, WAF considers that the website has been successfully connected to WAF.

If a domain name fails to be connected to WAF, its access status is Inaccessible. To fix this issue, see Why Is the Access Status of a Domain Name or IP Address Inaccessible?