Skip to content

Conversation

@michaeljmarshall
Copy link
Member

Motivation

We support configuring KeyStores for the broker and the proxy, but not the WebSocket or the Function Worker. By adding this support, users are able to provide KeyStores of type PCKS12 or JKS, which adds flexibility. Further, these KeyStores simplify support for additional algorithms because we rely on the TLS provider to load the KeyStore instead of loading keys ourselves.

Modifications

  • Add KeyStoreSSLContexts to the function worker server
  • Add KeyStoreSSLContexts to the web socket server
  • Add configurations to the function worker, the web socket, and the proxy configuration files to simply configuration
  • Rely on toString, not ObjectMapper, when converting the WorkerConfig to a string so that we don't log the KeyStore password. (Add a test to verify this logic. Note that we don't want the ObjectMapper to ignore the field because we use mappers when converting configuration classes.)

Verifying this change

I manually verified that this change works in a minikube cluster. The underlying method named KeyStoreSSLContext#createSslContextFactory is already used and tested, so I don't believe we need additional testing on that component.

Does this pull request potentially affect one of the following parts:

This change adds a new way to configure TLS in the WebSocket and Function Worker HTTPS Servers. As such, it adds new configuration. This configuration is named in the same way that the broker and proxy configuration is named, so it is consistent.

Documentation

I've documented the new configuration in the appropriate configuration files.

@michaeljmarshall michaeljmarshall self-assigned this Apr 8, 2022
@github-actions
Copy link

github-actions bot commented Apr 8, 2022

@michaeljmarshall: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)

@michaeljmarshall michaeljmarshall added type/feature The PR added a new feature or issue requested a new feature area/function area/websocket area/security doc-not-needed Your PR changes do not impact docs and removed doc-label-missing labels Apr 8, 2022
@michaeljmarshall michaeljmarshall changed the title Add more keystore support Add KeyStore support in WebSocket, Function Worker HTTPS Servers Apr 8, 2022
Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

great

Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

Good work @michaeljmarshall

@michaeljmarshall
Copy link
Member Author

@nodece - you might be interested in this work, too. Note that using a KeyStore automatically supports additional algorithms, like ECDSA, for keys, and also adds support for loading many keys.

michaeljmarshall added a commit to datastax/pulsar that referenced this pull request Apr 8, 2022
+ "When using TLS authentication with CACert, the valid value is either OPENSSL or JDK.\n"
+ "When using TLS authentication with KeyStore, available values can be SunJSSE, Conscrypt and etc."
)
private String tlsProvider = null;
Copy link
Member

Choose a reason for hiding this comment

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

Update this doc like available values can be SunJSSE, Conscrypt and etc.

Copy link
Member

@nodece nodece left a comment

Choose a reason for hiding this comment

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

Thanks, this PR is great, I left my comments.

Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM

@michaeljmarshall michaeljmarshall force-pushed the add-more-keystore-support branch from 5fde6dd to e6570ee Compare April 12, 2022 15:35
@michaeljmarshall
Copy link
Member Author

Rebased to resolve conflicts. I didn't make any code changes.

@michaeljmarshall michaeljmarshall merged commit a410396 into apache:master Apr 21, 2022
@michaeljmarshall michaeljmarshall deleted the add-more-keystore-support branch April 21, 2022 03:25
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Apr 28, 2022
…che#15084)

* Add KeyStore support in WebSocket, Function Worker HTTPS Servers

* Avoid leaking worker config password

* Fix checkstyle

* Replace broker with appropriate text in annotations

* Update python script for new configs

Co-authored-by: Lari Hotari <lhotari@apache.org>

We support configuring KeyStores for the broker and the proxy, but not the WebSocket or the Function Worker. By adding this support, users are able to provide KeyStores of type PCKS12 or JKS, which adds flexibility. Further, these KeyStores simplify support for additional algorithms because we rely on the TLS provider to load the KeyStore instead of loading keys ourselves.

* Add `KeyStoreSSLContext`s to the function worker server
* Add `KeyStoreSSLContext`s to the web socket server
* Add configurations to the function worker, the web socket, and the proxy configuration files to simply configuration
* Rely on `toString`, not `ObjectMapper`, when converting the `WorkerConfig` to a string so that we don't log the KeyStore password. (Add a test to verify this logic. Note that we don't want the `ObjectMapper` to ignore the field because we use mappers when converting configuration classes.)

I manually verified that this change works in a minikube cluster. The underlying method named `KeyStoreSSLContext#createSslContextFactory` is already used and tested, so I don't believe we need additional testing on that component.

This change adds a new way to configure TLS in the WebSocket and Function Worker HTTPS Servers. As such, it adds new configuration. This configuration is named in the same way that the broker and proxy configuration is named, so it is consistent.

I've documented the new configuration in the appropriate configuration files.

(cherry picked from commit a410396)
codelipenghui pushed a commit that referenced this pull request May 5, 2022
)

* Add KeyStore support in WebSocket, Function Worker HTTPS Servers

* Avoid leaking worker config password

* Fix checkstyle

* Replace broker with appropriate text in annotations

* Update python script for new configs

Co-authored-by: Lari Hotari <lhotari@apache.org>

We support configuring KeyStores for the broker and the proxy, but not the WebSocket or the Function Worker. By adding this support, users are able to provide KeyStores of type PCKS12 or JKS, which adds flexibility. Further, these KeyStores simplify support for additional algorithms because we rely on the TLS provider to load the KeyStore instead of loading keys ourselves.

* Add `KeyStoreSSLContext`s to the function worker server
* Add `KeyStoreSSLContext`s to the web socket server
* Add configurations to the function worker, the web socket, and the proxy configuration files to simply configuration
* Rely on `toString`, not `ObjectMapper`, when converting the `WorkerConfig` to a string so that we don't log the KeyStore password. (Add a test to verify this logic. Note that we don't want the `ObjectMapper` to ignore the field because we use mappers when converting configuration classes.)

I manually verified that this change works in a minikube cluster. The underlying method named `KeyStoreSSLContext#createSslContextFactory` is already used and tested, so I don't believe we need additional testing on that component.

This change adds a new way to configure TLS in the WebSocket and Function Worker HTTPS Servers. As such, it adds new configuration. This configuration is named in the same way that the broker and proxy configuration is named, so it is consistent.

I've documented the new configuration in the appropriate configuration files.

(cherry picked from commit a410396)
@codelipenghui codelipenghui added this to the 2.11.0 milestone May 5, 2022
codelipenghui pushed a commit that referenced this pull request May 5, 2022
)

* Add KeyStore support in WebSocket, Function Worker HTTPS Servers

* Avoid leaking worker config password

* Fix checkstyle

* Replace broker with appropriate text in annotations

* Update python script for new configs

Co-authored-by: Lari Hotari <lhotari@apache.org>

We support configuring KeyStores for the broker and the proxy, but not the WebSocket or the Function Worker. By adding this support, users are able to provide KeyStores of type PCKS12 or JKS, which adds flexibility. Further, these KeyStores simplify support for additional algorithms because we rely on the TLS provider to load the KeyStore instead of loading keys ourselves.

* Add `KeyStoreSSLContext`s to the function worker server
* Add `KeyStoreSSLContext`s to the web socket server
* Add configurations to the function worker, the web socket, and the proxy configuration files to simply configuration
* Rely on `toString`, not `ObjectMapper`, when converting the `WorkerConfig` to a string so that we don't log the KeyStore password. (Add a test to verify this logic. Note that we don't want the `ObjectMapper` to ignore the field because we use mappers when converting configuration classes.)

I manually verified that this change works in a minikube cluster. The underlying method named `KeyStoreSSLContext#createSslContextFactory` is already used and tested, so I don't believe we need additional testing on that component.

This change adds a new way to configure TLS in the WebSocket and Function Worker HTTPS Servers. As such, it adds new configuration. This configuration is named in the same way that the broker and proxy configuration is named, so it is consistent.

I've documented the new configuration in the appropriate configuration files.

(cherry picked from commit a410396)
@codelipenghui codelipenghui added the cherry-picked/branch-2.9 Archived: 2.9 is end of life label May 5, 2022
codelipenghui pushed a commit that referenced this pull request May 20, 2022
)

* Add KeyStore support in WebSocket, Function Worker HTTPS Servers

* Avoid leaking worker config password

* Fix checkstyle

* Replace broker with appropriate text in annotations

* Update python script for new configs

Co-authored-by: Lari Hotari <lhotari@apache.org>

We support configuring KeyStores for the broker and the proxy, but not the WebSocket or the Function Worker. By adding this support, users are able to provide KeyStores of type PCKS12 or JKS, which adds flexibility. Further, these KeyStores simplify support for additional algorithms because we rely on the TLS provider to load the KeyStore instead of loading keys ourselves.

