<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article How to Secure the HTML5 Gateway with Certificates in PAM Self-Hosted Articles</title>
    <link>https://live.paloaltonetworks.com/t5/pam-self-hosted-articles/how-to-secure-the-html5-gateway-with-certificates/ta-p/1429197</link>
    <description>&lt;P&gt;The purpose of this document is to provide Idira customers, partners, and employees with a detailed description of the process for securing a deployment of the Idira PSM HTML5 Gateway using certificates.&lt;/P&gt;
&lt;P&gt;The examples given are based on the Idira Training Skytap environment with the fictitious ACME Corporation, with which all of our customers and partners should be familiar.&lt;/P&gt;
&lt;P&gt;Specifically, in this document we will see how to:&lt;/P&gt;
&lt;UL&gt;&lt;LI&gt;Create the Tomcat keystore&lt;/LI&gt;&lt;LI&gt;Generate a certificate signing request (CSR) on the Gateway server. &amp;nbsp;&lt;/LI&gt;&lt;LI&gt;Install the certificate in Tomcat to secure the end users’ web connection to the Gateway&lt;/LI&gt;&lt;LI&gt;Import the organization’s certificate trust chain into the machine keystore&lt;/LI&gt;&lt;LI&gt;Install the same certificate in Guacamole to secure communication between guacd and Tomcat&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Note:&amp;nbsp;&lt;/STRONG&gt; This document has been tested in a Idira PAM version 14.4 Self-Hosted environment with a PSM Gateway server running Rocky 9.4&lt;/EM&gt;&lt;/P&gt;
&lt;H3&gt;Steps&lt;/H3&gt;
&lt;H1&gt;Securing Tomcat&lt;/H1&gt;
&lt;P&gt;The following steps assume you have already deployed, but not configured, the Tomcat web application (version 9.x).&lt;BR /&gt;You can generate the certificate for the Guacamole web app, which in our case means the HTML5 Gateway either outside the server and then copy the files to the psm-gw server, or directly on the server itself. &amp;nbsp;Generally speaking, it is more secure NOT to move the private keys, so the process below describes how to do it directly on the server.&lt;/P&gt;
&lt;H2&gt;Generate the keystore for Tomcat&lt;/H2&gt;
&lt;P&gt;First, create a sub-directory to hold the keystore and then change directories into that sub-directory.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;mkdir /opt/tomcat/keystore&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;cd /opt/tomcat/keystore&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Next, we will generate the actual keystore. &amp;nbsp;This will launch a wizard that will step us through the process of gathering most of the information required to create a certificate for the psm-gw.acme.corp server.&lt;/P&gt;
&lt;P&gt;Create a keystore file to store the certificate private keys securely.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;keytool -genkey -alias tomcat -keyalg RSA -keysize 2048 -keystore tomcat.jks&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Prompts for a password twice and then it presents a list of questions that will form the basis of the certificate.&lt;/P&gt;
&lt;P&gt;Answer some questions:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;What is your first and last name?&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp; [Unknown]: &amp;nbsp;psm-gw.acme.corp&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;What is the name of your organizational unit?&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp; [Unknown]: &amp;nbsp;Training&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;What is the name of your organization?&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp; [Unknown]: &amp;nbsp;Acme&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;What is the name of your City or Locality?&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp; [Unknown]: &amp;nbsp;Newton&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;What is the name of your State or Province?&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp; [Unknown]: &amp;nbsp;MA&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;What is the two-letter country code for this unit?&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp; [Unknown]: &amp;nbsp;US&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Is CN=psm-gw.acme.corp, OU=Training, O=Acme, L=Newton, ST=MA, C=US correct?&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp; [no]: &amp;nbsp;yes&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;Enter key password for &amp;lt;tomcat&amp;gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (RETURN if same as keystore password):&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;At the end, you will be prompted to export the keystore to PKCS12, which you should do. &amp;nbsp;You can copy and paste the command from the last output. &amp;nbsp;This will create a backup of the old keystore and use the same name – tomcat.jks – for the new PKCS12 keystore.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;keytool -importkeystore -srckeystore /opt/tomcat/keystore/tomcat.jks -destkeystore /opt/tomcat/keystore/tomcat.jks -deststoretype pkcs12&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Now we can generate a CSR based on the information in the keystore and some extra information (the Subject Alternative Name, or SAN). &amp;nbsp;You will be prompted for the keystore password.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;keytool -certreq -keyalg RSA -alias tomcat -file /opt/tomcat/keystore/psm-gw.csr -keystore /opt/tomcat/keystore/tomcat.jks -ext SAN=dns:psm-gw.acme.corp,dns:psm-gw,ip:10.0.30.3&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Note:&lt;/STRONG&gt; &amp;nbsp; &amp;nbsp;Chrome, at least, seems to require something in the SAN field. &amp;nbsp;Here, it is two DNS names plus the IP address of the certificate. &amp;nbsp;That works. &amp;nbsp;If excluded, Chrome sees the certificate as invalid.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;You should now have three files in your /opt/tomcat/keystore directory:&lt;/P&gt;
&lt;UL&gt;&lt;LI&gt;tomcat.jks&lt;/LI&gt;&lt;LI&gt;tomcat.jks.old&lt;/LI&gt;&lt;LI&gt;psm-gw.csr&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;You now need to present your CSR to your certificate authority for signature. &amp;nbsp;Because that process will differ from organization to organization, it is beyond the scope of this document.&lt;/P&gt;
&lt;P&gt;Once the certificate is signed, you need to copy it back to the psm-gw server in order to import it into the keystore. &amp;nbsp;You will also need to copy the certificates for the entire trust chain. &amp;nbsp;In our example, we have only to import psm-gw.cer and acme.cer because we use our Root CA to sign our certificates. &amp;nbsp;This is NOT best practice.&lt;/P&gt;
&lt;P&gt;Copy those files into the directory &lt;EM&gt;/opt/tomcat/keystore&lt;/EM&gt; for convenience.&lt;/P&gt;
&lt;P&gt;First, import the CA certificate. &amp;nbsp;You would need to modify the -alias parameter for each link in the trust chain as you imported them: -alias intermediate1, -alias intermediate2, etc. &amp;nbsp;From the /opt/tomcat/keystore directory, run the following:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;keytool -import -alias root -keystore tomcat.jks -trustcacerts -file acme.cer&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You will be prompted for the keystore password. &amp;nbsp;Then, you will be presented with the details of the certificate and asked to confirm the import. &amp;nbsp;Enter &lt;EM&gt;yes&lt;/EM&gt;.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;Trust this certificate? [no]: &amp;nbsp;yes&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then import the server certificate. &amp;nbsp;Again, you will be prompted for the keystore password.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;keytool -import -alias tomcat -keystore tomcat.jks -file psm-gw.cer&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This does not require confirmation.&lt;/P&gt;
&lt;H2&gt;Further Tomcat configuration&lt;/H2&gt;
&lt;P&gt;The process for configuring tomcat is detailed in CyberArk’s on-line documentation:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.cyberark.com/pam-self-hosted/latest/en/content/pas%20inst/install_psm_html5_rpm.htm" target="_blank"&gt;Install PSM HTML5 Gateway using an RPM package | Idira Docs&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;There is no need to repeat it here. &amp;nbsp;If you performed the steps above, then you can ignore any steps in the documentation related to Tomcat certificates. &amp;nbsp;You still need to configure the server.xml file.&lt;/P&gt;
&lt;H1&gt;Deploy the HTML5 Gateway&amp;nbsp;&lt;/H1&gt;
&lt;P&gt;Deploy the Gateway as per instructions in the documentation.&lt;/P&gt;
&lt;H1&gt;Secure the connection between guacd and tomcat&lt;/H1&gt;
&lt;P&gt;The Guacamole service – guacd – needs to communicate securely with the web app tomcat. &amp;nbsp;We can use the same certificate we generated for Tomcat, but we will need a copy of it in another location and in a slightly different format.&lt;/P&gt;
&lt;P&gt;The guacd service also needs access to the private key for this certificate, so we will need to extract it from the Tomcat keystore and then convert it to a format that is readable by Guacamole.&lt;/P&gt;
&lt;H2&gt;Import the organization’s trust chain into the JVM&lt;/H2&gt;
&lt;P&gt;The instructions in this section have some overlap with the on-line documentation. &amp;nbsp;However, the process described here is adapted to CA-signed certificates, as opposed to self-signed certificates.&lt;/P&gt;
&lt;P&gt;Find the location of the JVM keystore:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;readlink -f /usr/bin/java | sed "s:bin/java::"&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This returns a path that will look something like this (the version may be different):&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.442.b06-2.el9.x86_64/jre&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You will then insert that string into another command to import first the root certificate (highlighted below):&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;keytool -import -alias acme_root_cert -keystore &lt;SPAN style="background-color: #ffffff;"&gt;/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.442.b06-2.el9.x86_64/jre&lt;/SPAN&gt;/lib/security/cacerts -trustcacerts -file /opt/tomcat/keystore/acme.cer&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Note:&lt;/STRONG&gt; &amp;nbsp; &amp;nbsp;If the root of your trust chain is a public CA, then its certificate should already be in the machine's certificate store and you would not need to import it.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Do this for the entire trust chain in the order of the hierarchy: root, first intermediate, second intermediate, etc.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;keytool -import -alias webapp_guacd_cert -keystore /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.442.b06-2.el9.x86_64/jre/lib/security/cacerts -trustcacerts -file /opt/tomcat/keystore/psm-gw.cer&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;H2&gt;Import the organization’s trust chain into the machine&lt;/H2&gt;
&lt;P&gt;This will allow the local machine to trust the acme.corp CA.&lt;/P&gt;
&lt;P&gt;Copy the CA cert to the local certificate folder:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;cp /opt/tomcat/keystore/acme.cer /etc/pki/ca-trust/source/anchors/&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then update the CA store&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;update-ca-trust extract&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Prepare the files for Guacamole&lt;/P&gt;
&lt;P&gt;We need to prepare the files for use by Guacamole, which has slightly different requirements.&lt;/P&gt;
&lt;P&gt;Change directories back into the Tomcat keystore:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;cd /opt/tomcat/keystore&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then, export the tomcat.jks to a PFX file for guacd. &amp;nbsp;The command “imports” the data to a new keystore of format PKCS12. &amp;nbsp;As such, you will be prompted twice to create a password for the new keystore, then you will be prompted once for the password to the source keystore.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;keytool -importkeystore -srckeystore tomcat.jks -destkeystore psm-gw.pfx -srcstoretype JKS -deststoretype PKCS12&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Now that the data is outside the tomcat keystore, we can manipulate it with openssl commands. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Extract the certificate and keys to a PEM file. &amp;nbsp;You will first be prompted for the PFX password, then to create a password for the PEM file.&lt;/P&gt;
&lt;P&gt;You will need to include the -legacy switch, as shown below.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;openssl pkcs12 -in psm-gw.pfx -nocerts -out psm-gw.pem -legacy&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then extract the certificate in .crt format. &amp;nbsp;For some reason, Guacamole does not like the certificate in .cer format. &amp;nbsp;You will be prompted for the PFX password.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;openssl pkcs12 -in psm-gw.pfx -clcerts -nokeys -out psm-gw.crt -legacy&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then extract the PEM file to a KEY file. You will be prompted for the PFX password.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;openssl rsa -in psm-gw.pem -out psm-gw.key&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Create a directory to hold the certificate and private key for Guacamole.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;mkdir /opt/certs&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Copy the certificate and key file to from /opt/tomcat/keystore to our newly created certificate directory.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;cp psm-gw.crt /opt/certs/psm-gw.crt&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;cp psm-gw.key /opt/certs/psm-gw.key&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Make the two files readable:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;chmod 644 /opt/certs/psm-gw.crt&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;chmod 640 /opt/certs/psm-gw.key&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Make the PSM Gateway user owner of the Guacamole certificate directory:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;chown -R psmgwuser:psmgwuser /opt/certs/&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Edit the guacd config file to point to these new files:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;vi /etc/guacamole/guacd.conf&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Update the file so that the SSL section is active and the two parameters point to your two files.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;[ssl]&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;server_certificate = /opt/certs/psm-gw.crt&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;server_key = /opt/certs/psm-gw.key&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;Restart Tomcat and restart Guacamole:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;systemctl restart tomcat&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;systemctl restart guacd&lt;/CODE&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 05 Nov 2026 19:53:02 GMT</pubDate>
    <dc:creator>jeff_degan</dc:creator>
    <dc:date>2026-11-05T19:53:02Z</dc:date>
    <item>
      <title>How to Secure the HTML5 Gateway with Certificates</title>
      <link>https://live.paloaltonetworks.com/t5/pam-self-hosted-articles/how-to-secure-the-html5-gateway-with-certificates/ta-p/1429197</link>
      <description>&lt;P&gt;The purpose of this document is to provide Idira customers, partners, and employees with a detailed description of the process for securing a deployment of the Idira PSM HTML5 Gateway using certificates.&lt;/P&gt;
