vikaskr22 commented on code in PR #1359:
URL: https://github.com/apache/ranger/pull/1359#discussion_r4708324454
##########
security-admin/src/main/java/org/apache/ranger/biz/KmsKeyMgr.java:
##########
@@ -558,26 +569,37 @@ private void throwServiceNotFoundException(String
serviceName) {
private String[] getKMSURL(String name) throws Exception {
String[] providers;
+ String dbKmsUrl;
try {
RangerService rangerService = svcStore.getServiceByName(name);
- if (rangerService != null) {
- String kmsUrl =
rangerService.getConfigs().get(KMS_URL_CONFIG);
- String dbKmsUrl = kmsUrl;
+ if (rangerService == null) {
+ throw new Exception("Service " + name + " not found");
+ }
- if (providerList.containsKey(kmsUrl)) {
- kmsUrl = providerList.get(kmsUrl);
- } else {
- providerList.put(kmsUrl, kmsUrl);
- }
+ dbKmsUrl = rangerService.getConfigs().get(KMS_URL_CONFIG);
+ } catch (Exception excp) {
+ logger.error("getServiceByName({}) failed", name, excp);
- providers = createProvider(dbKmsUrl, kmsUrl);
+ throw new Exception("getServiceByName(" + name + ") failed", excp);
+ }
+
+ // Validate the saved provider before Ranger Admin connects to it
+ validateProviderUrl(name, dbKmsUrl);
Review Comment:
have we considered the performance impact it may have due to validation of
providerUrl for each outgoing request to KMS ?
Can't we add this validation logic at the place where we add/update the KMS
provider URL for the KMS service config instead of running validation for each
requests ?
--
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]