What are the steps required to use an externally signed certificate in the Foglight Management Server (FMS) so users and Foglight Agent Manager (FglAM) clients can connect to the FMS via HTTPS?
ssl | https | certificate | csr | pfx | pkcs12 | ca | root | intermediate
This solution covers the steps to use an externally signed certificate in the Foglight Management Server (FMS) and for Foglight Agent Manager (FglAM) clients to connect via HTTPS.
$FMS_HOME
is where the FMS is installed.
There are multiple keystores used by Foglight.
$FMS_HOME/config/tomcat.keystore
(default password: nitrogen)$FMS_HOME/jre/lib/security/cacerts
(default password: changeit)
Review the following sections depending on the certificate management process in the environment:
The following steps need to be completed to generate a new key pair in the Foglight keystore, create a certificate signing request for it to be signed by a Certificate Authority (CA) and then import the signed certificate.
$FMS_HOME/config/
$FMS_HOME/config/tomcat.keystore
and $FMS_HOME/jre/lib/security/cacerts
files.tomcat
key from the tomcat.keystore
keystore using the following command:
$FMS_HOME/jre/bin/keytool -keystore $FMS_HOME/config/tomcat.keystore -storepass nitrogen -delete -alias tomcat
tomcat
alias using the following command:
$FMS_HOME/jre/bin/keytool -keystore $FMS_HOME/config/tomcat.keystore -storepass nitrogen -alias tomcat -keyalg RSA -keysize 2048 -genkeypair -validity [number of days] -dname "CN=[your_fmsserver_dns_name],OU=[your_organizational_unit_name],O=[your_organization_name],L=[your_city_name],ST=[your_state_name],C=[your_two-letter_country_code]" -ext SAN=dns:[your_fmsserver_dns_name],ip:[your_fmsserver_ip]
$FMS_HOME/jre/bin/keytool -keystore $FMS_HOME/config/tomcat.keystore -storepass nitrogen -alias tomcat -certreq -validity [number of days] -ext SAN=dns:[your_fmsserver_dns_name],ip:[your_fmsserver_ip] -file foglight.csr
tomcat.keystore
using the following command (CA certificates may need to be imported first; refer to section Import CA's root and intermediate certificates of this KB article).
$FMS_HOME/jre/bin/keytool -keystore $FMS_HOME/config/tomcat.keystore -storepass nitrogen -alias tomcat -validity [number of days] -trustcacerts -import -file [ca signed certificate]
or
$FMS_HOME/jre/bin/keytool -keystore $FMS_HOME/config/tomcat.keystore -storepass nitrogen -alias tomcat -validity [number of days] -importcert -file [ca signed certificate chain in p7b format]
Example:
--- Delete key after completing backups
$FMS_HOME/jre/bin/keytool -keystore $FMS_HOME/config/tomcat.keystore -storepass nitrogen -delete -alias tomcat
--- Create new key
$FMS_HOME/jre/bin/keytool -keystore $FMS_HOME/config/tomcat.keystore -storepass nitrogen -alias tomcat -keyalg RSA -keysize 2048 -genkeypair -validity 730 -dname "CN=servername.domain.com,OU=IT,O=Your Company,L=Your City,ST=Your State,C=US" -ext SAN=dns:servername.domain.com,dns:serveralias.domain.com
--- Generate CSR
$FMS_HOME/jre/bin/keytool -keystore $FMS_HOME/config/tomcat.keystore -storepass nitrogen -alias tomcat -certreq -validity 730 -ext SAN=dns:servername.domain.com,dns:serveralias.domain.com -file foglight.csr
--- Import signed certificate
$FMS_HOME/jre/bin/keytool -keystore $FMS_HOME/config/tomcat.keystore -storepass nitrogen -alias tomcat -validity 730 -trustcacerts -import -file foglight.cer
If you have an existing SSL certificate and you want to use this certificate in Tomcat, follow the steps below to import this SSL certificate.
Note: This certificate must be provided in the PKCS #12 (pfx) format. If the certificate and private key are saved in separate files, run the following command to merge them to the PKCS12 format:
openssl pkcs12 -export -in $certfile -inkey $keyfile -out $keystorefile -name tomcat -CAfile $cacertfile -caname root
To import a certificate in Tomcat:
$FMS_HOME/config/tomcat.keystore
tomcat.keystore
keystore using the following command:
$FMS_HOME/jre/bin/keytool -keystore $FMS_HOME/config/tomcat.keystore -storepass nitrogen -alias tomcat -delete
Obtain the certificate's alias name from the certificate PFX file using the following command:
$FMS_HOME/jre/bin/keytool -keystore $your_certificate_pfx_file -storepass $certificate_pfx_password -list -v
The following is an example of command output. The value of Alias name is required in step 4.
Merge the Tomcat keystore and the PKCS12 keystore using the following command:
$FMS_HOME/jre/bin/keytool -importkeystore -destkeystore $FMS_HOME/config/tomcat.keystore -deststorepass nitrogen -destalias tomcat -destkeypass nitrogen -srckeystore [your_certificate_pfx_file] -srcstorepass [certificate_pfx_password] -srcstoretype pkcs12 -srcalias [alias_name_in_step_3]
In environments where an in-house certificate granting authority (CA) is in use, the CA’s certificate may need to be added as trusted certificates to the keystore; otherwise errors such as keytool error: java.lang.Exception: Failed to establish chain from reply
will prevent the import of the signed certificate.
$FMS_HOME/jre/bin/keytool -keystore $FMS_HOME/config/tomcat.keystore -storepass nitrogen -import -trustcacerts -alias rootca -file [YourRootCA.cer]
$FMS_HOME/jre/bin/keytool -keystore $FMS_HOME/config/tomcat.keystore -storepass nitrogen -import -trustcacerts -alias intermediateca -file [YourIntermediateCA.cer]
$FglAM_HOME
is where FglAM is installed.
Review the following sections to configure the FglAM for HTTPS connections to the FMS from the user interface or by manually editing the configuration file.
$FglAM_HOME/bin/fglam --configure
8080
to 8443
or specify the port if using a non-default one, such as 443
.
$FglAM_HOME\state\default\config\fglam.config.xml
http-upstream url
entry as follows:
From:
<http-upstream url='https://foglight.yourdomain.com:8443' ssl-allow-self-signed='false' ssl-cert-common-name='quest.com'/>
To:
<http-upstream url='https://foglight.yourdomain.com:8443'/>
$FglAM_HOME/bin/fglam --add-certificate CertificateAlias=/path/certificate_filename
Note: The name used as CertificateAlias
is not important; use something unique to represent the certificate being imported.
For additional information refer to section Configuring Foglight to use the HTTPS port in any of the Foglight installation setup guides available in the Support Portal (E.g.: Foglight - Installing Foglight on a UNIX System with an Embedded PostgreSQL Database).
Futher helpful links about merging keys and importing certificates:
How to import an existing SSL certificate for use in Tomcat
Import private key and certificate into java keystore