Skip to content

druid-pac4j: add ability to use custom ssl trust store while talking to auth server#9637

Merged
himanshug merged 2 commits intoapache:masterfrom
himanshug:pac4j_ssl
Apr 11, 2020
Merged

druid-pac4j: add ability to use custom ssl trust store while talking to auth server#9637
himanshug merged 2 commits intoapache:masterfrom
himanshug:pac4j_ssl

Conversation

@himanshug
Copy link
Copy Markdown
Contributor

@himanshug himanshug commented Apr 7, 2020

Description

This feature is to enable users who use non-standard or self signed SSL certs on the auth server. Similar feature exists in other Druid features communicating with external LDAP server for example.
It was initially highlighted in #8992 (comment)


This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths.
  • added integration tests.
  • been tested in a test Druid cluster.

@himanshug himanshug added the WIP label Apr 7, 2020
@himanshug himanshug force-pushed the pac4j_ssl branch 3 times, most recently from 4bf64e1 to bbd4953 Compare April 8, 2020 08:19
@himanshug himanshug changed the title [WIP]druid-pac4j: add ability for custom ssl trust store for talking to auth druid-pac4j: add ability to use custom ssl trust store while talking to auth server Apr 8, 2020
@himanshug himanshug added this to the 0.18.0 milestone Apr 8, 2020
@himanshug himanshug mentioned this pull request Apr 10, 2020
|--------|---------------|-----------|-------|--------|
|`druid.auth.pac4j.cookiePassphrase`|passphrase for encrypting the cookies used to manage authentication session with browser. It can be provided as plaintext string or The [Password Provider](../../operations/password-provider.md).|none|Yes|
|`druid.auth.pac4j.readTimeout`|Socket connect and read timeout duration used when communicating with authentication server|PT5S|No|
|`druid.auth.pac4j.enableCustomSslContext`|Whether to use custom SSLContext setup via [simple-client-sslcontext](simple-client-sslcontext.md) extension which must be added to extensions list when this property is set to true.|false|No|
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think reusing simple-client-sslcontext is good for now since the client is the same entity (a Druid server); are there any potential cases where you'd want to use a different truststore or keystore when talking to the auth server here vs. another Druid server?

Copy link
Copy Markdown
Contributor Author

@himanshug himanshug Apr 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for looking, valid question.
I chose to go this route instead of adding separate config for a brand new ssl context to reduce amount of configuration user has. That said, I see that ldap doesn't use druid's common ssl context but builds one separately. I haven't personally seen the use cases for this separation yet but I am not a security expert and could be wrong :)

If we come across such use case, then I think we should add support for another SSLContext inside druid core code .. one for talking to external auth services (oauth server, ldap server etc) so that we don't repeat this thing for all auth extensions that happen to talk to external services.

Copy link
Copy Markdown
Contributor

@jon-wei jon-wei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had 1 minor comment, LGTM otherwise


/**
* This class exists only to enable use of custom SSLSocketFactory on top of builtin class. This could be removed
* when same functionality has been added to original class com.nimbusds.jose.util.CustomSSLResourceRetriever.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the original class in the comment should be com.nimbusds.jose.util.DefaultResourceRetriever.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duh! :)
Initially CustomSSLResourceRetriever was named DefaultResourceRetriever ... findbugs did not like that I was overriding a class of same name, so I did a "Refactor -> Rename" in IDE which, inadvertently, changed that in comment too.

updated.

@himanshug himanshug merged commit ca369e5 into apache:master Apr 11, 2020
himanshug added a commit to himanshug/druid that referenced this pull request Apr 11, 2020
…to auth server (apache#9637)

* druid-pac4j: add ability for custom ssl trust store for talking to auth
server

* fix nimbusds DefaultResourceRetriever name in comment
jihoonson pushed a commit that referenced this pull request Apr 11, 2020
…to auth server (#9637) (#9675)

* druid-pac4j: add ability for custom ssl trust store for talking to auth
server

* fix nimbusds DefaultResourceRetriever name in comment
JulianJaffePinterest pushed a commit to JulianJaffePinterest/druid that referenced this pull request Jun 12, 2020
…to auth server (apache#9637)

* druid-pac4j: add ability for custom ssl trust store for talking to auth
server

* fix nimbusds DefaultResourceRetriever name in comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants