Introduction
HTTP and HTTPS are the main protocols used for data transmission on the Internet. Data transferred via HTTP is not encrypted, meaning that all information, including usernames, passwords, cookies, and other sensitive data, can be potentially exposed, intercepted, or tampered with during an HTTP connection.
HTTPS, on the other hand, is an encrypted transmission protocol for websites based on the SSL protocol. HTTPS provides end-to-end data encryption, ensuring the data privacy and integrity during transmission. ZStack Cloud supports using HTTPS to log into the UI management interface and further enhance the system's security.
This tutorial is divided into UI and command-line configuration methods, detailing the procedures for using HTTPS to log into the UI interface.
UI Configuration Method
- Add a third-party certificate
- Add a system self-signed certificate
- Update certificate
- Switch back to HTTP to log in to the UI
Add a Third-Party Certificate
In this section, you will learn how to import a third-party certificate via the UI interface.
Prerequisites
- A latest ZStack Cloud environment.
- A admin or platform administrator permission to configure certificates.
- A valid certificate issued by the commercial CA.
- Certificates and certificate chains are only supported in CRT or PEM format,
and private keys are only supported in KEY or PEM format.
Note: If your
certificate does not meet the format requirements, please convert the
format on your own.
Procedure
- Log in to ZStack Cloud.
- Choose .
- On the Certificate Management page, click Add Certificate.
-
On the Import Certificate page, set the following
parameters:
- Import Mode: Choose Third-party Certificate.
- Certificate Document: Upload or import a certificate.
Note:
- Only CRT and PEM formats are supported.
- The certificate content starts with
----BEGIN CERTIFICATE----and ends with----END CERTIFICATE----.
- Private Key: Upload or import a private key.
Note:
- Only KEY and PEM formats are supported.
- The private key content starts with
----BEGIN (RSAIEC) PRIVATE KEY----and ends with----END (RSAIEC) PRIVATE KEY----.
- Certificate Chain: Upload or import a
certificate chain.
Note:
- Only CRT and PEM formats are supported.
- The certificate content starts with
----BEGIN CERTIFICATE----and ends with----END CERTIFICATE----.
- HTTP Redirection: Optional. If enabled, requests are redirected by default from port 5000 of the HTTP address to port 5443 of the HTTPS address.
Figure 1. Add Third-Party Certificate 
- Review the configuration and click OK.
-
After the above operations, the Cloud platform will automatically refresh and
you can access the UI via the HTTPS protocol.
Note: After configuring the certificate, the system will establish a new
session, and you will need to log in to the UI interface again.
Add a System Self-Signed Certificate
In this section, you will learn how to import a system self-signed certificate via the UI interface.
Prerequisites
- A latest ZStack Cloud environment.
- A admin or platform administrator permission to configure certificates.
Procedure
- Log in to ZStack Cloud.
- Choose .
- On the Certificate Management page, click Add Certificate.
-
On the Import Certificate page, set the following
parameters:
- Import Mode: Choose System Self-signed Certificate.
- Duration: Specify a validation duration for the system self-signed certificate. Valid values: 3 months, 1 year, 3 years, 5 years, and 10 years. By default, 10 years is selected.
- HTTP Redirection: Optional. If enabled, requests are redirected by default from port 5000 of the HTTP address to port 5443 of the HTTPS address.
- Custom Certificate Information: Optional. If
enabled, you can customize your self-signed certificate
information.
- Common Name: Optional. Set a common
name. By default, the common name is localhost.
The input must be 1 to 64 characters in length and can contain letters, digits, and special characters. Supported special characters include ~`@#$%^&*()-_+={}[]|:;'<>.?/
- Organization Name: Optional. Set a
name for your organization. By default, the organization
name is localhost.
The input must be 1 to 64 characters in length and can contain letters, digits, and special characters. Supported special characters include ~`@#$%^&*()-_+={}[]|:;'<>.?/
- Organization Unit Name: Optional. Set
a name for your organization unit.
The input must be 1 to 64 characters in length and can contain letters, digits, and special characters. Supported special characters include ~`@#$%^&*()-_+={}[]|:;'<>.?/
- Country/Region Name: The country/region name can only be set as CN.
- State/Province Name: Optional. Set
the state or province name.
The input must be 1 to 128 characters in length and can contain Chinese characters, letters, digits, and special characters. Supported special characters include ~`@#$%^&*()-_+={}[]|:;'<>.?/
- Locality Name: Optional. Set a city
name.
The input must be 1 to 128 characters in length and can contain Chinese characters, letters, digits, and special characters. Supported special characters include ~`@#$%^&*()-_+={}[]|:;'<>.?/
- Email Address: Optional. Set an email address.
- Common Name: Optional. Set a common
name. By default, the common name is localhost.
Figure 2. Add System Self-Signed Certificate 
- Review the configuration and click OK.
-
After the above operations, the Cloud platform will automatically refresh and
the UI can be accessed via the HTTPS protocol.
Note: After configuring the certificate, the system will establish a new
session, and you will need to log in to the UI interface again.
Update Certificate
In this section, you will learn how to how to update a certificate via the UI interface.
Prerequisites
- A latest ZStack Cloud environment.
- A admin or platform administrator permission to configure certificates.
- The added certificate has changed and requires updates.
Procedure
- Log in to ZStack Cloud.
- Choose .
-
On the Certificate Management page, click
Update Certificate
Figure 3. Update Certificate 
-
Review the configuration and click OK to update the
certificate.
Note: The system will detect the current certificate path and write the
certificate information to that path when updating the certificate.
Switch back to HTTP to Log in to the UI
In this section, you will learn how to switch back to HTTP to log in to the UI .
Prerequisites
- A latest ZStack Cloud environment.
- A admin or platform administrator permission to configure certificates.
- The user has configured the SSL certificate.
Procedure
- Log in to ZStack Cloud.
- Choose .
-
On the Certificate Management page, Click
Switch back to HTTP.
Figure 4. Switch Back to HTTP to Log in to the UI 
-
In the confirmation pop-up, Click OK to switch back to
HTTP to login in to the UI.
Note: The session is reestablished after you switch back to HTTP. You need to
log in to the UI again. You can then log in to the UI via HTTP protocol
after switching back to HTTP.
Command-line Configuration Method
- HTTPS mode is disabled by default.
- After enabling HTTPS, the system supports port 5443 by default and you can specify other ports for login.
- When HTTPS is enabled, if you log in to the Cloud on port 5000 using HTTP, the login page will be automatically redirected to HTTPS. Currently, only HTTP port 5000 is supported for automatic redirection to HTTPS.
- The system supports PKCS12 format certificates by default. Currently, only PKCS12/JKS format certificate is supported. If you use certificates in other formats, please convert the format yourself.
Single Management Node Scenario
- How to log in to the UI using the default HTTPS method
- How to log in to the UI with a custom HTTPS configuration
- How to switch back to HTTP for UI login
Log in to UI Using Default HTTPS Method
About this task
By default, the Cloud supports HTTPS login to the UI with a system default certificate.Procedure
-
Stop the management node service and UI service by running the following
commands on the management node.
zstack-ctl stop -
Make sure that the VNC console supports the HTTPS feature.
-
Run the following command to automatically generate a certificate based on the
default configuration and log in to the UI using HTTPS with the default
certificate. The default port is 5443.
zstack-ctl config_ui --enable-ssl True -
Run the following command on the management node to enable the management node
service and UI service.
zstack-ctl start - To access the ZStack Cloud management interface (https://your_domain_name:5443), use a Chrome or Firefox browser. Enter the default username and password (admin/password) to log in to the UI via HTTPS.
-
Set the console proxy address.
Log in to the UI interface, on the main menu of ZStack Cloud, choose and set the console proxy as your_domain_name to make sure the console opens properly.
Log in to UI with Custom HTTPS Configuration
About this task
By default, the Cloud supports logging in to the UI using HTTPS with the custom certificate.Procedure
-
A custom certificate is required. You can generate a system self-signed certificate
using related tools or purchase a certificate issued by a commercial CA.
You can use Keytool (a Java data certificate management tool) to generate a self-signed certificate.
mkdir certs keytool -genkey -alias tomcat -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore ./certs/keystore.p12 -validity 365Example:[root@localhost ~]# mkdir certs [root@localhost ~]# keytool -genkey -alias tomcat -storetype PKCS12 -keyalg RSA -keysize 2048 \ -keystore ./certs/keystore.p12 -validity 365 Enter keystore password: Re-enter new password: What is your first and last name? [Unknown]: Jack Chen What is the name of your organizational unit? [Unknown]: ZStack What is the name of your organization? [Unknown]: DOC What is the name of your City or Locality? [Unknown]: SH What is the name of your State or Province? [Unknown]: SH What is the two-letter country code for this organizational unit? [Unknown]: CN Is CN=Jack Chen, OU=Cloud, O=DOC, L=SH, ST=SH, C=CN correct? [No]: Yes [root@localhost certs]# ls keystore.p12 -
On the management node, run following command to stop the management node service and
the UI service.
zstack-ctl stop -
Ensure that the VNC console proxy supports HTTPS.
-
Run following command to customize certificate alias, certificate path, certificate
type, private key password, HTTPS login port, and other information. Then log in to the UI
via HTTPS using the custom certificate.
zstack-ctl config_ui --enable-ssl True \ --ssl-keyalias=*** --ssl-keystore=*** --ssl-keystore-type=*** \ --ssl-keystore-password=*** --server-port=*** --webhook-port=*** //Record the custom parameter information in the zstack.ui.properties configuration file. //Including settings for: enabling HTTPS, certificate alias, certificate path, certificate type, private key password, HTTPS login port. zstack-ctl show_ui_config //View the custom parameter information zstack-ctl stop_ui zstack-ctl start_ui //Log in to the UI via HTTPS each timeExample:[root@localhost ~]# zstack-ctl config_ui --enable-ssl True \ --ssl-keyalias=tomcat --ssl-keystore=/root/certs/keystore.p12 --ssl-keystore-type=PKCS12 \ --ssl-keystore-password=password --server-port=8888 [root@localhost ~]# zstack-ctl show_ui_config db_url = jdbc:mysql://10.0.233.184:3306 db_username = zstack_ui db_password = zstack.ui.password mn_host = 127.0.0.1 mn_port = 8080 webhook_host = 127.0.0.1 webhook_port = 5000 server_port = 8888 log = /usr/local/zstack/apache-tomcat/logs enable_ssl = true ssl_keyalias = tomcat ssl_keystore = /usr/local/zstack/zstack-ui/ui.keystore.p12.cp ssl_keystore_type = PKCS12 ssl_keystore_password = password [root@localhost ~]# zstack-ctl stop_ui successfully stopped the UI server [root@localhost ~]# zstack-ctl start_ui successfully started UI server on the local host, PID[32166], https://10.0.233.184:8888 -
On the management node, run following command to start the management node service and
the UI service.
zstack-ctl start -
Enter the ZStack Cloud management interface (https://your_domain_name:your_server_port) using a Chrome or
Firefox browser. Enter the default username and password (admin/password) to log in
via custom HTTPS.
Note:
If you encounter issues with accessing VNC console using Firefox browser, follow these steps:- Access https://your_domain_name:4900 using Firefox browser.
- Follow the prompts from the Firefox browser and add https://your_domain_name:4900 to the security exceptions.
- Open the VNC console using the Firefox browser.
For more information, see Firefox.
-
Set the console proxy address.
Log in to the UI interface, on the main menu of ZStack Cloud, choose and set the console proxy to your_domain_name to make sure the console opens properly.
Switch Back to HTTP for UI Login
Procedure
-
Run the following command to restore the HTTPS related parameters in the
zstack.ui.properties to the system default values.
zstack-ctl config_ui --restore -
Run
zstack-ctl stop_uiandzstack-ctl start_ui.Example:[root@localhost ~]# zstack-ctl config_ui --restore [root@localhost ~]# zstack-ctl show_ui_config db_url = jdbc:mysql://10.0.233.184:3306 db_username = zstack_ui db_password = zstack.ui.password mn_host = 127.0.0.1 mn_port = 8080 webhook_host = 127.0.0.1 webhook_port = 5000 server_port = 5000 log = /usr/local/zstack/apache-tomcat/logs enable_ssl = false ssl_keyalias = zstackui ssl_keystore = /usr/local/zstack/zstack-ui/ui.keystore.p12 ssl_keystore_type = PKCS12 ssl_keystore_password = password [root@localhost ~]# zstack-ctl stop_ui successfully stopped the UI server [root@localhost ~]# zstack-ctl start_ui successfully started UI server on the local host, PID[43261], http://10.0.233.184:5000 - Enter the ZStack Cloud management interface (https://your_domain_name:your_server_port) using a Chrome or Firefox browser. Enter the default username and password (admin/password). Then, you can switch back to HTTP for UI login.
-
Set the console proxy address.
Log in to the UI interface, on the main menu of ZStack Cloud, choose and set the console proxy to your_domain_name to make sure the console opens properly.
What to do next
Now, you have learned how to log in to the UI interface via HTTPS.
Multiple Management Nodes Scenario
- How to log in to the UI with custom HTTPS configuration
- How to switch back to HTTP for UI login
Log in to UI with Custom HTTPS Configuration
About this task
Under a dual management node scenario, you can log in to the UI using HTTPS with the custom certificate.Procedure
-
Prepare a multi-domain HTTPS certificate.
- Prepare a multi-domain HTTPS certificate in advance, for example, *.test.com.
- Bind each of the two management nodes and the VIP to a domain, for example, mna.test.com (management nodeA), mnb.test.com (management nodeB), and mn.test.com (VIP).
-
Run the following command on both management nodes to stop the management
service, UI service, and the zsha2 service.
[root@localhost ~]# zsha2 stop-node -
Ensure the VNC console supports HTTPS.
Both management nodes must ensure the VNC console supports HTTPS. For more information, see Step 3.
-
Configure the parameters.
Customize the certificate alias, certificate path, certificate type, private key password, HTTPS login port, and other information on both management nodes. Then, log in to the UI via HTTPS using the custom certificate. For more information, see Step 4.
-
Run the following command on both management nodes to start the management node
service, UI service, and the zsha2 service.
[root@localhost ~]# zsha2 start-node -
Use a custom certificate to log in to the UI via HTTPS.
Enter the ZStack Cloud management interface (https://your_domain_name:your_server_port) using a Chrome or Firefox browser. Enter the default username and password (admin/password) to log in via custom HTTPS.
Note:
If you encounter issues with accessing VNC console using Firefox browser, follow these steps:- Access https://your_domain_name:4900 using Firefox browser.
- Follow the prompts from the Firefox browser and add https://your_domain_name:4900 to the security exceptions.
- Open the VNC console using the Firefox browser.
For more information, see Firefox.
-
Set the console proxy address.
Log in to the UI interface, on the main menu of ZStack Cloud, choose . Set the console proxy to your_domain_name, for example, mna.test.com (management nodeA) and mnb.test.com (management nodeB) to make sure the console opens properly.
Switch Back to HTTP for UI Login
About this task
Under a dual management node scenario, you can restore the default HTTP method to log in to the UI.Procedure
-
Run the following command on both management nodes to stop the management
service, UI service, and the zsha2 service.
[root@localhost ~]# zsha2 stop-node -
Disable the HTTPS feature.
Run the following command on each of the two management nodes to restore the HTTPS related parameters in the zstack.ui.properties to their system default values.
[root@localhost ~]# zstack-ctl config_ui --restore -
Reconfigure webhook-host.
Run the following command on each of the two management nodes to configure the webhook-host address to the VIP address of the dual management nodes.
[root@localhost ~]# zstack-ctl config_ui --webhook-host VIP -
Run the following command on both management nodes to start the management node
service, UI service, and the zsha2 service.
[root@localhost ~]# zsha2 start-node -
Log in to the UI interface via HTTP
Enter the ZStack Cloud management interface (http://your_machine_ip:5000) using a Chrome or Firefox browser. Enter the default username and password (admin/password). Then, you can switch back to HTTP for UI login.
-
Set the console proxy address.
Log in to the UI interface, on the main menu of ZStack Cloud, choose and set the console proxy to your_machine_ip to make sure the console opens properly.
What to do next
Now, you have learned how to log in to the UI interface via HTTPS under a dual management nodes scenario.
