Help Center/ Elastic Load Balance/ Best Practices/ Basic Functions/ Using a Dedicated Load Balancer for TLS Offloading (Mutual Authentication)
Updated on 2025-08-28 GMT+08:00

Using a Dedicated Load Balancer for TLS Offloading (Mutual Authentication)

Scenarios

If your Layer 4 services have strict security requirements, you can configure mutual authentication for TLS listeners to allow clients and servers to authenticate each other to improve service security.

Prerequisites

  • There is a TLS backend server group with two ECSs (ECS01 and ECS02) running in it. Each ECS hosts an application.

Procedure

Figure 1 Procedure for configuring mutual authentication for TLS offloading

Step 1: Upload the Server Certificate to the ELB Console

Before adding a TLS listener to a load balancer, you need to upload your server certificate to the ELB console.

  1. Go to the load balancer list page.
  2. In the navigation pane on the left, choose Certificates.
  3. Click Add Certificate on the top right corner and set parameters by referring to Table 1.
    Table 1 Server certificate parameters

    Parameter

    Description

    Certificate Type

    Specifies the certificate type. Select Server certificate.

    Source

    Specifies the source of a certificate. There are two options: SSL Certificate Manager and Your certificate.

    SSL Certificate Manager is used in this example, so that you can select the SSL certificates you have purchased on the CCM console.

    Certificate

    Specifies the certificate that you want to upload to the ELB console.

    Enterprise Project

    Specifies an enterprise project by which cloud resources and members are centrally managed.

    SNI Domain Name (Optional)

    All domain names of the SSL certificate will be automatically selected.

    If the certificate is intended for SNI, you can select an SNI certificate based on the domain name in the HTTPS requests.

    Description (Optional)

    Provides supplementary information about the certificate.

  4. Click OK.

Step 2: Upload the CA Certificate to the ELB Console

Before adding a TLS listener to a load balancer, you need to upload your CA certificate to the ELB console.

  1. Go to the load balancer list page.
  2. In the navigation pane on the left, choose Certificates.
  3. Click Add Certificate on the top right corner and set parameters by referring to Table 2.
    Table 2 CA certificate parameters

    Parameter

    Description

    Certificate Type

    Specifies the certificate type. Select CA certificate.

    Certificate Name

    Specifies the name of the CA certificate.

    Enterprise Project

    Specifies an enterprise project by which cloud resources and members are centrally managed.

    Certificate Content

    Specifies the content of the CA certificate in PEM format.

    Click Upload and select the CA certificate to be uploaded. Ensure that your browser is the latest version.

    The format of the certificate body is as follows:

    -----BEGIN CERTIFICATE-----
    Base64–encoded certificate
    -----END CERTIFICATE-----

    Description (Optional)

    Provides supplementary information about the certificate.

  4. Click OK.

Step 3: Add a TLS Listener and Configure Mutual Authentication

  1. Go to the load balancer list page.
  2. Locate the target load balancer and click Add Listener in the Operation column.
  3. On the Add Listener page, select TLS for Frontend Protocol and Mutual authentication for SSL Authentication.

    Select the server certificate uploaded to the ELB console in Step 1.

    Select the CA certificate uploaded to the ELB console in Step 2.

    Figure 2 Configuring mutual authentication
  4. Click Next: Configure Request Routing Policy and select Use existing for Backend Server Group. Select an existing backend server group and click Next: Confirm.
  5. Confirm the configurations and click Submit.

Step 4: Configure Domain Name Resolution

You can add an A record set to resolve the domain name to the public IP address of the load balancer so that clients can access the load balancer using the public domain name.

For details about how to configure A record sets, see Routing Internet Traffic to a Website.

  1. Go to the DNS console.
  2. In the navigation pane on the left, choose Public Zones.

    The zone list is displayed.

  3. Locate the public zone and click Manage Record Sets in the Operation column.
  4. Click Add Record Set.
  5. Configure the parameters based on Table 3.
    Table 3 Parameters for adding an A record set

    Parameter

    Example Value

    Description

    Type

    A – Map domains to IPv4 addresses

    Type of the record set. In this example, set it to A - Map domains to IPv4 addresses.

    Name

    www

    Prefix of the domain name to be resolved.

    Line

    Default

    Resolution line. The DNS server will return the IP address of the specified line, depending on where end users come from.

    The default value is Default.

    Default: returns the default resolution result irrespective of where the visitors come from.

    TTL (s)

    300

    Cache duration of the record set on a local DNS server, in seconds.

    In this example, the default value 300 is used.

    Value

    192.168.12.2

    192.168.12.3

    IPv4 addresses mapped to the domain name. In this example, set this parameter to the EIPs bound to the load balancer.

    Advanced Settings (Optional)

    -

    Click to expand the advanced settings, set the alias and weight of the record set, and add a description and tags. In this example, the default settings are used.

  6. Click OK.
  7. Switch back to the Record Sets tab.

    The added record set is in the Normal state.

Step 5: Verify TLS Mutual Authentication

The following describes how you can verify TLS mutual authentication.

  1. Enter the domain name of the load balancer in the address box of the browser, for example, https://www.elbtest.com. In the displayed dialog box, select a certificate to authenticate yourself and click OK.
    Figure 3 Selecting a certificate to authenticate yourself
  2. Open the website in the incognito mode for accurate testing, because browser cache can cause clients to reuse existing TLS sessions. Refresh the page multiple times and you will see that requests are distributed across the two ECSs.
    Figure 4 Requests forwarded to ECS01
    Figure 5 Requests forwarded to ECS02

Log in to the Linux client and run the following command to verify the mutual authentication:

curl -k --cert /root/client.crt --key /root/client.key https://www.elbtest.com

--cert /root/client.crt defines where the client certificate file is stored, and --key /root/client.key indicates where the private key of the client certificate is stored.

If the following information is displayed, the client and servers have authenticated each other, allowing requests to reach the two ECSs.

Figure 6 Verifying mutual authentication (Linux)

Reference