lucakovacs commented on code in PR #8681:
URL: https://github.com/apache/hbase/pull/8681#discussion_r4270529938
##########
hbase-common/src/main/java/org/apache/hadoop/hbase/io/crypto/tls/X509Util.java:
##########
@@ -422,20 +561,52 @@ private static String[] getCipherSuites(Configuration
config) {
}
/**
- * Enable certificate file reloading by creating FileWatchers for keystore
and truststore.
- * AtomicReferences will be set with the new instances. resetContext - if
not null - will be
- * called when the file has been modified.
+ * Enable certificate file reloading for the RPC <em>client</em> side by
creating FileWatchers for
+ * the keystore and truststore whose paths are resolved by {@link
Role#CLIENT} (role-scoped keys
+ * first, legacy keys as fallback). AtomicReferences will be set with the
new instances.
+ * {@code resetContext} - if not null - will be called when the file has
been modified.
* @param keystoreWatcher Reference to keystoreFileWatcher.
* @param trustStoreWatcher Reference to truststoreFileWatcher.
* @param resetContext Callback for file changes.
*/
- public static void enableCertFileReloading(Configuration config,
+ public static void enableCertFileReloadingForClient(Configuration config,
AtomicReference<FileChangeWatcher> keystoreWatcher,
AtomicReference<FileChangeWatcher> trustStoreWatcher, Runnable
resetContext)
throws IOException {
- String keyStoreLocation = config.get(TLS_CONFIG_KEYSTORE_LOCATION, "");
+ enableCertFileReloading(config, Role.CLIENT, keystoreWatcher,
trustStoreWatcher, resetContext);
+ }
+
+ /**
+ * Enable certificate file reloading for the RPC <em>server</em> side. See
+ * {@link #enableCertFileReloadingForClient} for parameter semantics; the
only difference is that
+ * paths are resolved via the {@link Role#SERVER} role-scoped keys, falling
back to the legacy
+ * unscoped keys when unset.
+ */
+ public static void enableCertFileReloadingForServer(Configuration config,
+ AtomicReference<FileChangeWatcher> keystoreWatcher,
+ AtomicReference<FileChangeWatcher> trustStoreWatcher, Runnable
resetContext)
+ throws IOException {
+ enableCertFileReloading(config, Role.SERVER, keystoreWatcher,
trustStoreWatcher, resetContext);
+ }
+
+ private static void enableCertFileReloading(Configuration config, Role role,
+ AtomicReference<FileChangeWatcher> keystoreWatcher,
+ AtomicReference<FileChangeWatcher> trustStoreWatcher, Runnable
resetContext)
+ throws IOException {
+ String keyStoreLocation;
+ String trustStoreLocation;
+ if (role == Role.CLIENT) {
+ keyStoreLocation = resolveConfig(config,
TLS_CONFIG_CLIENT_KEYSTORE_LOCATION,
+ TLS_CONFIG_KEYSTORE_LOCATION, "");
+ trustStoreLocation = resolveConfig(config,
TLS_CONFIG_CLIENT_TRUSTSTORE_LOCATION,
+ TLS_CONFIG_TRUSTSTORE_LOCATION, "");
+ } else {
+ keyStoreLocation = resolveConfig(config,
TLS_CONFIG_SERVER_KEYSTORE_LOCATION,
+ TLS_CONFIG_KEYSTORE_LOCATION, "");
+ trustStoreLocation = resolveConfig(config,
TLS_CONFIG_SERVER_TRUSTSTORE_LOCATION,
+ TLS_CONFIG_TRUSTSTORE_LOCATION, "");
Review Comment:
@PDavid in the latest commit
[1f573d4](https://github.com/apache/hbase/pull/8681/changes/1f573d4c885056aad3163dd7f2768c9125eac4de)
I fixed this issue by using the `TLSStore.resolve()` methods.
By doing so, the `resolveConfig()` and `resolvePassword()` functions became
unused so I deleted them and all the related code with it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]