If the SQL Server certificate is missing or not trusted by the FglAM's keystore, the agent will fail to establish a secure SSL connection. This results in errors such as:
[Foglight][SQLServer JDBC Driver]Error establishing socket to host and port: ServerXXX:1433. Reason: Failed to create trust manager [Foglight][SQLServer JDBC Driver]SSL handshake failed:certificate_unknown(46)
1). Run this on the host where the local FglAM is installed:
Linux:
{FGLAM_HOME}/bin/fglam --add-certificate alias=/path/to/sqlserver.cer
Windows (PowerShell/CMD):
{FGLAM_HOME}\bin\fglam --add-certificate alias=C:\path\to\sqlserver.cer
2). Then restart the FglAM service.
1). If the cartridge includes `certificatetool` (under `{FGLAM_HOME}/agents/DB_SQL_Server/<version>/lib`) you can add the cert to the cartridge `fogdb.store`:
Windows:
certificatetool-<ver>.bat --add-certificate host1=C:\path\to\sqlserver.cer
Linux:
chmod u+x certificatetool-<ver>.sh
./certificatetool-<ver>.sh --add-certificate host1=/path/to/sqlserver.cer
2). Restart the FglAM service
1). Create/import into a dedicated truststore and point the FglAM JVM at it (or import into `$JAVA_HOME/jre/lib/security/cacerts`):
keytool -importcert -alias sqlserver -file sqlserver.cer -keystore /opt/fglam/truststore/fglam-truststore.jks -storepass changeit -noprompt
2). Then add JVM args (example in baseline.jvmargs.config)
vmparameter.0 = "-Djavax.net.ssl.trustStore=/opt/fglam/truststore/fglam-truststore.jks";
vmparameter.1 = "-Djavax.net.ssl.trustStorePassword=changeit";
3). Restart the FglAM service
Linux
keytool -printcert -sslserver SERVERNAME:1433 -rfc > sqlserver.cer
Linux
openssl s_client -connect SERVERNAME:1433 -showcerts </dev/null 2>/dev/null | sed -n '/BEGIN CERTIFICATE/,/END CERTIFICATE/p' > sqlserver.cer
The following video details how to add the certificate for SQL Server host on FMS servers with in FIPS mode using certificatetool.