Merge pull request elastic/elasticsearch#1701 from s1monw/fix_trust_store_loading

Watcher should try to load trust/keystore from `config` directory

Today Watcher tries to load stuff from the bin's parent directory which
is not readable since the shared data directory has been moved out of
the nodes parent in elasticsearchelastic/elasticsearch#17072 which causes security exception
now. The test copies trust stores into the config dir and that's where
we should read it from by default or even better explicitly configure the path?!

Original commit: elastic/x-pack-elasticsearch@6ad580d1ea
This commit is contained in:
Simon Willnauer 2016-03-15 11:10:53 +01:00
commit c7129e52ec
2 changed files with 5 additions and 3 deletions

View File

@ -67,7 +67,9 @@ public class CleanerService extends AbstractLifecycleComponent<CleanerService> {
@Override @Override
protected void doClose() { protected void doClose() {
logger.debug("closing cleaning service"); logger.debug("closing cleaning service");
if (runnable != null) {
runnable.cancel(); runnable.cancel();
}
logger.debug("cleaning service closed"); logger.debug("cleaning service closed");
} }

View File

@ -281,7 +281,7 @@ public class HttpClient extends AbstractLifecycleComponent<HttpClient> {
if (keyStore == null) { if (keyStore == null) {
return null; return null;
} }
Path path = env.binFile().getParent().resolve(keyStore); Path path = env.configFile().resolve(keyStore);
if (Files.notExists(path)) { if (Files.notExists(path)) {
return null; return null;
} }
@ -304,7 +304,7 @@ public class HttpClient extends AbstractLifecycleComponent<HttpClient> {
// Load TrustStore // Load TrustStore
KeyStore ks = null; KeyStore ks = null;
if (trustStore != null) { if (trustStore != null) {
Path trustStorePath = env.binFile().getParent().resolve(trustStore); Path trustStorePath = env.configFile().resolve(trustStore);
if (Files.exists(trustStorePath)) { if (Files.exists(trustStorePath)) {
ks = readKeystore(trustStorePath, trustStorePassword); ks = readKeystore(trustStorePath, trustStorePassword);
} }