in infrastructure/src/main/java/org/apache/geode/infrastructure/aws/KeyInstaller.java [52:67]
private void installKey(String host) {
try (SSHClient client = new SSHClient(CONFIG)) {
client.addHostKeyVerifier(new PromiscuousVerifier());
connect(host, client);
client.authPublickey(user, privateKey.toFile().getAbsolutePath());
SFTPClient sftpClient = client.newSFTPClient();
String dest = "/home/" + user + "/.ssh/id_rsa";
sftpClient.put(new FileSystemFile(privateKey.toFile()), dest);
sftpClient.setattr(dest, new FileAttributes.Builder()
.withPermissions(Collections.singleton(FilePermission.USR_R)).build());
} catch (IOException e) {
throw new UncheckedIOException(e);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}