ALB supports SM2 certificates and custom TLS security policies with SM cipher suites, enabling SM-compatible browsers to access your services over the Transport Layer Cryptography Protocol (TLCP). This provides HTTPS encryption that meets China's cryptographic standards and Multi-Level Protection Scheme (MLPS) Level 3 requirements for industries such as finance and government.
Prerequisites
-
The SM certificate feature is not enabled by default. Go to Quota Center to apply for the required quota.
-
You have registered a custom domain name. Because the ALB instance in this example is in China (Shanghai), the domain name must have a completed ICP filing.
-
You have purchased or uploaded an SM2 certificate in Certificate Management Service. The certificate must match the domain name with a completed ICP filing.
-
You have created a VPC named
VPC1in China (Shanghai) with vSwitchesVSW1(zone E) andVSW2(zone F).
Procedure
1. Create an ECS instance and deploy a service
-
Create an ECS instance with the following configurations.
-
Name: ECS01
-
Region: China (Shanghai)
-
VPC:
VPC1 -
vSwitch:
VSW1 -
Image: Alibaba Cloud Linux 3.2104 LTS 64-bit
-
-
Connect to the ECS01 instance. Run the following commands to deploy an Nginx service.
sudo yum install -y nginx sudo systemctl start nginx echo "Hello from ECS backend" | sudo tee /usr/share/nginx/html/index.html -
Add a high-priority inbound rule to the security group of the ECS instance to allow incoming traffic.
-
Policy: Allow
-
Protocol: Custom TCP
-
Source: Select
IPv4, and then selectThis VPC CIDR block. -
Destination (This Instance): Select
Port, and then selectHTTP (80).
-
Create an instance by using the wizard, Connection methods, Add security group rules.
2. Create an ALB instance
-
Log on to the ALB console, select the China (Shanghai) region, and then click Create ALB.
-
On the purchase page, specify the following parameters and click Create Now.
-
Instance Network Type: Select Internet.
-
VPC: Select
VPC1. -
Zone: Select Shanghai Zone E with
VSW1and Shanghai Zone F withVSW2. Enable Assign EIP. -
IP Version: Select IPv4.
-
Edition (Instance Fee): Select Standard.
-
-
On the Confirm Order page, verify the instance configurations and click Activate Now.
3. Create a server group and add servers
-
In the Server Group console, make sure that China (Shanghai) is selected as the region, and then click Create Server Group.
-
Configure the server group as follows and click Create.
-
Server Group Type: Select Server.
-
Server Group Name: Enter
sg-nginx. -
VPC: Select
VPC1. -
Backend Server Protocol: Use the default value
HTTP.
-
-
In the The server group is created dialog box, click Add Backend Server. Select
ECS01and click Next. In the Ports/Weights step, set the server Port to80and click OK.
4. Create a custom TLS security policy
SM2 certificates require a custom TLS security policy with an SM cipher suite associated with the listener. System security policies do not include SM cipher suites.
-
In the left-side navigation pane of the ALB console, click TLS Security Policies. On the Custom Policy tab, click Create Custom Policy.
-
In the panel that appears, set the policy Name to
gm-tls-policyand Minimum Version to TLS 1.0 or Later. In the Cipher Suite section, moveECC-SM2-WITH-SM4-SM3to the selected box, and then click Create.
ECC-SM2-WITH-SM4-SM3is an alias forECC-SM2-SM4-CBC-SM3andECC-SM2-SM4-GCM-SM3.
5. Create an HTTPS listener with an SM2 certificate
-
In the ALB console, click the ID of the target instance to go to the Instance Details page. On the Listener tab, click Create Listener.
-
In the Configure Listener step, set Listener Protocol to HTTPS and Listener Port to
443. Then, click Next. -
In the SSL Certificate step, select your SM2 certificate. The algorithm type is displayed in the certificate list, where
SM2indicates an SM2 certificate. Selectgm-tls-policyfor TLS Security Policies and click Next. -
In the Server Group step, select the
sg-nginxserver group and click Next. -
In the Configuration Review step, confirm the configurations and click Submit.
After configuring an SM2 certificate, you must select a custom TLS security policy that includes an SM cipher suite. Otherwise, clients cannot access your service.
6. Configure domain name resolution
Add a CNAME record to map your custom domain name to the DNS name of the ALB instance.
This example uses Alibaba Cloud DNS. If your domain name is not registered with Alibaba Cloud, add the domain name to the Alibaba Cloud DNS console first.
-
In the ALB console, copy the Domain Name of the target instance.
-
Log on to the Alibaba Cloud DNS console. For the target domain name, click Settings in the Actions column. On the Settings page, click Add Record.
-
Add a CNAME record with the following information and click OK.
-
Record Type: Select CNAME.
-
Hostname: Enter a prefix, such as
sm2. If your custom domain name isexample.com, the domain name used to access the ALB instance issm2.example.com. -
Query Source and TTL: Keep the default values.
-
Record Value: Enter the DNS name of the ALB instance.
-
-
In the Change Resource Record Confirmation dialog box, confirm the DNS record information and click OK.
7. Verify the configuration
-
Replace
sm2.example.comwith the domain name you configured in Step 6. Make sure that the DNS record has taken effect. -
Accessing SM2-secured websites requires an SM-compatible browser. This example uses the ZOS browser.
Verify SM HTTPS
In the ZOS browser, go to https://sm2.example.com. Click the lock icon in the address bar to view the certificate. If the certificate type is SM2, the configuration is successful.
More information
Limitations
-
Only upgraded ALB instances support SM2 certificates. Use ALB instance cloning to migrate services from a pre-upgrade instance.
-
Only Standard and WAF-enabled ALB instances support SM2 certificates. Basic and Advanced editions do not support this feature.
-
SM2 certificates do not support mutual authentication or SM2 CA certificates.
Billing
-
ALB instance: ALB supports pay-as-you-go and subscription billing. ALB billing overview.
-
ECS instance: ECS billing overview. For testing, create a low-specification pay-as-you-go instance and release it afterward to avoid unnecessary fees.
-
Domain name and DNS resolution fees: Besides domain name provider fees, Alibaba Cloud DNS charges for public authoritative DNS resolution.
FAQ
SSL handshake error with an SM-compatible browser
-
Verify that
ECC-SM2-WITH-SM4-SM3is selected in the custom TLS security policy. -
Verify that the listener uses the custom TLS security policy with the SM cipher suite.