Updated on 2024-12-13 GMT+08:00

Installing an SSL Certificate on a Resin Server

This topic describes how to install an SSL certificate on a Resin server. When the certificate is installed, it secures communication between your server and the client through SSL.

The installation procedure in this topic is for your reference only as the commands executed and configuration file modified during the installation may vary depending on OS types and server configurations.

Prerequisites

  • The certificate is in the Issued status.

Constraints

  • Before installing the certificate, enable port 443 on the server where the SSL certificate is installed and add port 443 to the security group. Otherwise, HTTPS cannot be enabled after the installation.
  • If a domain name maps to multiple servers, deploy the certificate on each server.
  • The domain name to be run on the target server must be the same as the one associated with the certificate. Otherwise, the web browser will display a message indicating that the domain name is insecure.

Procedure

To install an SSL certificate on a Resin server, perform the following steps:

Step 1: Obtaining FilesStep 2: Configuring ResinStep 3: Verifying the Effect

Step 1: Obtaining Files

Before installing a certificate, obtain the certificate file and key file. Perform the following operations based on the method you select for CSR:

  • If you select System generated CSR for CSR when applying for a certificate, perform the operations according to the instructions in System generated CSR.
  • If you select Upload a CSR for CSR when applying for a certificate, perform the operations according to the instructions in Upload a CSR.

