pip/pip-351.md
In both Pulsar Client and Pulsar Admin, we support the use of KeyStores. This feature is provided by means of the boolean "useKeyStoreTls". The boolean is also the only way authentication mechanisms such as AuthenticationKeyStoreTls can be utilised properly, as the logic to use keystores for SSL Connections, from either ClientConfigurationData stored in Pulsar Admin/Client or AuthData hinges on the "useKeyStoreTls" boolean as can be seen below:
<b>AsyncHttpConnector.java</b>
if (conf.isUseKeyStoreTls()) {
KeyStoreParams params = authData.hasDataForTls() ? authData.getTlsKeyStoreParams() :
new KeyStoreParams(conf.getTlsKeyStoreType(), conf.getTlsKeyStorePath(),
conf.getTlsKeyStorePassword());
final SSLContext sslCtx = KeyStoreSSLContext.createClientSslContext(
conf.getSslProvider(),
params.getKeyStoreType(),
params.getKeyStorePath(),
params.getKeyStorePassword(),
conf.isTlsAllowInsecureConnection(),
conf.getTlsTrustStoreType(),
conf.getTlsTrustStorePath(),
conf.getTlsTrustStorePassword(),
conf.getTlsCiphers(),
conf.getTlsProtocols());
JsseSslEngineFactory sslEngineFactory = new JsseSslEngineFactory(sslCtx);
confBuilder.setSslEngineFactory(sslEngineFactory);
}
None of these options can be currently configured when using Pulsar Test client.
As we already let users both extend authentication and use just the keystore and truststore properties to set up mTLS connections, without using any authentication plugin class, a lot of them might want to use this method of authentication during Performance Testing as well.
I understand that currently mTLS (for testing purposes) can be achieved by using trust and client certificates. However, the issue of users extending authentication plugin classes and utilizing keystores is still not covered with the current options. Therefore, I propose we make these already existing options be configured in test clients, increasing its usability.
Create new Arguments for the following properties, in PerformanceBaseArguments.java :
Update the code to change between TrustCerts and TrustStore based on useKeyStoreTls.
<!-- What this PIP intend to achieve once It's integrated into Pulsar. Why does it benefit Pulsar. --> <!-- Describe what you have decided to keep out of scope, perhaps left for a different PIP/s. --> <!-- Describe the design of your solution in *high level*. Describe the solution end to end, from a birds-eye view. Don't go into implementation details in this section. I should be able to finish reading from beginning of the PIP to here (including) and understand the feature and how you intend to solve it, end to end. DON'T * Avoid code snippets, unless it's essential to explain your intent. -->Add the options for utilizing keystores as part of performance base arguments, along with forwarding their values to the client/admin builders.
All places we utilize Pulsar Test client, for example Pulsar-Perf will have the following new options:
The change will not affect any previous releases. The options can also be brought to previous versions, however, I have noticed that Pulsar has moved away from JCommander in Version 3.2.x to Picocli (currently in master) Therefore, to add these options to previous versions, the code has to be replicated to those versions.