All Products
Search
Document Center

Alibaba Cloud Service Mesh:Enforce TLS versions on an ingress gateway

Last Updated:Mar 11, 2026

TLS 1.0 and TLS 1.1 have known vulnerabilities that expose HTTPS traffic to man-in-the-middle attacks and data breaches. By setting a minimum TLS version on your Alibaba Cloud Service Mesh (ASM) ingress gateway, you block insecure protocol negotiations so that all client-to-gateway traffic uses TLS 1.2 or later. You must also disable weak passwords in TLS 1.2.

How it works

The Istio Gateway resource exposes a minProtocolVersion field under the tls section of each server entry. When you set this field to TLSV1_2, the Envoy proxy on the ingress gateway rejects any TLS handshake that negotiates a version lower than TLS 1.2. You can optionally set maxProtocolVersion to pin a specific version.

ConfigurationminProtocolVersionmaxProtocolVersionResult
TLS 1.2 and later (recommended)TLSV1_2Not setAccepts TLS 1.2 and TLS 1.3
TLS 1.2 onlyTLSV1_2TLSV1_2Accepts TLS 1.2 only
TLS 1.3 onlyTLSV1_3TLSV1_3Accepts TLS 1.3 only

Prerequisites

Before you begin, make sure that you have:

Step 1: Prepare a TLS certificate and private key

Create a TLS certificate and private key for the ingress gateway, then store them as a credential that the gateway can reference. The following example uses the aliyun.com domain name.

If you already have a certificate and private key for aliyun.com, rename them to aliyun.com.crt and aliyun.com.key, then skip to substep 3.

  1. Generate a root certificate and private key:

    openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -subj '/O=myexample Inc./CN=aliyun.com' -keyout aliyun.root.key -out aliyun.root.crt
  2. Generate a server certificate and private key for aliyun.com:

    openssl req -out aliyun.com.csr -newkey rsa:2048 -nodes -keyout aliyun.com.key -subj "/CN=aliyun.com/O=myexample organization"
    openssl x509 -req -days 365 -CA aliyun.root.crt -CAkey aliyun.root.key -set_serial 0 -in aliyun.com.csr -out aliyun.com.crt
  3. Store the certificate. Choose the method that matches your ASM version:

    • ASM earlier than v1.17 -- Create a Kubernetes Secret by running the following kubectl command against the cluster where the ingress gateway pod runs:

      kubectl create -n istio-system secret tls myexample-credential --key=aliyun.com.key --cert=aliyun.com.crt
      Important

      The Secret name cannot start with istio or prometheus, and cannot contain the token field.

    • ASM v1.17 or later -- Use the ASM console:

      1. Log on to the ASM console. In the left-side navigation pane, choose Service Mesh > Mesh Management.

      2. On the Mesh Management page, click the name of the ASM instance. In the left-side navigation pane, choose ASM Gateways > Certificate Management.

      3. On the Certificate Management page, click Create. In the Certificate Information panel, configure the following parameters and click OK.

        Parameter

        Description

        Name

        Enter the certificate name. For this example, enter myexample-credential.

        Public Key Certificate

        Enter the content of the aliyun.com.crt file generated in substep 2.

        Private Key

        Enter the content of the aliyun.com.key file generated in substep 2.

Step 2: Create an Istio gateway with a minimum TLS version

  1. Log on to the ASM console. In the left-side navigation pane, choose Service Mesh > Mesh Management.

  2. On the Mesh Management page, click the name of the ASM instance. In the left-side navigation pane, choose ASM Gateways > Gateway. On the page that appears, click Create from YAML.

  3. Select a namespace and paste the following YAML. This example uses the default namespace and sets minProtocolVersion to TLSV1_2 to enforce TLS 1.2 as the minimum version:

    apiVersion: networking.istio.io/v1beta1
    kind: Gateway
    metadata:
      name: mysdsgateway
    spec:
      selector:
        istio: ingressgateway
      servers:
        - hosts:
            - '*'
          port:
            name: https
            number: 443
            protocol: HTTPS
          tls:
            credentialName: myexample-credential
            minProtocolVersion: TLSV1_2
            mode: SIMPLE