Detailed operations are as follows:

  • System generated CSR
    1. Decompress the downloaded certificate file on your local PC.
      The downloaded file contains the Apache, IIS, Nginx, and Tomcat folders as well as the domain.csr file. Figure 1 shows an example.
      Figure 1 Decompressing an SSL certificate package on a local computer
    2. Obtain Certificate ID_Domain name bound to the certificate_server.jks and Certificate ID_Domain name bound to the certificate_keystorePass.txt from Certificate ID_Domain name bound to the certificate_Tomcat.
  • Upload a CSR
    1. Decompress the downloaded certificate package to obtain the Certificate ID_Domain name bound to the certificate_server.pem file.

      The Certificate ID_Domain name bound to the certificate_server.pem file contains two segments of certificate codes -----BEGIN CERTIFICATE----- and -----END CERTIFICATE-----, which are the server certificate and intermediate CA certificate respectively.

    2. Use OpenSSL to convert the PEM certificate into a PFX certificate and obtain the server.pfx file.
      1. Save the PEM certificate and the private key server.key generated during CSR generation to the bin directory in the OpenSSL installation directory.
      2. In the bin directory of the OpenSSL installation directory, run the following command to convert the PEM certificate into a PFX certificate and press Enter:

        openssl pkcs12 -export -out server.pfx -inkey server.key -in Certificate ID_Domain name bound to the certificate_server.pem

        Information similar to the following is displayed.

        Enter Export Password:
      3. Enter the password of the PFX certificate and press Enter.

        The password is user-defined. Set it as required.

        Information similar to the following is displayed.

        Verifying - Enter Export Password:

        Record the password of the PFX certificate. The password of the JKS certificate must be the same as that of the PFX certificate. Otherwise, the Resin service may fail to start.

        To improve password security, a password must:

        • Consist of 8 to 32 characters.
        • Contain at least three types of the following characters: uppercase letters, lowercase letters, digits, and special characters ~`!@#$%^&*()_+|{}:"<>?-=\[];',./
      4. Re-enter the password of the PFX certificate and press Enter.

        If no error information is displayed, the server.pfx file has been generated in the OpenSSL installation directory.

    3. Use Keytool to convert the PFX certificate into a JKS certificate and obtain the server.jks file.
      1. Copy the server.pfx file generated in 2 to the %JAVA_HOME%/jdk/bin directory.
      2. In the %JAVA_HOME%/jdk/bin directory, run the following command and press Enter:

        keytool -importkeystore -srckeystore server.pfx -destkeystore server.jks -srcstoretype PKCS12 -deststoretype JKS

        Information similar to the following is displayed.

        Enter the destination keystore password:
      3. Enter the password of the JKS certificate and press Enter.

        Set the password of the JKS certificate to the same as that of the PFX certificate. Otherwise, the Resin service may fail to start.

        Information similar to the following is displayed.

        Re-enter the new password:
      4. Re-enter the password of the JKS certificate and press Enter.

        Information similar to the following is displayed.

        Enter the source keystore password:
      5. Enter the password of the PFX certificate set in 2.c and press Enter.

        If information similar to the following is displayed, the conversion is successful and the server.jks file has been generated in the OpenSSL installation directory.

        Entry for alias 1 imported successfully.
        Import command completed: 1 entry successfully imported, 0 entries failed or canceled
      6. Create a keystorePass.txt file in the %JAVA_HOME%/jdk/bin directory and save the password of the JKS certificate in the file.
    4. Place the converted certificate file server.jks and the new password file keystorePass.txt in the same directory.

Step 2: Configuring Resin

Before modifying the configuration file, back up the configuration file. You are advised to deploy the configuration file in the test environment and then configure it on the production environment to avoid service interruptions caused by incorrect configurations.

  1. (Optional) Install Resin.
    If you have installed Resin, skip this step.
    1. Log in to the Resin official website and download the appropriate application packages for your operating system.

      The following uses Resin-4.0.38 for Windows as an example.

    2. Decompress the downloaded Resin software package.
    3. Access the root directory of Resin-4.0.38 and find the resin.exe file.
    4. Run the resin.exe file. During the execution, the command prompt window Figure 2 will display.
      Figure 2 Information dialog box
    5. After the resin.exe file is executed. Start the Microsoft Internet Explorer, enter the default address http://127.0.0.1:8080 of Resin in the address bar, and then press Enter.

      If the information similar to Figure 3 is displayed, Resin is installed successfully.

      Figure 3 Logging In to Resin
  2. Modify the configuration file.
    1. Find the following parameters in the Resin.properties configuration file in the Resin installation directory (the configuration file may be resin.xml for different Resin versions):
      # specifies the --server in the config file
      # home_server : app-0
      
      # Set HTTP and HTTPS bind address
      # http_address : *
      
      # Set HTTP and HTTPS ports.
      # Use overrides for individual server control, for example: app-0.http : 8081
      app.http          : 8080
      # app.https          : 8443
      
      web.http          : 8080
      # web.https          : 8443
    2. Delete the comment symbol (#) before app.https and web.https. Then modify port 8443 to 443. After the modification:
      app.https and web.https: Port to be used on the server. You are advised to set the value to 443.
      # specifies the --server in the config file
      # home_server : app-0
      
      # Set HTTP and HTTPS bind address
      # http_address : *
      
      # Set HTTP and HTTPS ports.
      # Use overrides for individual server control, for example: app-0.http : 8081
      app.http          : 8080
      app.https          : 443
      
      web.http          : 8080
      web.https          : 443
    3. Find the following parameters and delete the comment symbol (#) before jsse_keystore_type, jsse_keystore_file, and jsse_keystore_password.
      # JSSE certificate configuration
      # Keys are typically stored in the resin configuration directory.
      jsse_keystore_tye : jks
      jsse_keystore_file : cert/server.jks
      jsse_keystore_password: certificate password
    4. Modify certificate-related parameters. For details, see Table 1.
      # JSSE certificate configuration
      # Keys are typically stored in the resin configuration directory.
      jsse_keystore_tye : jks
      jsse_keystore_file : cert/server.jks
      jsse_keystore_password: certificate password
      Table 1 Description

      Parameter

      Description

      jsse_keystore_tye

      Type of the Keystore file. Generally, this parameter is set to jks.

      jsse_keystore_file

      Path for storing the server.jks file. The value can be an absolute path or a relative path. Example: cert/server.jks

      jsse_keystore_password

      Password of server.jks. Set this parameter to the password provided in the keystorePass.txt file.

      NOTICE:

      If the password contains &, replace it with &amp; to avoid configuration failure.

      An example command is provided as follows:

      If the password is keystorePass="Ix6&APWgcHf72DMu", change it to keystorePass="Ix6&amp;APWgcHf72DMu".

    5. Save the configuration file.
  3. Restart Resin.

Step 3: Verifying the Effect

After the deployment succeeds, in the address bar of the browser, enter https://Domain name and press Enter.

If a security padlock is displayed in the address bar of the browser, the certificate has been installed successfully.