-
Notifications
You must be signed in to change notification settings - Fork 3
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 support for TLS config, OAuth credentials and setup CP integration tests #201
Conversation
🎉 All Contributor License Agreements have been signed. Ready to merge. |
src/test/java/io/confluent/idesidecar/restapi/util/CPDemoTestEnvironment.java
Show resolved
Hide resolved
Resolves #125 #126 Adds preliminary support to allow Kafka and SR clients to use mTLS and OAuth 2.0 to authenticate for direct connections. These changes have been unit tested to verify the expected client configurations are generated. However, those expected configurations have NOT yet been tested against CCloud or CP via integration tests.
Resolves #125 #126 Adds preliminary support to allow Kafka and SR clients to use mTLS and OAuth 2.0 to authenticate for direct connections. These changes have been unit tested to verify the expected client configurations are generated. However, those expected configurations have NOT yet been tested against CCloud or CP via integration tests.
…s' into rohitsanj/int-test-cp # Conflicts: # src/generated/resources/openapi.yaml # src/main/java/io/confluent/idesidecar/restapi/credentials/MutualTLSCredentials.java
# Conflicts: # src/main/java/io/confluent/idesidecar/restapi/messageviewer/MessageViewerContext.java # src/main/java/io/confluent/idesidecar/restapi/proxy/ProxyContext.java
2146156
to
6bfc205
Compare
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.
Thanks, @rohitsanj. I took a quick first pass, and wanted to share these questions/suggestions sooner than later.
src/main/java/io/confluent/idesidecar/restapi/models/ConnectionSpec.java
Outdated
Show resolved
Hide resolved
src/main/java/io/confluent/idesidecar/restapi/models/ConnectionSpec.java
Outdated
Show resolved
Hide resolved
src/main/java/io/confluent/idesidecar/restapi/credentials/TLSConfig.java
Outdated
Show resolved
Hide resolved
src/main/java/io/confluent/idesidecar/restapi/credentials/TLSConfig.java
Outdated
Show resolved
Hide resolved
src/main/java/io/confluent/idesidecar/restapi/credentials/TLSConfig.java
Outdated
Show resolved
Hide resolved
src/main/java/io/confluent/idesidecar/restapi/credentials/Redactable.java
Outdated
Show resolved
Hide resolved
src/test/java/io/confluent/idesidecar/restapi/cache/ClientConfiguratorStaticTest.java
Outdated
Show resolved
Hide resolved
src/main/java/io/confluent/idesidecar/restapi/proxy/clusters/ClusterProxyContext.java
Show resolved
Hide resolved
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.
Some notes
src/main/java/io/confluent/idesidecar/restapi/proxy/ProxyHttpClient.java
Outdated
Show resolved
Hide resolved
src/main/java/io/confluent/idesidecar/restapi/proxy/ProxyRequestProcessor.java
Outdated
Show resolved
Hide resolved
...java/io/confluent/idesidecar/restapi/proxy/clusters/processors/ClusterStrategyProcessor.java
Outdated
Show resolved
Hide resolved
src/test/java/io/confluent/idesidecar/restapi/util/SidecarClient.java
Outdated
Show resolved
Hide resolved
src/test/java/io/confluent/idesidecar/restapi/util/cpdemo/Constants.java
Outdated
Show resolved
Hide resolved
src/main/java/io/confluent/idesidecar/restapi/clients/SchemaRegistryClients.java
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
src/main/java/io/confluent/idesidecar/restapi/proxy/ConnectionProcessor.java
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
Thanks for the updates, @rohitsanj! 🎉 I have a few questions and comments. Otherwise, your PR looks good to me. I feel you're very close to being able to merge it into main
.
src/main/java/io/confluent/idesidecar/restapi/clients/ClientConfigurator.java
Outdated
Show resolved
Hide resolved
src/main/java/io/confluent/idesidecar/restapi/connections/DirectConnectionState.java
Outdated
Show resolved
Hide resolved
src/main/java/io/confluent/idesidecar/restapi/credentials/TLSConfig.java
Show resolved
Hide resolved
src/test/java/io/confluent/idesidecar/restapi/kafkarest/RecordsV3ErrorsSuite.java
Show resolved
Hide resolved
src/test/java/io/confluent/idesidecar/restapi/kafkarest/RecordsV3WithoutSRSuite.java
Outdated
Show resolved
Hide resolved
src/test/java/io/confluent/idesidecar/restapi/resources/ConnectionsResourceTest.java
Outdated
Show resolved
Hide resolved
src/test/java/io/confluent/idesidecar/restapi/resources/ConnectionsResourceTest.java
Outdated
Show resolved
Hide resolved
.withDetail("Kafka cluster truststore path is required and may not be blank") | ||
), | ||
new TestInput( | ||
"Direct spec is invalid with SSL having keystore only", |
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.
Can't we rely on the built-in/system certs in the absence of the truststore?
AFAIK, that's how you'd use mTLS with, for instance, Confluent Cloud.
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.
Sounds good -- I'd imagine the built-in/system certs will be picked up automatically by the Java runtime without us having to configure anything.
Or would we need to use the stored Preferences
to add any tls_pem_paths
to the trust store?
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 should definitely test if that works with the native executable.
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.
Sounds good -- I've already created #235 for supporting mTLS against Confluent Cloud, so testing would be taken care of as well.
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.
For now, I've changed the constraints to allow passing keystore options without truststore.
@flippingbits Thanks so much for the review! I've made some updates based on our offline conversation. |
Seems there's quite a few branches in the ConnectionSpec validation logic that have not been covered with tests. Given how large this PR has gotten, we can add tests in a follow up PR -- #241 |
This comment has been minimized.
This comment has been minimized.
The two bugs reported by Sonarqube were false positives and I've resolved them with comments. |
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.
Thanks for the update, @rohitsanj! This looks great. I have two more very minor comments. Otherwise, your PR looks good to me.
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.
Thanks for the great work, @rohitsanj! LGTM, pending the results of the CI pipeline.
This comment has been minimized.
This comment has been minimized.
For those following: @rhauch is fine with us merging this. |
Summary of Changes
ssl
underConnectionSpec.KafkaClusterConfig
as well asConnectionSpec.SchemaRegistryConfig
. Thessl
config may be set along with any credentials type (basic, apikey/secret, oauth) and can even be set in the absence of creds.ssl
holds all configs related to TLS. (h/t @flippingbits for this section)keystore
, a truststore via the fieldtruststore
, and allows to disable hostname verification via the boolean fieldverify_hostname
.ssl
is set to null, the sidecar uses an encrypted channel to interact with the Kafka cluster, verifies the hostname, and does not take any custom keystore/truststore into account.Any additional details or context that should be provided?
Follow up items:
MutualTLSCredentials
starting with a single field such asderived
that is always set totrue
. The SSL configuration for mTLS will still need to be passed in thekafka_cluster.ssl
(orschema_registry.ssl
) object. -- AddMutualTLSCredentials
as a placeholder Credentials type #237Fix pom.xml configuration to ensure we run integration tests just once, not twice.(Fixed in Fix coverage reporting and push to Sonarqube #224)CPDemoTestEnvironment
to use KRaft instead of to-be-deprecated ZK #239Pull request checklist
Please check if your PR fulfills the following (if applicable):