This article provides step-by-step instructions to configure a secure TLS/SSL connection between the MongoDB Agent and a MongoDB server. It assumes familiarity with TLS/SSL concepts and tools such as openssl and keytool.
The Foglight Agent Manager (FglAM) acts as a database client and requires a valid SSL configuration to securely connect to MongoDB. If the JVM does not trust the MongoDB server certificate, the connection will fail with errors such as:
PKIX path building failed: unable to find valid certification path to requested target
openssl pkcs12 \The default JRE keystore is saved in [FglAM_HOME]/jre/[version]/jre/lib/security/cacerts, after importing the CA certificate here, copy this file to an alternate path so it doesn't get replaced after an upgrade (e.g. [FglAM_HOME]/truststore/)
-export \
-in $CERT_NAME.crt \
-inkey $CERT_NAME.key \
-name $CERT_NAME \
-out temp-keystore.p12 \
-passout pass:$KEYPASS keytool -importkeystore \
-srckeystore temp-keystore.p12 \
-srcstoretype PKCS12 \
-srcstorepass $KEYPASS \
-destkeystore $KEYSTORE \
-deststoretype JKS \
-deststorepass $KEYPASS
keytool -importcert \
-keystore $TRUSTSTORE \
-alias $CA_NAME \
-file $CA_NAME.crt \
-keypass $TRUSTPASS \
-storepass $TRUSTPASS \
-storetype JKS \ -noprompt
vmparameter.0 = "-Djavax.net.ssl.keyStore=/path/to/keystore";
vmparameter.1 = "-Djavax.net.ssl.keyStorePassword=changeit";
vmparameter.2 = "-Djavax.net.ssl.trustStore=/path/to/truststore";
vmparameter.3 = "-Djavax.net.ssl.trustStorePassword=changeit";
* Have a backup of your current keystore/truststore files in advance.
Import a root or intermediate CA certificate (if different that what already exist) to an existing Java truststore (keystore):
keytool -import -trustcacerts -alias somerootalias -file ca_cert.pem -keystore truststorestore.jks
keytool -import -trustcacerts -alias anotheralias -file intermediate_if_any.pem -keystore truststorestore.jks
Import a signed primary certificate & key to an existing Java keystore:
- combined.pem: is the combined of the cert + key in a single pem file
keytool -import -trustcacerts -alias yourdomain_or_dnsname_alias -file combined.pem -keystore yourkeystore.jks
Or if you have the pkcs12 file for the certs:
Import pkcs12 into keystore:
keytool -importkeystore -srckeystore yoursource.p12 -srcstoretype PKCS12 -destkeystore keystore.jks -deststoretype JKS
Import pkcs12 into truststore:
keytool -importkeystore -srckeystore yourCAsource.p12 -srcstoretype PKCS12 -destkeystore truststore.jks -deststoretype JKS
When specifying a path to a keystore in a JVM argument (e.g., -Djavax.net.ssl.keyStore) that contains spaces, it’s important to correctly handle the path formatting to avoid errors.
Use Forward Slashes (/
) in the Path (Recommended):
Example:
vmparameter.0 = "-Djavax.net.ssl.keyStore=\"C:/Foglight Agent Manager/keystorename\""
\\
) for Windows-style Paths:
\\
) and escape the quotes around the path.vmparameter.0 = "-Djavax.net.ssl.keyStore=\"D:\\Foglight Agent Manager\\keystorename\""
\"
) to properly handle the path inside the argument string.\\
) if using Windows-style paths with backslashes.vmparameter.0 = "-Djavax.net.ssl.keyStore=\"C:/Foglight Agent Manager/keystorename\"";
vmparameter.1 = "-Djavax.net.ssl.keyStorePassword=changeit";
vmparameter.2 = "-Djavax.net.ssl.trustStore=\"C:/Foglight Agent Manager/truststore/cacerts\"";
vmparameter.3 = "-Djavax.net.ssl.trustStorePassword=changeit";
Then, restart the FglAM and continue with the agent configuration, setting the “Use TLS/SSL?” option in the Agent Properties to true. If the client certificate is not configured specifically for the FglAM host, you can also set the “Allow Invalid Cert Hostname?” option to true to allow the certificate to be used anyway.
\state\default\certificates\certificate.store
by default, which has no password. Consider switching to a custom truststore for better control.© 2025 Quest Software Inc. ALL RIGHTS RESERVED. 이용 약관 개인정보 보호정책 Cookie Preference Center