-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement a mechanism to skip SSL verification #4083
Conversation
Image published at public.ecr.aws/provectus/kafka-ui-custom-build:4083 |
kafka-ui-api/src/main/java/com/provectus/kafka/ui/util/InsecureSslEngineFactory.java
Outdated
Show resolved
Hide resolved
kafka-ui-api/src/main/java/com/provectus/kafka/ui/util/InsecureSslEngineFactory.java
Outdated
Show resolved
Hide resolved
kafka-ui-api/src/main/java/com/provectus/kafka/ui/util/InsecureSslEngineFactory.java
Outdated
Show resolved
Hide resolved
if (truststoreConfig == null) { | ||
return; | ||
} | ||
|
||
if (!truststoreConfig.isVerifySsl()) { | ||
sink.put(SSL_ENGINE_FACTORY_CLASS_CONFIG, InsecureSslEngineFactory.class); | ||
return; | ||
} | ||
|
||
if (truststoreConfig.getTruststoreLocation() == null) { | ||
return; | ||
} | ||
|
||
sink.put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, truststoreConfig.getTruststoreLocation()); | ||
|
||
if (truststoreConfig.getTruststorePassword() != null) { | ||
sink.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, truststoreConfig.getTruststorePassword()); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets maybe avoid extensive spaces usage here
@@ -101,6 +109,16 @@ public static class SchemaRegistryAuth { | |||
public static class TruststoreConfig { | |||
String truststoreLocation; | |||
String truststorePassword; | |||
boolean verifySsl = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we also need to add property to kafka-ui-api.yaml
Image published at public.ecr.aws/provectus/kafka-ui-custom-build:4083 |
Image published at public.ecr.aws/provectus/kafka-ui-custom-build:4083 |
if (truststoreConfig.getTruststoreLocation() == null) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if verifySsl
set to false ? Looks like truststoreConfig.isVerifySsl() check should go before this..
@SneakyThrows | ||
public WebClientConfigurator configureNoSsl() { | ||
var contextBuilder = SslContextBuilder.forClient(); | ||
contextBuilder.trustManager(InsecureTrustManagerFactory.INSTANCE); | ||
|
||
SslContext context = contextBuilder.build(); | ||
|
||
httpClient = httpClient.secure(t -> t.sslContext(context)); | ||
return this; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls simplify
What changes did you make? (Give an overview)
Closes #4082
Is there anything you'd like reviewers to focus on?
How Has This Been Tested? (put an "x" (case-sensitive!) next to an item)
Checklist (put an "x" (case-sensitive!) next to all the items, otherwise the build will fail)
Check out Contributing and Code of Conduct
A picture of a cute animal (not mandatory but encouraged)