Skip to content
Snippets Groups Projects
Commit 0d932916 authored by eugene.livis's avatar eugene.livis
Browse files

Fixes to get SSL working

parent 5d9f770a
No related branches found
No related tags found
No related merge requests found
......@@ -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 cant 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;
......
......@@ -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 cant 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 cant 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());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment