Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Connector support pulsar cluster with both JWT and TLS auth #543

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

asagjj
Copy link

@asagjj asagjj commented Apr 20, 2022

(If this PR fixes a github issue, please add Fixes #<xyz>.)

Motivation

when pulsar cluster start up with JWT auth and TLS for transport encryption. Connector cannot configure both authentication methods at the same time。

Modifications

I have provided a simple patch to fix this, add a config 'tls-trustcert-filepath' like 'auth-plugin'.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Documentation

related config key as below:

Catalog : catalog-tls-trustcerts-filepath
DDL: properties.tls-trustcerts-filepath

Check the box below.

Need to update docs?

@asagjj asagjj requested review from syhily, nlu90 and a team as code owners April 20, 2022 12:42
@github-actions
Copy link

@asagjj:Thanks for your contribution. For this PR, do we need to update docs?
(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

@github-actions github-actions bot added doc-info-missing This pr needs to mark a document option in description and removed doc-info-missing This pr needs to mark a document option in description labels Apr 20, 2022
@github-actions
Copy link

@asagjj:Thanks for providing doc info!

@github-actions github-actions bot added the doc-required This pr needs a document label Apr 20, 2022
@nlu90
Copy link
Contributor

nlu90 commented Apr 20, 2022

@asagjj Thanks for your contribution. Could you fix some failed workflow check.

@asagjj
Copy link
Author

asagjj commented Apr 22, 2022

@asagjj Thanks for your contribution. Could you fix some failed workflow check.

@nlu90 @syhily Would you please spare time to take a review?

nlu90
nlu90 previously approved these changes May 2, 2022
@nlu90 nlu90 added this to the 2022-05 milestone May 2, 2022
@asagjj
Copy link
Author

asagjj commented May 17, 2022

@syhily Hi,please take a review.

@@ -62,6 +62,7 @@ public static ClientConfigurationData newClientConf(String serviceUrl, Propertie
clientConf.setAuthParams(properties.getProperty(PulsarOptions.AUTH_PARAMS_KEY));
clientConf.setAuthPluginClassName(
properties.getProperty(PulsarOptions.AUTH_PLUGIN_CLASSNAME_KEY));
clientConf.setTlsTrustCertsFilePath(PulsarOptions.TLS_TRUSTCERTS_FILEPATH);
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be a mistake? Have you tested on your local machine?

Copy link
Author

Choose a reason for hiding this comment

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

This could be a mistake? Have you tested on your local machine?

Sorry,I didn't catch your meaning. I had tested on our pulsar cluster. PS: our cluster is run with both token authentication and tls for transport encryption. If only config one auth-plugin, connector would get error.

@syhily syhily dismissed nlu90’s stale review June 1, 2022 02:35

This PR need extra code fix.

@@ -62,6 +62,7 @@ public static ClientConfigurationData newClientConf(String serviceUrl, Propertie
clientConf.setAuthParams(properties.getProperty(PulsarOptions.AUTH_PARAMS_KEY));
clientConf.setAuthPluginClassName(
properties.getProperty(PulsarOptions.AUTH_PLUGIN_CLASSNAME_KEY));
clientConf.setTlsTrustCertsFilePath(PulsarOptions.TLS_TRUSTCERTS_FILEPATH);
Copy link

Choose a reason for hiding this comment

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

The Pulsar client cannot support JWT authentication with TLS transport, which only provides the use of "AuthenticationTls" to set up TLS transport/authentication, this is a conflict with JWT authentication.

BTW, the trust certificate is a CA certificate, this is useless. Usually, we use mTLS, which requires a certificate and private key.

Copy link

Choose a reason for hiding this comment

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

Previously, I submitted apache/pulsar#15634 to improve this, welcome to review if you are interesting.

Copy link
Author

Choose a reason for hiding this comment

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

@nodece Yes, Our cluster scene is JWT for authentication and TLS for transport encryption.
And, tls requires a ca.cert.pem file.

Copy link

@nodece nodece Jun 13, 2022

Choose a reason for hiding this comment

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

Yes, if you do not use mTLS, this PR is right.

Copy link

Choose a reason for hiding this comment

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

Could you add a test for these changes?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
doc-required This pr needs a document
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants