diff --git a/bindings/java/src/org/sleuthkit/datamodel/CaseDatabaseFactory.java b/bindings/java/src/org/sleuthkit/datamodel/CaseDatabaseFactory.java index da21a76cfcc66b855c29fa2b7682c9e9baef17e3..6e3ffe683a3de80444729634d29f25d066ae27c6 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/CaseDatabaseFactory.java +++ b/bindings/java/src/org/sleuthkit/datamodel/CaseDatabaseFactory.java @@ -716,7 +716,9 @@ Connection getConnection(String databaseName) throws TskCoreException { if (info.isSslEnabled()) { // ssl=true: enables SSL encryption. // NonValidatingFactory avoids hostname verification. - url.append("?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory"); + // sslmode=require: This mode makes the encryption mandatory and also requires the connection to fail if it can�t be encrypted. + // In this mode, the JDBC driver accepts all server certificates. + url.append("?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory&sslmode=require"); } Connection conn; diff --git a/bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java b/bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java index bb832bd52a698ba9712d66a42a80f138c89b161c..01e59f8854e24c692cb3f5765f3d0c8a5a598833 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java +++ b/bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java @@ -297,7 +297,9 @@ public static void tryConnect(CaseDbConnectionInfo info) throws TskCoreException if (info.isSslEnabled()) { // ssl=true: enables SSL encryption. // NonValidatingFactory avoids hostname verification. - connectionURL += "?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory"; + // sslmode=require: This mode makes the encryption mandatory and also requires the connection to fail if it can�t be encrypted. + // In this mode, the JDBC driver accepts all server certificates. + connectionURL += "?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory&sslmode=require"; } Connection conn = DriverManager.getConnection(connectionURL, info.getUserName(), info.getPassword()); //NON-NLS if (conn != null) { @@ -13406,7 +13408,9 @@ private final class PostgreSQLConnections extends ConnectionPool { if (info.isSslEnabled()) { // ssl=true: enables SSL encryption. // NonValidatingFactory avoids hostname verification. - connectionURL += "?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory"; + // sslmode=require: This mode makes the encryption mandatory and also requires the connection to fail if it can�t be encrypted. + // In this mode, the JDBC driver accepts all server certificates. + connectionURL += "?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory&sslmode=require"; } comboPooledDataSource.setJdbcUrl(connectionURL); comboPooledDataSource.setUser(info.getUserName());