Step 3: Create a virtual service

  1. On the details page of the ASM instance, choose Traffic Management Center > VirtualService in the left-side navigation pane. On the page that appears, click Create from YAML.

  2. Select a namespace and paste the following YAML:

    apiVersion: networking.istio.io/v1beta1
    kind: VirtualService
    metadata:
      name: bookinfo-tlsversion-sample
    spec:
      gateways:
        - mysdsgateway-tlsversion-sample
      hosts:
        - '*'
      http:
        - match:
            - uri:
                exact: /productpage
            - uri:
                prefix: /static
            - uri:
                exact: /login
            - uri:
                exact: /logout
            - uri:
                prefix: /api/v1/products
          route:
            - destination:
                host: productpage
                port:
                  number: 9080

Step 4: Verify the TLS configuration

testssl.sh is a free command line tool that checks whether the service that a server provides over a port supports TLS/SSL certificates or protocols. It can also identify encryption defects. Use testssl.sh to verify your TLS version configuration.

  1. Run the following command to execute testssl.sh in a container:

    docker run --rm -ti registry.cn-hangzhou.aliyuncs.com/acs/testssl.sh https://IP address of the ingress gateway/productpage

    Expected protocol output for TLS 1.2 and later:

    Testing protocols via sockets except NPN+ALPN
    
    SSLv2      not offered (OK)
    SSLv3      not offered (OK)
    TLS 1      not offered
    TLS 1.1    not offered
    TLS 1.2    offered (OK)
    TLS 1.3    offered (OK): final

    not offered for TLS 1 and TLS 1.1 confirms that these versions are disabled. offered for TLS 1.2 and TLS 1.3 confirms that the gateway accepts both.

    The client simulation section shows connection results by client:

    Expand to view the expected output

    ......
    Running client simulations (HTTP) via sockets
    
    Browser                      Protocol  Cipher Suite Name (OpenSSL)       Forward Secrecy
    ------------------------------------------------------------------------------------------------
    Android 6.0                  TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       256 bit ECDH (P-256)
    Android 7.0 (native)         TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       256 bit ECDH (P-256)
    Android 8.1 (native)         TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       253 bit ECDH (X25519)
    Android 9.0 (native)         TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
    Android 10.0 (native)        TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
    Android 11 (native)          TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
    Android 12 (native)          TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
    Chrome 79 (Win 10)           TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
    Chrome 101 (Win 10)          TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
    Firefox 66 (Win 8.1/10)      TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
    Firefox 100 (Win 10)         TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
    IE 6 XP                      No connection
    IE 8 Win 7                   No connection
    IE 8 XP                      No connection
    IE 11 Win 7                  No connection
    IE 11 Win 8.1                No connection
    IE 11 Win Phone 8.1          No connection
    IE 11 Win 10                 TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       256 bit ECDH (P-256)
    Edge 15 Win 10               TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       253 bit ECDH (X25519)
    Edge 101 Win 10 21H2         TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
    Safari 12.1 (iOS 12.2)       TLSv1.3   TLS_CHACHA20_POLY1305_SHA256      253 bit ECDH (X25519)
    Safari 13.0 (macOS 10.14.6)  TLSv1.3   TLS_CHACHA20_POLY1305_SHA256      253 bit ECDH (X25519)
    Safari 15.4 (macOS 12.3.1)   TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
    Java 7u25                    No connection
    Java 8u161                   TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       256 bit ECDH (P-256)
    Java 11.0.2 (OpenJDK)        TLSv1.3   TLS_AES_128_GCM_SHA256            256 bit ECDH (P-256)
    Java 17.0.3 (OpenJDK)        TLSv1.3   TLS_AES_256_GCM_SHA384            253 bit ECDH (X25519)
    go 1.17.8                    TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
    LibreSSL 2.8.3 (Apple)       TLSv1.2   ECDHE-RSA-CHACHA20-POLY1305       253 bit ECDH (X25519)
    OpenSSL 1.0.2e               TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       256 bit ECDH (P-256)
    OpenSSL 1.1.0l (Debian)      TLSv1.2   ECDHE-RSA-CHACHA20-POLY1305       253 bit ECDH (X25519)
    OpenSSL 1.1.1d (Debian)      TLSv1.3   TLS_AES_256_GCM_SHA384            253 bit ECDH (X25519)
    OpenSSL 3.0.3 (git)          TLSv1.3   TLS_AES_256_GCM_SHA384            253 bit ECDH (X25519)
    Apple Mail (16.0)            TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       256 bit ECDH (P-256)
    Thunderbird (91.9)           TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)

    The simulated client requests confirm that only clients supporting TLS 1.2 and TLS 1.3 can establish connections.

  2. (Optional) If you need to use TLS 1.2 only, perform the following steps:

    1. Update the gateway YAML by setting both maxProtocolVersion and minProtocolVersion to TLSV1_2:

      apiVersion: networking.istio.io/v1beta1
      kind: Gateway
      metadata:
        name: mysdsgateway
        namespace: default
      spec:
        selector:
          istio: ingressgateway
        servers:
          - hosts:
              - '*'
            port:
              name: https
              number: 443
              protocol: HTTPS
            tls:
              credentialName: myexample-credential
              maxProtocolVersion: TLSV1_2
              minProtocolVersion: TLSV1_2
              mode: SIMPLE
    2. Run the following command to verify that only TLS 1.2 is supported:

      docker run --rm -ti registry.cn-hangzhou.aliyuncs.com/acs/testssl.sh https://IP address of the ingress gateway/productpage

      Expected protocol output:

       Testing protocols via sockets except NPN+ALPN
      
       SSLv2      not offered (OK)
       SSLv3      not offered (OK)
       TLS 1      not offered
       TLS 1.1    not offered
       TLS 1.2    offered (OK)
       TLS 1.3    not offered and downgraded to a weaker protocol

      not offered for TLS 1 and TLS 1.1, and not offered and downgraded to a weaker protocol for TLS 1.3 confirm that only TLS 1.2 is accepted.

      Client simulation output:

      Expand to view the expected output

      ......
       Running client simulations (HTTP) via sockets
      
       Browser                      Protocol  Cipher Suite Name (OpenSSL)       Forward Secrecy
      ------------------------------------------------------------------------------------------------
       Android 6.0                  TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       256 bit ECDH (P-256)
       Android 7.0 (native)         TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       256 bit ECDH (P-256)
       Android 8.1 (native)         TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       253 bit ECDH (X25519)
       Android 9.0 (native)         TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       253 bit ECDH (X25519)
       Android 10.0 (native)        TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       253 bit ECDH (X25519)
       Android 11 (native)          TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       253 bit ECDH (X25519)
       Android 12 (native)          TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       253 bit ECDH (X25519)
       Chrome 79 (Win 10)           TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       253 bit ECDH (X25519)
       Chrome 101 (Win 10)          TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       253 bit ECDH (X25519)
       Firefox 66 (Win 8.1/10)      TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       253 bit ECDH (X25519)
       Firefox 100 (Win 10)         TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       253 bit ECDH (X25519)
       IE 6 XP                      No connection
       IE 8 Win 7                   No connection
       IE 8 XP                      No connection
       IE 11 Win 7                  No connection
       IE 11 Win 8.1                No connection
       IE 11 Win Phone 8.1          No connection
       IE 11 Win 10                 TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       256 bit ECDH (P-256)
       Edge 15 Win 10               TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       253 bit ECDH (X25519)
       Edge 101 Win 10 21H2         TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       253 bit ECDH (X25519)
       Safari 12.1 (iOS 12.2)       TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       253 bit ECDH (X25519)
       Safari 13.0 (macOS 10.14.6)  TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       253 bit ECDH (X25519)
       Safari 15.4 (macOS 12.3.1)   TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       253 bit ECDH (X25519)
       Java 7u25                    No connection
       Java 8u161                   TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       256 bit ECDH (P-256)
       Java 11.0.2 (OpenJDK)        TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       256 bit ECDH (P-256)
       Java 17.0.3 (OpenJDK)        TLSv1.2   ECDHE-RSA-CHACHA20-POLY1305       253 bit ECDH (X25519)
       go 1.17.8                    TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       253 bit ECDH (X25519)
       LibreSSL 2.8.3 (Apple)       TLSv1.2   ECDHE-RSA-CHACHA20-POLY1305       253 bit ECDH (X25519)
       OpenSSL 1.0.2e               TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       256 bit ECDH (P-256)
       OpenSSL 1.1.0l (Debian)      TLSv1.2   ECDHE-RSA-CHACHA20-POLY1305       253 bit ECDH (X25519)
       OpenSSL 1.1.1d (Debian)      TLSv1.2   ECDHE-RSA-CHACHA20-POLY1305       253 bit ECDH (X25519)
       OpenSSL 3.0.3 (git)          TLSv1.2   ECDHE-RSA-CHACHA20-POLY1305       253 bit ECDH (X25519)
       Apple Mail (16.0)            TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       256 bit ECDH (P-256)
       Thunderbird (91.9)           TLSv1.2   ECDHE-RSA-AES128-GCM-SHA256       253 bit ECDH (X25519)

      The simulated client requests confirm that only clients supporting TLS 1.2 can establish connections.

  3. (Optional) If you need to use TLS 1.3 only, perform the following steps:

    1. Update the gateway YAML by setting both maxProtocolVersion and minProtocolVersion to TLSV1_3:

      apiVersion: networking.istio.io/v1beta1
      kind: Gateway
      metadata:
        name: mysdsgateway
        namespace: default
      spec:
        selector:
          istio: ingressgateway
        servers:
          - hosts:
              - '*'
            port:
              name: https
              number: 443
              protocol: HTTPS
            tls:
              credentialName: myexample-credential
              maxProtocolVersion: TLSV1_3
              minProtocolVersion: TLSV1_3
              mode: SIMPLE
    2. Run the following command to verify that only TLS 1.3 is supported:

      docker run --rm -ti registry.cn-hangzhou.aliyuncs.com/acs/testssl.sh https://IP address of the ingress gateway/productpage

      Expected protocol output:

      Testing protocols via sockets except NPN+ALPN
      
      SSLv2      not offered (OK)
      SSLv3      not offered (OK)
      TLS 1      not offered
      TLS 1.1    not offered
      TLS 1.2    not offered
      TLS 1.3    offered (OK): final

      not offered for TLS 1.0, TLS 1.1, and TLS 1.2 confirms that only TLS 1.3 is accepted.

      Client simulation output:

      Expand to view the expected output

      ......
      Running client simulations (HTTP) via sockets
      
       Browser                      Protocol  Cipher Suite Name (OpenSSL)       Forward Secrecy
      ------------------------------------------------------------------------------------------------
       Android 6.0                  No connection
       Android 7.0 (native)         No connection
       Android 8.1 (native)         No connection
       Android 9.0 (native)         TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
       Android 10.0 (native)        TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
       Android 11 (native)          TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
       Android 12 (native)          TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
       Chrome 79 (Win 10)           TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
       Chrome 101 (Win 10)          TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
       Firefox 66 (Win 8.1/10)      TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
       Firefox 100 (Win 10)         TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
       IE 6 XP                      No connection
       IE 8 Win 7                   No connection
       IE 8 XP                      No connection
       IE 11 Win 7                  No connection
       IE 11 Win 8.1                No connection
       IE 11 Win Phone 8.1          No connection
       IE 11 Win 10                 No connection
       Edge 15 Win 10               No connection
       Edge 101 Win 10 21H2         TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
       Safari 12.1 (iOS 12.2)       TLSv1.3   TLS_CHACHA20_POLY1305_SHA256      253 bit ECDH (X25519)
       Safari 13.0 (macOS 10.14.6)  TLSv1.3   TLS_CHACHA20_POLY1305_SHA256      253 bit ECDH (X25519)
       Safari 15.4 (macOS 12.3.1)   TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
       Java 7u25                    No connection
       Java 8u161                   No connection
       Java 11.0.2 (OpenJDK)        TLSv1.3   TLS_AES_128_GCM_SHA256            256 bit ECDH (P-256)
       Java 17.0.3 (OpenJDK)        TLSv1.3   TLS_AES_256_GCM_SHA384            253 bit ECDH (X25519)
       go 1.17.8                    TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)
       LibreSSL 2.8.3 (Apple)       No connection
       OpenSSL 1.0.2e               No connection
       OpenSSL 1.1.0l (Debian)      No connection
       OpenSSL 1.1.1d (Debian)      TLSv1.3   TLS_AES_256_GCM_SHA384            253 bit ECDH (X25519)
       OpenSSL 3.0.3 (git)          TLSv1.3   TLS_AES_256_GCM_SHA384            253 bit ECDH (X25519)
       Apple Mail (16.0)            No connection
       Thunderbird (91.9)           TLSv1.3   TLS_AES_128_GCM_SHA256            253 bit ECDH (X25519)

      The simulated client requests confirm that only clients supporting TLS 1.3 can establish connections.