Skip to content

Commit

Permalink
feat: disable TLS in CB client by default (#2167)
Browse files Browse the repository at this point in the history
Co-authored-by: Yuriy Movchan <Yuriy.Movchan@gmail.com>
  • Loading branch information
yuremm and yurem authored Aug 18, 2022
1 parent 30f6e1a commit 8ec5dd3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,7 @@ PyCharm
.DS_STORE
tmp
/.metadata/

# DBeaver
credentials-config.json
data-sources.json
2 changes: 2 additions & 0 deletions jans-auth-server/server/conf/jans-couchbase.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ ssl.trustStore.enable: ${config.couchbase.ssl_enabled}
ssl.trustStore.file: ${config.couchbase.couchbaseTrustStoreFn}
ssl.trustStore.pin: ${config.couchbase.encoded_couchbaseTrustStorePass}
ssl.trustStore.type: pkcs12

tls.enable: false
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,7 @@ ssl.trustStore.file: %(couchbaseTrustStoreFn)s
ssl.trustStore.pin: %(encoded_couchbaseTrustStorePass)s
ssl.trustStore.type: pkcs12

tls.enable: false

binaryAttributes=objectGUID
certificateAttributes=userCertificate
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.couchbase.client.core.env.SecurityConfig;
import com.couchbase.client.java.env.ClusterEnvironment;

import io.jans.orm.couchbase.operation.impl.CouchbaseConnectionProvider;
Expand Down Expand Up @@ -69,7 +70,14 @@ protected void initInternal() {
String sslTrustStorePin = couchbaseConnectionProperties.getProperty("ssl.trustStore.pin");
Optional<String> sslTrustStoreType = Optional.ofNullable(couchbaseConnectionProperties.getProperty("ssl.trustStore.type"));

clusterEnvironmentBuilder.securityConfig().enableTls(true).trustStore(FileSystems.getDefault().getPath(sslTrustStoreFile), sslTrustStorePin, sslTrustStoreType);
SecurityConfig.Builder securityConfigBuilder = clusterEnvironmentBuilder.securityConfig();

boolean enableTLS = Boolean.valueOf(couchbaseConnectionProperties.getProperty("tls.enable")).booleanValue();
if (enableTLS) {
securityConfigBuilder.enableTls(enableTLS);
}

securityConfigBuilder.trustStore(FileSystems.getDefault().getPath(sslTrustStoreFile), sslTrustStorePin, sslTrustStoreType);
LOG.info("Configuring builder to enable SSL support");
} else {
clusterEnvironmentBuilder.securityConfig().enableTls(false);
Expand Down

0 comments on commit 8ec5dd3

Please sign in to comment.