From cdbc37ce09747dc1273b7f080065fd7cf2a64f1d Mon Sep 17 00:00:00 2001 From: David O'Sullivan Date: Wed, 5 Apr 2023 11:52:11 +0100 Subject: [PATCH] Disables watching the private key file for updates --- .../security/FileWatchingX509ExtendedKeyManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/cloudfoundry/security/FileWatchingX509ExtendedKeyManager.java b/src/main/java/org/cloudfoundry/security/FileWatchingX509ExtendedKeyManager.java index b931975..9fba576 100644 --- a/src/main/java/org/cloudfoundry/security/FileWatchingX509ExtendedKeyManager.java +++ b/src/main/java/org/cloudfoundry/security/FileWatchingX509ExtendedKeyManager.java @@ -55,7 +55,8 @@ final class FileWatchingX509ExtendedKeyManager extends X509ExtendedKeyManager { this.keyManagerFactory = keyManagerFactory; new FileWatcher(this.certificates, new FileWatcherCallback()).watch(); - new FileWatcher(this.privateKey, new FileWatcherCallback()).watch(); + // disable watching the key file to prevent race condition bug - a certificate file change covers the key change + // new FileWatcher(this.privateKey, new FileWatcherCallback()).watch(); if (this.keyManager.compareAndSet(null, getKeyManager(getKeyStore()))) { this.logger.info(String.format("Initialized KeyManager for %s and %s", this.privateKey, this.certificates));