[ERROR] Logstash JDBC plugin - PKIX path building failed

Hi,

I have an issue with logstash jdbc plugin configuration for MSSQL.

My config file:

input {
    jdbc {
      jdbc_driver_library => "/opt/elastic/drivers/mssql-jdbc-10.2.0.jre11.jar"
      jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
      jdbc_connection_string => "jdbc:sqlserver://0.0.0.0:1433;databaseName=solarwindsbd_rst;"
      jdbc_user => "user_elk"
      jdbc_password => "pass"
      statement => "SELECT SYSDATETIME() \"SYSDATETIME\",CURRENT_TIMESTAMP\"CURRENT\",GETDATE()\"GET\";"
      jdbc_validate_connection => true
    }
}
filter {

}
output {
  #elasticsearch {
  #   hosts => ["clusterECS"]
  #   user => "elastic"
  #   password => "pass"
  #   index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{[alp]}-%{+YYYY.MM}"
  #}
  stdout { codec => rubydebug }
}

I had an error before this one and I dont know if it is related
Error 1:

jdbc - Unable to connect to database. 
Tried 1 times {:message=>"Java::ComMicrosoftSqlserverJdbc::SQLServerException: 
The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. 
Error: \"The server selected protocol version TLS10 is not accepted by client preferences [TLS13, TLS12]\". 
ClientConnectionId:80248a28-d90c-4b17-ab28-28ea9186c3dd", :
exception=>Sequel::DatabaseConnectionError, :
cause=>com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. 
Error: "The server selected protocol version TLS10 is not accepted by client preferences [TLS13, TLS12]". ClientConnectionId:80248a28-d90c-4b17-ab28-28ea9186c3dd, :backtrace=>["com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(com/microsoft/sqlserver/jdbc/SQLServerConnection.java:3680)", "com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(com/microsoft/sqlserver/jdbc/IOBuffer.java:2113)", "com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(com/microsoft/sqlserver/jdbc/SQLServerConnection.java:3204)", "com.microsoft.sqlserver.jdbc.SQLServerConnection.login(com/microsoft/sqlserver/jdbc/SQLServerConnection.java:2833)", "com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(com/microsoft/sqlserver/jdbc/SQLServerConnection.java:2671)",

For resolve this error I change the java.security file
From this:

jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, RC4, DES, MD5withRSA, \
    DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
    include jdk.disabled.namedCurves

To this:

jdk.tls.disabledAlgorithms=SSLv3, RC4, DES, MD5withRSA, \
    DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
    include jdk.disabled.namedCurves

After this change the error is this:

[ERROR] 2022-02-28 12:40:13.792 [[main]<jdbc] jdbc - Unable to connect to database. 
Tried 1 times {:message=>"Java::ComMicrosoftSqlserverJdbc::SQLServerException: 
The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. 
**Error: \"PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target\". **
**ClientConnectionId:f79ffae4-4161-469a-bdab-b9997ccdb3c7"**, :exception=>Sequel::DatabaseConnectionError, :
cause=>com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. 
Error: "PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: 
unable to find valid certification path to requested target". ClientConnectionId:f79ffae4-4161-469a-bdab-b9997ccdb3c7,
 :backtrace=>["com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(com/microsoft/sqlserver/jdbc/SQLServerConnection.java:3680)", "com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(com/microsoft/sqlserver/jdbc/IOBuffer.java:2113)"

Do you know which could be the cause of this error??

Regards,

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.