* Add `KeyStoreSSLContext`s to the function worker server
* Add `KeyStoreSSLContext`s to the web socket server
* Add configurations to the function worker, the web socket, and the proxy configuration files to simply configuration
* Rely on `toString`, not `ObjectMapper`, when converting the `WorkerConfig` to a string so that we don't log the KeyStore password. (Add a test to verify this logic. Note that we don't want the `ObjectMapper` to ignore the field because we use mappers when converting configuration classes.)

I manually verified that this change works in a minikube cluster. The underlying method named `KeyStoreSSLContext#createSslContextFactory` is already used and tested, so I don't believe we need additional testing on that component.

This change adds a new way to configure TLS in the WebSocket and Function Worker HTTPS Servers. As such, it adds new configuration. This configuration is named in the same way that the broker and proxy configuration is named, so it is consistent.

I've documented the new configuration in the appropriate configuration files.

(cherry picked from commit a410396)
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request May 23, 2022
…che#15084)

* Add KeyStore support in WebSocket, Function Worker HTTPS Servers

* Avoid leaking worker config password

* Fix checkstyle

* Replace broker with appropriate text in annotations

* Update python script for new configs

Co-authored-by: Lari Hotari <lhotari@apache.org>

We support configuring KeyStores for the broker and the proxy, but not the WebSocket or the Function Worker. By adding this support, users are able to provide KeyStores of type PCKS12 or JKS, which adds flexibility. Further, these KeyStores simplify support for additional algorithms because we rely on the TLS provider to load the KeyStore instead of loading keys ourselves.

* Add `KeyStoreSSLContext`s to the function worker server
* Add `KeyStoreSSLContext`s to the web socket server
* Add configurations to the function worker, the web socket, and the proxy configuration files to simply configuration
* Rely on `toString`, not `ObjectMapper`, when converting the `WorkerConfig` to a string so that we don't log the KeyStore password. (Add a test to verify this logic. Note that we don't want the `ObjectMapper` to ignore the field because we use mappers when converting configuration classes.)

I manually verified that this change works in a minikube cluster. The underlying method named `KeyStoreSSLContext#createSslContextFactory` is already used and tested, so I don't believe we need additional testing on that component.

This change adds a new way to configure TLS in the WebSocket and Function Worker HTTPS Servers. As such, it adds new configuration. This configuration is named in the same way that the broker and proxy configuration is named, so it is consistent.

I've documented the new configuration in the appropriate configuration files.

(cherry picked from commit a410396)
(cherry picked from commit e6b5ec9)
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Jun 1, 2022
…che#15084)

* Add KeyStore support in WebSocket, Function Worker HTTPS Servers

* Avoid leaking worker config password

* Fix checkstyle

* Replace broker with appropriate text in annotations

* Update python script for new configs

Co-authored-by: Lari Hotari <lhotari@apache.org>

We support configuring KeyStores for the broker and the proxy, but not the WebSocket or the Function Worker. By adding this support, users are able to provide KeyStores of type PCKS12 or JKS, which adds flexibility. Further, these KeyStores simplify support for additional algorithms because we rely on the TLS provider to load the KeyStore instead of loading keys ourselves.

* Add `KeyStoreSSLContext`s to the function worker server
* Add `KeyStoreSSLContext`s to the web socket server
* Add configurations to the function worker, the web socket, and the proxy configuration files to simply configuration
* Rely on `toString`, not `ObjectMapper`, when converting the `WorkerConfig` to a string so that we don't log the KeyStore password. (Add a test to verify this logic. Note that we don't want the `ObjectMapper` to ignore the field because we use mappers when converting configuration classes.)

I manually verified that this change works in a minikube cluster. The underlying method named `KeyStoreSSLContext#createSslContextFactory` is already used and tested, so I don't believe we need additional testing on that component.

This change adds a new way to configure TLS in the WebSocket and Function Worker HTTPS Servers. As such, it adds new configuration. This configuration is named in the same way that the broker and proxy configuration is named, so it is consistent.

I've documented the new configuration in the appropriate configuration files.

(cherry picked from commit a410396)
(cherry picked from commit 55d41be)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/function area/security area/websocket cherry-picked/branch-2.8 Archived: 2.8 is end of life cherry-picked/branch-2.9 Archived: 2.9 is end of life cherry-picked/branch-2.10 doc-not-needed Your PR changes do not impact docs release/2.8.4 release/2.9.3 release/2.10.1 type/feature The PR added a new feature or issue requested a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants