Help Center> Anti-DDoS Service> User Guide> Advanced Anti-DDoS User Guide> Connecting a Website Service to AAD

Connecting a Website Service to AAD

Scenarios

You can use the Canonical Name (CNAME)-based access to connect your website service to AAD so that access traffic will be directed to the high-defense IP address. A CNAME record is a type of DNS record that maps an alias name to a true or canonical domain name.

Each AAD instance can protect a maximum of 50 domain names. Domain names that need to be protected cannot be added in batches.

Prerequisites

  • You have obtained the username and password for logging in to the management console.
  • You have purchased an AAD instance.

Procedure

Figure 1 shows the procedure for accessing website services.

Figure 1 Procedure for accessing website services
  1. Log in to the management console.
  2. Follow the procedure shown in the following figure to enter the Domain Name Access page.

    Figure 2 Domain Name Access page

  3. On the displayed page, click Add Domain Name.
  4. Configure domain name access.

    1. Set required parameters on the displayed page. Table 1 describes the parameters. Click Next after the parameters are all configured.
      Figure 3 Entering domain name information for a website service

      If you log in to the management console using an enterprise project account, you can choose Enterprise > Project Management in the upper right corner. On the displayed page, choose Project Management in the navigation pane on the left, and select the target project.

      Table 1 Parameter description

      Parameter

      Description

      Example Value

      Protected Domain Name

      Enter the domain name of the service to protect.

      • Single domain name: Enter a single domain name, for example, www.example.com.
      • Wildcard domain name
        • If the server IP address of each subdomain name is the same, enter a wildcard domain name. For example, if the subdomain names a.example.com, b.example.com, and c.example.com have the same server IP address, you can directly add the wildcard domain name *.example.com to AAD for protection.
        • If the server IP addresses of subdomain names are different, add subdomain names one by one.

      Single domain name: www.example.com

      Wildcard domain name: *.example.com

      Service Type

      Select Website.

      Website

      Protocol/Port

      Select a port based on your needs.
      • Available HTTP/WebSocket ports are 80, 81, 82, 83, 84, 8006, 8078, 8080, 8081, 8087, 8097, 19101, 19501, 21028, 40009, and 40010.
      • Available HTTPS/WebSocket ports are 443, 4006, 4443, 5443, 6443, 7443, 8443, 9443, 14443, 20000, 28443, 30001, 30002, 30003, 30004, and 30005.
      NOTE:

      In one line, website services and non-network services cannot use the same port number.

      80

      Origin Server Type

      Origin server type of the protected domain name to be added. The value of this parameter can be:

      • IP address

        IP address of a real server. A maximum of 20 IP addresses can be entered. Use commas (,) to separate the IP addresses.

      • Domain name

        Currently, only HUAWEI CLOUD WAF CNAME is supported.

      NOTICE:
      • If the protected domain name to be added shares the high-defense IP address and protocol or port with a domain name, the values of Origin Server Type for the domain names must be same.
        • If Origin Server Type is set to IP address for a domain name, ensure the web protection is enabled for the domain name. For details about how to enable the web protection, see 4.g.
        • If Origin Server Type is set to Domain name for a domain name, ensure that the domain name and the protected domain name to be added are connected to the same WAF.
      • If Origin Server Type is set to Domain name, ensure that the domain name has been allowed to use a proxy. Otherwise, the service may be unavailable after being connected to AAD.
      • If you connect your service to AAD using a WAF CNAME but no longer need WAF protection, delete the service domain name from AAD first.

      IP address

    2. (Optional) Upload a certificate.

      If you have selected HTTPS/WebSockets and set Origin Server Type to IP address, perform the following steps to upload or update a certificate:

      You can select an existing certificate from the drop-down list or upload a certificate. To upload a certificate, perform the following steps:

      1. Click Upload Certificate.
      2. In the displayed Upload Certificate dialog box, enter the domain name, certificate content, and private key. Table 2 describes the required parameters.

        The certificate name contains a maximum of 10 characters and cannot contain special characters.

        Figure 4 Uploading a certificate
        • Currently, only TLS 1.0, TLS 1.1, and TLS 1.2 certificates can be uploaded.
        • You can select an existing certificate.
        • Each certificate name of a user must be unique.
        • You can select an existing certificate through fuzzy search.
        Table 2 Parameter description

        Parameter

        Description

        Certificate

        • The certificate must be in the following format:
          -----BEGIN CERTIFICATE-----
          MIIDljCCAv+gAwIBAgIJAMD2jG2tYGQ6MA0GCSqGSIb3DQEBBQUAMIGPMQswCQYD
          VQQGEwJDSDELMAkGA1UECBMCWkoxCzAJBgNVBAcTAkhaMQ8wDQYDVQQKEwZodWF3
          ZWkxDzANBgNVBAsTBmh1YXdlaTEPMA0GA1UEAxMGaHVhd2VpMQ8wDQYDVQQpEwZz
          ZXJ2ZXIxIjAgBgkqhkiG9w0BCQEWE3p3YW5nd2VpZGtkQDE2My5jb20wHhcNMTUw
          MzE4MDMzNjU5WhcNMjUwMzE1MDMzNjU5WjCBjzELMAkGA1UEBhMCQ0gxCzAJBgNV
          BAgTAlpKMQswCQYDVQQHEwJIWjEPMA0GA1UEChMGaHVhda2VpMQ8wDQY......
          -----END CERTIFICATE-----
        • Method for you to copy your certificate:
          • For a .pem certificate: Use a text editor to open the certificate file and copy the content here.
          • For other certificates: Convert your certificate to a .pem one. Then open it with a text editor and copy its content.
            NOTE:

            For details about how to convert a certificate, see How Do I Convert a Non-PEM Certificate into a PEM One?.

        Private Key

        The private key must be in the following format:

        -----BEGIN RSA PRIVATE KEY-----
        MIIDljCCAv+gAwIBAgIJAMD2jG2tYGQ6MA0GCSqGSIb3DQEBBQUAMIGPMQswCQYDVQQG
        EwJDSDELMAkGA1UECBMCWkoxCzAJBgNVBAcTAkhaMQ8wDQYDVQQKEwZodWF3ZWkxDzAN
        BgNVBAsTBmh1YXdlaTEPMA0GA1UEAxMGaHVhd2VpMQ8wDQYDVQQpEwZzZXJ2ZXIxIjAg
        BgkqhkiG9w0BCQEWE3poYW5nd2VpZGtkQDE2My5jb20wHhcNMTUwMzE4MDMzNjU5WhcN
        MjUwMzE1MDMzNjU5WjCBjzELMAkGA1UEBhMCQ0gxCzAJBgNVBAgTAlpKMQswCQYDVQQH
        EwJIWjEPMA0GA1UEChMGaHVhd2VpMQ8wDQYDVQQLEwZ
        -----END RSA PRIVATE KEY-----
        • Method for you to copy your private key:
          • For a .pem file: Use a text editor to open the private key file and copy the content here.
          • For other certificates: Convert your certificate to a .pem one. Then open it with a text editor and copy its content.
            NOTE:

            For details about how to convert a certificate, see How Do I Convert a Non-PEM Certificate into a PEM One?.

      3. Click OK.
    3. Select required AAD instances and lines and click Submit and Continue.
      Figure 5 Select Instance and Line
      • You can select multiple lines (with high-defense IP addresses) for a domain name. However, the IP addresses must have the same number of forwarding rules, the same forwarding protocols, ports, and the same service type.
      • HUAWEI CLOUD provides multiple carrier lines for each instance to avoid cross-carrier access from your users. You are advised to select a complete set of lines, which includes all carriers, when selecting lines for your instance.
    4. Copy the displayed CNAME record of the domain name and add the CNAME to DNS. Then click Next.
      Figure 6 Modifying DNS

      For details about modifying DNS configuration, see Adding a CNAME Record.

    5. Add the back-to-origin IP addresses to the firewall whitelist.
      Figure 7 Adding the back-to-origin IP addresses to the firewall whitelist
      • If no firewall has been configured for the origin server, click Finish.
      • If a firewall has been configured for the origin server, whitelist the back-to-origin IP addresses on the firewall, ACL, or any other security software of your origin servers to prevent the access traffic from being blocked or limited by the security policies. Click Finish.

      The Domain Name Access page is displayed. The newly added domain name is displayed in the list.

      AAD executes Full Network Address Translation (Full-NAT) and diverts access traffic to the back-to-origin IP addresses.
      • If AAD is not used, access traffic is sent directly from the source IP addresses of clients towards origin servers. From the view of origin servers, the requests originate from scattered clients and each source IP address sends only a few access requests.
      • After AAD is enabled, access traffic will be forwarded to the back-to-origin IP addresses. From the view of origin servers, the requests originate from these back-to-origin IP addresses. These IP addresses are fixed and limited in quantity, and each carries more requests than the source IP address. Therefore, they may be mistakenly regarded as the sources that launch attacks. In this case, other Anti-DDoS security policies working on the origin servers may block or limit the requests from the back-to-origin IP addresses. For example, error 502 is reported if the access request is blocked by mistake.
    6. (Optional) Enable CNAME-based auto scheduling.

      CNAME-based auto schedule distributes incoming traffic based on its originating carrier. It can divert traffic to other lines if a line is blocked by a black hole.

      Figure 8 Enabling CNAME-based automatic scheduling
    7. (Optional) If you set Origin Server Type to IP address, locate the row containing the target domain name and enable Basic Web Protection in the Security Protection column, as shown in Figure 9.
      AAD provides you with layer-7 protection only after you enable basic web protection.
      Figure 9 Enabling basic web protection

  1. Verify the configuration.

    After the configuration takes effect, AAD is expected to forward the packets sent to the high-defense IP address or AAD CNAME to the origin servers. To ensure service stability, you can use the following steps to verify the configuration:

    • Assumed CNAME:
      • CNAME: 5dc728e1769ad666.huaweisafedns.com
    • Procedure:
      1. Use Telnet www.huaweicloud.com 80 to verify the network connectivity.
        • If the connection setup is successful, you can Telnet to the public IP address from your local network environment.
        • If the connection setup fails, change your test network environment and try again. Some enterprises may have internal network constraints and fail the verification. For example, you can connect to the personal hotspot of your phone to verify the connectivity.
      2. After verifying the network connectivity, you can Telnet to the AAD CNAME over port 80.
        • If the Telnet command is executed successfully, the configuration has taken effect.
        • If the command execution fails, check whether the required steps have been completed.
        • If the fault persists, contact technical support.

  1. Modify DNS.

    For details, see Adding a CNAME Record.

    The DNS configuration takes effect after a period of time. In this period, you can test the domain name resolution using some online test tools such as 17ce and China Webmaster.

Follow-up Procedure

  • If you do not want a domain name to be resolved to a high-defense IP address, locate the row containing the domain name on the Domain Name Access page and click View details in the Instance and Line column. On the page that is displayed, click for the target high-defense IP address to set DNS Resolution to .
  • If you do not want to protect a domain name, locate the row containing the domain name on the Domain Name Access page and click Delete in the Operation column.