How to update an Orgnizational issued certificate on an HTML5GW with RPM Deployment
Objective
This article provides step-by-step instructions for updating or replacing an expired organization-issued SSL certificate on an HTML5 Gateway deployed via an RPM package.
NOTE: These steps are specifically for HTML5GW RPM deployments and do NOT apply to Docker/Podman deployments.
NOTE: When updating certificates, it is critical to ensure that the extracted private key and certificate files carry the correct file ownership and permissions for the 'psmgwuser' account. If these permissions are not set correctly, the guacd service will fail to start and might throw the error: "guacd: Unable to load keyfile".
NOTE: For self-signed certificate updates, please refer to the following article: https://community.cyberark.com/s/article/How-to-update-change-expired-certificates-on-HTML5-Gateway
Environment
14.0;14.2;14.4;14.6;15.0 Privileged Access Manager (PAM, self-hosted) Privileged Session Management (PSM)
Procedure
How to Update or Replace Expired SSL Certificates on HTML5 Gateway (RPM Deployment)
-- Prerequisites & Notes --
- Execute all commands as the root user or a user with sudo privileges.
- To make updating the CA certificate easier, we've created the alias "JAVA_SEC_PATH" as a reference for the Dynamic Java Trust Store path variable. The full path can be retrieved using the readlink command as follows:
JAVA_SEC_PATH=$(readlink -f /usr/bin/java | sed "s:/bin/java::")/lib/security/cacerts(Referring to step 4) - Replace default keystore passwords (e.g., 'changeit') with the correct passwords for your environment.
- In this example, the keystore and certs are created and stored in /opt/tomcat/ (As mentioned in the installation docs as the directory for Tomcat).
Reference File Naming Used in This Guide:
/certs# Directory used to upload new certificates (Not created by default)/certs/backup/# Directory used to store backups of old certificate files/opt/tomcat/h5-cert.crt# Old html5gw public certificate for guacd/opt/tomcat/h5-key.pem# Old html5gw private key for guacd/certs/html5-rpm-new.pfx# New HTML5GW certificate container (PFX)/opt/tomcat/h5-cert-new.crt# New extracted public certificate for guacd/opt/tomcat/h5-key-new.pem# New extracted private key for guacd
-- Step 1: Backup Existing Certificates --
Navigate to the Tomcat directory and back up existing certificate files to /certs/backup/:
mkdir -p /certs/backup/cp /opt/tomcat/keystore /certs/backup/keystore-oldcp /opt/tomcat/h5-cert.crt /certs/backup/h5-cert-old.crtcp /opt/tomcat/h5-key.pem /certs/backup/h5-key-old.pem
-- Step 2: Remove Old Gateway Certificate from Tomcat Keystore --
1. List certificates in the Tomcat keystore to view current aliases:
keytool -list -keystore /opt/tomcat/keystore
2. Delete the old gateway certificate alias (e.g., 'psmgw_guacd_cert') from the Tomcat keystore:
keytool -delete -alias psmgw_guacd_cert -keystore /opt/tomcat/keystore
3. Verify deletion by listing the Tomcat keystore entries again:
keytool -list -keystore /opt/tomcat/keystore
-- Step 3: Deploy New HTML5GW Certificate (html5-rpm-new.pfx) --
1. Identify the source alias inside the new PFX file:
keytool -list -keystore /certs/html5-rpm-new.pfx -storetype pkcs12
2. Import the new PFX certificate into the Tomcat keystore using the identified source alias:
keytool -importkeystore \
-srckeystore /certs/html5-rpm-new.pfx \
-srcstoretype pkcs12 \
-destkeystore /opt/tomcat/keystore \
-deststoretype JKS \
-srcalias "<pfx_source_alias>" \
-destalias "psmgw_guacd_cert"
3. Extract the public certificate and unencrypted private key for guacd to /opt/tomcat/:
- Extract public certificate (h5-cert-new.crt):
openssl pkcs12 -in /certs/html5-rpm-new.pfx -clcerts -nokeys -out /opt/tomcat/h5-cert-new.crt Extract private key (h5-key-new.pem):openssl pkcs12 -in /certs/html5-rpm-new.pfx -nocerts -nodes -out /opt/tomcat/h5-key-new.pem
-- Step 4 (OPTIONAL): Update Root CA (Only if Root/Issuing CA Changed or Expired) or Self-signed --
Perform this step ONLY if your organizational Root/Issuing CA was renewed or replaced (skip if unchanged):
1. Removing the old CA Certificate
- Commands to run:
JAVA_SEC_PATH=$(readlink -f /usr/bin/java | sed "s:/bin/java::")/lib/security/cacerts- To view and gather the CA alias from the keystore:
keytool -list -keystore $JAVA_SEC_PATH keytool -delete -alias <your old CA alias> -keystore keytool -list -keystore $JAVA_SEC_PATH
2. Import rootCA-new.crt into Java cacerts:
JAVA_SEC_PATH=$(readlink -f /usr/bin/java | sed "s:/bin/java::")/lib/security/cacertskeytool -import -alias <your new CA alias> -keystore $JAVA_SEC_PATH -trustcacerts -file /certs/rootCA-new.crt
3. Import rootCA-new.crt into OS trust and generate OpenSSL hash link for guacd:
cp /certs/rootCA-new.crt /etc/pki/ca-trust/source/anchors/update-ca-trustmkdir -p /etc/pki/tls/certschmod 705 /etc/pki/tls/certsln -sf /certs/rootCA-new.crt /etc/pki/tls/certs/$(openssl x509 -noout -hash -in /certs/rootCA-new.crt).0
-- Step 5: Configure File Ownership & Permissions (CRITICAL) --
NOTE: Because guacd runs under the 'psmgwuser' service account, it must be granted ownership and read permissions on h5-cert-new.crt and h5-key-new.pem to prevent "Unable to load keyfile" errors:
# Assign ownership to psmgwuser:
chown psmgwuser:psmgwuser /opt/tomcat/h5-cert-new.crt /opt/tomcat/h5-key-new.pem
# Set readable permissions for public cert and restricted permissions for private key:
chmod 644 /opt/tomcat/h5-cert-new.crt
chmod 600 /opt/tomcat/h5-key-new.pem
-- Step 6: Update guacd.conf Configuration --
Update /etc/guacamole/guacd.conf to point to the new certificate and key filenames under the [ssl] section:
[ssl]
server_certificate = /opt/tomcat/h5-cert-new.crt
server_key = /opt/tomcat/h5-key-new.pem
-- Step 7: Restart and Verify Services --
1. Restart Tomcat and guacd services:
systemctl restart tomcat guacd
2. Verify status:
systemctl status tomcat guacd