use of net.schmizz.sshj.transport.verification.PromiscuousVerifier in project vcell by virtualcell.
the class SimDataConnection method createSSHClient.
private static SSHClient createSSHClient(String host, String user, String password) throws Exception {
SSHClient sshClient = null;
try {
sshClient = new SSHClient();
// !!! only use the PromiscuousVerifier if the VMs you are connecting to are known and trusted !!!
sshClient.addHostKeyVerifier(new PromiscuousVerifier());
sshClient.connect(host);
sshClient.authPassword(user, password);
return sshClient;
} catch (Exception e) {
if (sshClient != null) {
try {
sshClient.disconnect();
} catch (Exception e2) {
e.printStackTrace();
}
}
throw e;
}
}
Aggregations