Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings: Reimplement keystore format to use FIPS compliant algorithms #28255

Merged
merged 4 commits into from
Jan 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -811,8 +811,8 @@ private void createKeystoreIfNeeded(Terminal terminal, Environment env, PluginIn
KeyStoreWrapper keystore = KeyStoreWrapper.load(env.configFile());
if (keystore == null) {
terminal.println("Elasticsearch keystore is required by plugin [" + info.getName() + "], creating...");
keystore = KeyStoreWrapper.create(new char[0]);
keystore.save(env.configFile());
keystore = KeyStoreWrapper.create();
keystore.save(env.configFile(), new char[0]);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1138,8 +1138,8 @@ public void testKeystoreNotRequired() throws Exception {

public void testKeystoreRequiredAlreadyExists() throws Exception {
Tuple<Path, Environment> env = createEnv(fs, temp);
KeyStoreWrapper keystore = KeyStoreWrapper.create(new char[0]);
keystore.save(env.v2().configFile());
KeyStoreWrapper keystore = KeyStoreWrapper.create();
keystore.save(env.v2().configFile(), new char[0]);
byte[] expectedBytes = Files.readAllBytes(KeyStoreWrapper.keystorePath(env.v2().configFile()));
Path pluginDir = createPluginDir(temp);
String pluginZip = createPluginUrl("fake", pluginDir, "requires.keystore", "true");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ static SecureSettings loadSecureSettings(Environment initialEnv) throws Bootstra

try {
keystore.decrypt(new char[0] /* TODO: read password from stdin */);
KeyStoreWrapper.upgrade(keystore, initialEnv.configFile());
KeyStoreWrapper.upgrade(keystore, initialEnv.configFile(), new char[0]);
} catch (Exception e) {
throw new BootstrapException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ protected void execute(Terminal terminal, OptionSet options, Environment env) th
terminal.println("Exiting without creating keystore.");
return;
}
keystore = KeyStoreWrapper.create(new char[0] /* always use empty passphrase for auto created keystore */);
keystore.save(env.configFile());
keystore = KeyStoreWrapper.create();
keystore.save(env.configFile(), new char[0] /* always use empty passphrase for auto created keystore */);
terminal.println("Created elasticsearch keystore in " + env.configFile());
} else {
keystore.decrypt(new char[0] /* TODO: prompt for password when they are supported */);
Expand Down Expand Up @@ -97,7 +97,7 @@ protected void execute(Terminal terminal, OptionSet options, Environment env) th
String.join(", ", argumentValues.subList(2, argumentValues.size())) + "] after filepath");
}
keystore.setFile(setting, Files.readAllBytes(file));
keystore.save(env.configFile());
keystore.save(env.configFile(), new char[0]);
}

@SuppressForbidden(reason="file arg for cli")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ protected void execute(Terminal terminal, OptionSet options, Environment env) th
terminal.println("Exiting without creating keystore.");
return;
}
keystore = KeyStoreWrapper.create(new char[0] /* always use empty passphrase for auto created keystore */);
keystore.save(env.configFile());
keystore = KeyStoreWrapper.create();
keystore.save(env.configFile(), new char[0] /* always use empty passphrase for auto created keystore */);
terminal.println("Created elasticsearch keystore in " + env.configFile());
} else {
keystore.decrypt(new char[0] /* TODO: prompt for password when they are supported */);
Expand Down Expand Up @@ -94,6 +94,6 @@ protected void execute(Terminal terminal, OptionSet options, Environment env) th
} catch (IllegalArgumentException e) {
throw new UserException(ExitCodes.DATA_ERROR, "String value must contain only ASCII");
}
keystore.save(env.configFile());
keystore.save(env.configFile(), new char[0]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ protected void execute(Terminal terminal, OptionSet options, Environment env) th
throw new UserException(ExitCodes.DATA_ERROR, "Passphrases are not equal, exiting.");
}*/

KeyStoreWrapper keystore = KeyStoreWrapper.create(password);
keystore.save(env.configFile());
KeyStoreWrapper keystore = KeyStoreWrapper.create();
keystore.save(env.configFile(), password);
terminal.println("Created elasticsearch keystore in " + env.configFile());
}
}
Loading