vikaskr22 commented on code in PR #1188:
URL: https://github.com/apache/ranger/pull/1188#discussion_r3925889200
##########
embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbeddedServer.java:
##########
@@ -200,6 +206,32 @@ public void start() {
ssl.setAttribute("keystorePass", keystorePass);
ssl.setAttribute("keystoreFile", keystoreFile);
+ // Resolve TrustStore & related properties
+ String truststoreCredsAlias =
EmbeddedServerUtil.getConfig("ranger.service.https.attrib.truststore.credential.alias");
+ String truststorePass = null;
+
+ if (providerPath != null && truststoreCredsAlias != null) {
+ truststorePass =
CredentialReader.getDecryptedString(providerPath.trim(),
truststoreCredsAlias.trim(),
EmbeddedServerUtil.getConfig("ranger.truststore.file.type",
RANGER_TRUSTSTORE_FILE_TYPE_DEFAULT));
+ }
+
+ if (StringUtils.isBlank(truststorePass) ||
"none".equalsIgnoreCase(truststorePass.trim())) {
+ truststorePass =
EmbeddedServerUtil.getConfig("ranger.service.https.attrib.truststore.pass");
+ }
+
+ String trustStoreFile =
EmbeddedServerUtil.getConfig("ranger.service.https.attrib.truststore.file");
+
+ if (StringUtils.isNotBlank(trustStoreFile) &&
StringUtils.isNotBlank(truststorePass)) {
+ validationError = validateHttpsTruststore(trustStoreFile,
truststorePass, truststoreType);
+
+ if (validationError != null) {
+ LOG.warning("HTTPS configuration validation for trustStore
failed: " + validationError + " TLS handshaking may fail if mTLS is enabled.");
+ }
+ ssl.setAttribute("truststorePass", truststorePass);
Review Comment:
@pradeepagrawal8184 , this is the same pattern that we use for keystore. We
validate and log but proceed further. I believe idea is to not block the user
from using any keystore/truststore .
For example: For trustStore verification, we check the trustStore size, it
should not be zero. Similarly we check if it contains any
TrustedCertificateEntry. Without this, trustStore is still valid, though
empty. And the communication without mTLS will continue to work. That's why i
am simply logging at warn.
--
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]