-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
CALCITE-5671: Add Option to Disable SSL Certificate Validation to ElasticSearch Adapter #3174
Conversation
@jnturton FYSA |
...h/src/main/java/org/apache/calcite/adapter/elasticsearch/UnsafeX509ExtendedTrustManager.java
Fixed
Show fixed
Hide fixed
...h/src/main/java/org/apache/calcite/adapter/elasticsearch/UnsafeX509ExtendedTrustManager.java
Fixed
Show fixed
Hide fixed
...earch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchSchemaFactory.java
Fixed
Show resolved
Hide resolved
...h/src/main/java/org/apache/calcite/adapter/elasticsearch/UnsafeX509ExtendedTrustManager.java
Fixed
Show fixed
Hide fixed
...h/src/main/java/org/apache/calcite/adapter/elasticsearch/UnsafeX509ExtendedTrustManager.java
Fixed
Show fixed
Hide fixed
...h/src/main/java/org/apache/calcite/adapter/elasticsearch/UnsafeX509ExtendedTrustManager.java
Fixed
Show fixed
Hide fixed
...h/src/main/java/org/apache/calcite/adapter/elasticsearch/UnsafeX509ExtendedTrustManager.java
Fixed
Show fixed
Hide fixed
...h/src/main/java/org/apache/calcite/adapter/elasticsearch/UnsafeX509ExtendedTrustManager.java
Fixed
Show fixed
Hide fixed
...h/src/main/java/org/apache/calcite/adapter/elasticsearch/UnsafeX509ExtendedTrustManager.java
Fixed
Show fixed
Hide fixed
...h/src/main/java/org/apache/calcite/adapter/elasticsearch/UnsafeX509ExtendedTrustManager.java
Fixed
Show fixed
Hide fixed
...h/src/main/java/org/apache/calcite/adapter/elasticsearch/UnsafeX509ExtendedTrustManager.java
Fixed
Show fixed
Hide fixed
...h/src/main/java/org/apache/calcite/adapter/elasticsearch/UnsafeX509ExtendedTrustManager.java
Fixed
Show fixed
Hide fixed
...h/src/main/java/org/apache/calcite/adapter/elasticsearch/UnsafeX509ExtendedTrustManager.java
Fixed
Show fixed
Hide fixed
...earch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchSchemaFactory.java
Outdated
Show resolved
Hide resolved
looks good overall, could you actually try to come up with some test? |
...h/src/main/java/org/apache/calcite/adapter/elasticsearch/UnsafeX509ExtendedTrustManager.java
Outdated
Show resolved
Hide resolved
...h/src/main/java/org/apache/calcite/adapter/elasticsearch/UnsafeX509ExtendedTrustManager.java
Outdated
Show resolved
Hide resolved
...h/src/main/java/org/apache/calcite/adapter/elasticsearch/UnsafeX509ExtendedTrustManager.java
Outdated
Show resolved
Hide resolved
...earch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchSchemaFactory.java
Show resolved
Hide resolved
For future reference I believe you can run the gradle target "autostyleApply" to hopefully avoid having to manually fix some of the linting errors. Hope this helps! |
Thanks @tanclary Still getting used to Calcite and gradle. |
bc9620f
to
321a77f
Compare
@libenchao @zinking |
This sounds great! +1 for merging. |
* used in production environments. | ||
*/ | ||
@SuppressWarnings("java:S4830") | ||
public final class UnsafeX509ExtendedTrustManager extends X509ExtendedTrustManager { |
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.
I don't know the Calcite code layout well but this trust manager is a generic utility that could easily be useful to other adapters so I'd personally look for a utils package to put it into.
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.
I was thinking the same thing, but I wasn't sure where to put it. If anyone has any suggestions, I'm all ears.
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.
@cgivre there is an org.apache.calcite.util package in the core module that looks like it would work.
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.
@jnturton Good call. Done!
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.
I don't have a strong preference of this, currently it seems that only ES Adapter needs this, and I'm not sure if there will be more adapters that need this, so putting it in the util of core seems a little over-designed for me, we may could defer it to the next time that another adapter calls for it. (Please note that calcite is highly customizable, and calcite-core is widely used for many projects, it's not only used by calcite adapters)
Of course if somebody strongly supports this, and I'm fine with it. Then the class comment for UnsafeX509ExtendedTrustManager
should be adapted to not only mention about ES.
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.
@libenchao Thanks for the comment. I updated the comment to reflect that this could be used for any calcite adapter that makes http calls.
...earch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchSchemaFactory.java
Show resolved
Hide resolved
...earch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchSchemaFactory.java
Show resolved
Hide resolved
@libenchao Thanks for the review. This is my first contribution to Calcite, so is there anything left for me to do to get this merged? |
1ec0245
to
a8fc0ad
Compare
Kudos, SonarCloud Quality Gate passed! |
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.
@cgivre Thanks for the PR, it looks good to me now, merging!
@libenchao Thanks for the review! |
@libenchao Will this get merged? I saw the PR was closed. Thanks! |
@cgivre This has been merged in dd8fa24, you can see it in git history: https://github.com/apache/calcite/commits |
Thx! |
For many development (and sometimes production) instances of ElasticSearch, the instance is configured using a self-signed SSL certificate or otherwise cannot be validated.
This PR adds a configuration option
disableSSLVerification
which, when set totrue
, disables SSL verification. The default behavior is not changed.