Skip to content

Commit a7e2dac

Browse files
Log password validation exceptions
1 parent 262b3e9 commit a7e2dac

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

x-pack/plugin/repository-encrypted/src/main/java/org/elasticsearch/repositories/encrypted/EncryptedRepository.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -824,20 +824,24 @@ boolean verify(String saltedHash) {
824824
Objects.requireNonNull(saltedHash);
825825
// first check if this exact hash has been checked before
826826
if (saltedHash.equals(lastVerifiedHash.get())) {
827+
logger.debug("The repository salted password hash [" + saltedHash + "] is locally cached as VALID");
827828
return true;
828829
}
829830
String[] parts = saltedHash.split(":");
831+
// the hash has an invalid format
830832
if (parts == null || parts.length != 2) {
831-
// the hash has an invalid format
833+
logger.error("Unrecognized format for the repository password hash [" + saltedHash + "]");
832834
return false;
833835
}
834836
String salt = parts[0];
837+
logger.debug("Computing repository password hash");
835838
String computedHash = computeSaltedPBKDF2Hash(Base64.getUrlDecoder().decode(salt.getBytes(StandardCharsets.UTF_8)), password);
836839
if (false == computedHash.equals(saltedHash)) {
837840
return false;
838841
}
839842
// remember last successfully verified hash
840843
lastVerifiedHash.set(computedHash);
844+
logger.debug("Repository password hash [" + saltedHash + "] validated successfully and is now locally cached");
841845
return true;
842846
}
843847

0 commit comments

Comments
 (0)