&lt;P&gt;The examples given are based on the Idira Training Skytap environment with the fictitious ACME Corporation, with which all of our customers and partners should be familiar.&lt;/P&gt;
&lt;P&gt;Specifically, in this document we will see how to:&lt;/P&gt;
&lt;UL&gt;&lt;LI&gt;Create the Tomcat keystore&lt;/LI&gt;&lt;LI&gt;Generate a certificate signing request (CSR) on the Gateway server. &amp;nbsp;&lt;/LI&gt;&lt;LI&gt;Install the certificate in Tomcat to secure the end users’ web connection to the Gateway&lt;/LI&gt;&lt;LI&gt;Import the organization’s certificate trust chain into the machine keystore&lt;/LI&gt;&lt;LI&gt;Install the same certificate in Guacamole to secure communication between guacd and Tomcat&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Note:&amp;nbsp;&lt;/STRONG&gt; This document has been tested in a Idira PAM version 14.4 Self-Hosted environment with a PSM Gateway server running Rocky 9.4&lt;/EM&gt;&lt;/P&gt;
&lt;H3&gt;Steps&lt;/H3&gt;
&lt;H1&gt;Securing Tomcat&lt;/H1&gt;
&lt;P&gt;The following steps assume you have already deployed, but not configured, the Tomcat web application (version 9.x).&lt;BR /&gt;You can generate the certificate for the Guacamole web app, which in our case means the HTML5 Gateway either outside the server and then copy the files to the psm-gw server, or directly on the server itself. &amp;nbsp;Generally speaking, it is more secure NOT to move the private keys, so the process below describes how to do it directly on the server.&lt;/P&gt;
&lt;H2&gt;Generate the keystore for Tomcat&lt;/H2&gt;
&lt;P&gt;First, create a sub-directory to hold the keystore and then change directories into that sub-directory.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;mkdir /opt/tomcat/keystore&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;cd /opt/tomcat/keystore&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Next, we will generate the actual keystore. &amp;nbsp;This will launch a wizard that will step us through the process of gathering most of the information required to create a certificate for the psm-gw.acme.corp server.&lt;/P&gt;
&lt;P&gt;Create a keystore file to store the certificate private keys securely.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;keytool -genkey -alias tomcat -keyalg RSA -keysize 2048 -keystore tomcat.jks&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Prompts for a password twice and then it presents a list of questions that will form the basis of the certificate.&lt;/P&gt;
&lt;P&gt;Answer some questions:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;What is your first and last name?&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp; [Unknown]: &amp;nbsp;psm-gw.acme.corp&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;What is the name of your organizational unit?&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp; [Unknown]: &amp;nbsp;Training&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;What is the name of your organization?&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp; [Unknown]: &amp;nbsp;Acme&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;What is the name of your City or Locality?&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp; [Unknown]: &amp;nbsp;Newton&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;What is the name of your State or Province?&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp; [Unknown]: &amp;nbsp;MA&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;What is the two-letter country code for this unit?&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp; [Unknown]: &amp;nbsp;US&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Is CN=psm-gw.acme.corp, OU=Training, O=Acme, L=Newton, ST=MA, C=US correct?&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp; [no]: &amp;nbsp;yes&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;Enter key password for &amp;lt;tomcat&amp;gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (RETURN if same as keystore password):&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;At the end, you will be prompted to export the keystore to PKCS12, which you should do. &amp;nbsp;You can copy and paste the command from the last output. &amp;nbsp;This will create a backup of the old keystore and use the same name – tomcat.jks – for the new PKCS12 keystore.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;keytool -importkeystore -srckeystore /opt/tomcat/keystore/tomcat.jks -destkeystore /opt/tomcat/keystore/tomcat.jks -deststoretype pkcs12&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Now we can generate a CSR based on the information in the keystore and some extra information (the Subject Alternative Name, or SAN). &amp;nbsp;You will be prompted for the keystore password.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;keytool -certreq -keyalg RSA -alias tomcat -file /opt/tomcat/keystore/psm-gw.csr -keystore /opt/tomcat/keystore/tomcat.jks -ext SAN=dns:psm-gw.acme.corp,dns:psm-gw,ip:10.0.30.3&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Note:&lt;/STRONG&gt; &amp;nbsp; &amp;nbsp;Chrome, at least, seems to require something in the SAN field. &amp;nbsp;Here, it is two DNS names plus the IP address of the certificate. &amp;nbsp;That works. &amp;nbsp;If excluded, Chrome sees the certificate as invalid.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;You should now have three files in your /opt/tomcat/keystore directory:&lt;/P&gt;
&lt;UL&gt;&lt;LI&gt;tomcat.jks&lt;/LI&gt;&lt;LI&gt;tomcat.jks.old&lt;/LI&gt;&lt;LI&gt;psm-gw.csr&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;You now need to present your CSR to your certificate authority for signature. &amp;nbsp;Because that process will differ from organization to organization, it is beyond the scope of this document.&lt;/P&gt;
&lt;P&gt;Once the certificate is signed, you need to copy it back to the psm-gw server in order to import it into the keystore. &amp;nbsp;You will also need to copy the certificates for the entire trust chain. &amp;nbsp;In our example, we have only to import psm-gw.cer and acme.cer because we use our Root CA to sign our certificates. &amp;nbsp;This is NOT best practice.&lt;/P&gt;
&lt;P&gt;Copy those files into the directory &lt;EM&gt;/opt/tomcat/keystore&lt;/EM&gt; for convenience.&lt;/P&gt;
&lt;P&gt;First, import the CA certificate. &amp;nbsp;You would need to modify the -alias parameter for each link in the trust chain as you imported them: -alias intermediate1, -alias intermediate2, etc. &amp;nbsp;From the /opt/tomcat/keystore directory, run the following:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;keytool -import -alias root -keystore tomcat.jks -trustcacerts -file acme.cer&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You will be prompted for the keystore password. &amp;nbsp;Then, you will be presented with the details of the certificate and asked to confirm the import. &amp;nbsp;Enter &lt;EM&gt;yes&lt;/EM&gt;.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;Trust this certificate? [no]: &amp;nbsp;yes&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then import the server certificate. &amp;nbsp;Again, you will be prompted for the keystore password.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;keytool -import -alias tomcat -keystore tomcat.jks -file psm-gw.cer&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This does not require confirmation.&lt;/P&gt;
&lt;H2&gt;Further Tomcat configuration&lt;/H2&gt;
&lt;P&gt;The process for configuring tomcat is detailed in CyberArk’s on-line documentation:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.cyberark.com/pam-self-hosted/latest/en/content/pas%20inst/install_psm_html5_rpm.htm" target="_blank"&gt;Install PSM HTML5 Gateway using an RPM package | Idira Docs&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;There is no need to repeat it here. &amp;nbsp;If you performed the steps above, then you can ignore any steps in the documentation related to Tomcat certificates. &amp;nbsp;You still need to configure the server.xml file.&lt;/P&gt;
&lt;H1&gt;Deploy the HTML5 Gateway&amp;nbsp;&lt;/H1&gt;
&lt;P&gt;Deploy the Gateway as per instructions in the documentation.&lt;/P&gt;
&lt;H1&gt;Secure the connection between guacd and tomcat&lt;/H1&gt;
&lt;P&gt;The Guacamole service – guacd – needs to communicate securely with the web app tomcat. &amp;nbsp;We can use the same certificate we generated for Tomcat, but we will need a copy of it in another location and in a slightly different format.&lt;/P&gt;
&lt;P&gt;The guacd service also needs access to the private key for this certificate, so we will need to extract it from the Tomcat keystore and then convert it to a format that is readable by Guacamole.&lt;/P&gt;
&lt;H2&gt;Import the organization’s trust chain into the JVM&lt;/H2&gt;
&lt;P&gt;The instructions in this section have some overlap with the on-line documentation. &amp;nbsp;However, the process described here is adapted to CA-signed certificates, as opposed to self-signed certificates.&lt;/P&gt;
&lt;P&gt;Find the location of the JVM keystore:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;readlink -f /usr/bin/java | sed "s:bin/java::"&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This returns a path that will look something like this (the version may be different):&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.442.b06-2.el9.x86_64/jre&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You will then insert that string into another command to import first the root certificate (highlighted below):&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;keytool -import -alias acme_root_cert -keystore &lt;SPAN style="background-color: #ffffff;"&gt;/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.442.b06-2.el9.x86_64/jre&lt;/SPAN&gt;/lib/security/cacerts -trustcacerts -file /opt/tomcat/keystore/acme.cer&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Note:&lt;/STRONG&gt; &amp;nbsp; &amp;nbsp;If the root of your trust chain is a public CA, then its certificate should already be in the machine's certificate store and you would not need to import it.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Do this for the entire trust chain in the order of the hierarchy: root, first intermediate, second intermediate, etc.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;keytool -import -alias webapp_guacd_cert -keystore /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.442.b06-2.el9.x86_64/jre/lib/security/cacerts -trustcacerts -file /opt/tomcat/keystore/psm-gw.cer&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;H2&gt;Import the organization’s trust chain into the machine&lt;/H2&gt;
&lt;P&gt;This will allow the local machine to trust the acme.corp CA.&lt;/P&gt;
&lt;P&gt;Copy the CA cert to the local certificate folder:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;cp /opt/tomcat/keystore/acme.cer /etc/pki/ca-trust/source/anchors/&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then update the CA store&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;update-ca-trust extract&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Prepare the files for Guacamole&lt;/P&gt;
&lt;P&gt;We need to prepare the files for use by Guacamole, which has slightly different requirements.&lt;/P&gt;
&lt;P&gt;Change directories back into the Tomcat keystore:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;cd /opt/tomcat/keystore&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then, export the tomcat.jks to a PFX file for guacd. &amp;nbsp;The command “imports” the data to a new keystore of format PKCS12. &amp;nbsp;As such, you will be prompted twice to create a password for the new keystore, then you will be prompted once for the password to the source keystore.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;keytool -importkeystore -srckeystore tomcat.jks -destkeystore psm-gw.pfx -srcstoretype JKS -deststoretype PKCS12&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Now that the data is outside the tomcat keystore, we can manipulate it with openssl commands. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Extract the certificate and keys to a PEM file. &amp;nbsp;You will first be prompted for the PFX password, then to create a password for the PEM file.&lt;/P&gt;
&lt;P&gt;You will need to include the -legacy switch, as shown below.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;openssl pkcs12 -in psm-gw.pfx -nocerts -out psm-gw.pem -legacy&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then extract the certificate in .crt format. &amp;nbsp;For some reason, Guacamole does not like the certificate in .cer format. &amp;nbsp;You will be prompted for the PFX password.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;openssl pkcs12 -in psm-gw.pfx -clcerts -nokeys -out psm-gw.crt -legacy&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then extract the PEM file to a KEY file. You will be prompted for the PFX password.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;openssl rsa -in psm-gw.pem -out psm-gw.key&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Create a directory to hold the certificate and private key for Guacamole.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;mkdir /opt/certs&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Copy the certificate and key file to from /opt/tomcat/keystore to our newly created certificate directory.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;cp psm-gw.crt /opt/certs/psm-gw.crt&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;cp psm-gw.key /opt/certs/psm-gw.key&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Make the two files readable:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;chmod 644 /opt/certs/psm-gw.crt&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;chmod 640 /opt/certs/psm-gw.key&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Make the PSM Gateway user owner of the Guacamole certificate directory:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;chown -R psmgwuser:psmgwuser /opt/certs/&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Edit the guacd config file to point to these new files:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;vi /etc/guacamole/guacd.conf&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Update the file so that the SSL section is active and the two parameters point to your two files.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;[ssl]&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;server_certificate = /opt/certs/psm-gw.crt&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;server_key = /opt/certs/psm-gw.key&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;Restart Tomcat and restart Guacamole:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;CODE&gt;systemctl restart tomcat&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;systemctl restart guacd&lt;/CODE&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2026 19:53:02 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/pam-self-hosted-articles/how-to-secure-the-html5-gateway-with-certificates/ta-p/1429197</guid>
      <dc:creator>jeff_degan</dc:creator>
      <dc:date>2026-11-05T19:53:02Z</dc:date>
    </item>
  </channel>
</rss>

