add md5 of password to log file

This commit is contained in:
Adrian Cole 2011-12-20 23:19:39 -08:00
parent e1c813d82c
commit b8c6c73fe8
2 changed files with 7 additions and 3 deletions

View File

@ -25,6 +25,8 @@ import static com.google.common.base.Predicates.instanceOf;
import static com.google.common.base.Predicates.or; import static com.google.common.base.Predicates.or;
import static com.google.common.base.Throwables.getCausalChain; import static com.google.common.base.Throwables.getCausalChain;
import static com.google.common.collect.Iterables.any; import static com.google.common.collect.Iterables.any;
import static org.jclouds.crypto.CryptoStreams.hex;
import static org.jclouds.crypto.CryptoStreams.md5;
import static org.jclouds.crypto.SshKeys.fingerprintPrivateKey; import static org.jclouds.crypto.SshKeys.fingerprintPrivateKey;
import static org.jclouds.crypto.SshKeys.sha1PrivateKey; import static org.jclouds.crypto.SshKeys.sha1PrivateKey;
@ -135,7 +137,7 @@ public class JschSshClient implements SshClient {
this.password = password; this.password = password;
this.privateKey = privateKey; this.privateKey = privateKey;
if (privateKey == null) { if (privateKey == null) {
this.toString = String.format("%s:password@%s:%d", username, host, port); this.toString = String.format("%s:pw[%s]@%s:%d", username, hex(md5(password.getBytes())), host, port);
} else { } else {
String fingerPrint = fingerprintPrivateKey(new String(privateKey)); String fingerPrint = fingerprintPrivateKey(new String(privateKey));
String sha1 = sha1PrivateKey(new String(privateKey)); String sha1 = sha1PrivateKey(new String(privateKey));

View File

@ -25,6 +25,8 @@ import static com.google.common.base.Predicates.instanceOf;
import static com.google.common.base.Predicates.or; import static com.google.common.base.Predicates.or;
import static com.google.common.base.Throwables.getCausalChain; import static com.google.common.base.Throwables.getCausalChain;
import static com.google.common.collect.Iterables.any; import static com.google.common.collect.Iterables.any;
import static org.jclouds.crypto.CryptoStreams.hex;
import static org.jclouds.crypto.CryptoStreams.md5;
import static org.jclouds.crypto.SshKeys.fingerprintPrivateKey; import static org.jclouds.crypto.SshKeys.fingerprintPrivateKey;
import static org.jclouds.crypto.SshKeys.sha1PrivateKey; import static org.jclouds.crypto.SshKeys.sha1PrivateKey;
@ -146,7 +148,7 @@ public class SshjSshClient implements SshClient {
this.password = password; this.password = password;
this.privateKey = privateKey; this.privateKey = privateKey;
if (privateKey == null) { if (privateKey == null) {
this.toString = String.format("%s:password@%s:%d", username, host, port); this.toString = String.format("%s:pw[%s]@%s:%d", username, hex(md5(password.getBytes())), host, port);
} else { } else {
String fingerPrint = fingerprintPrivateKey(new String(privateKey)); String fingerPrint = fingerprintPrivateKey(new String(privateKey));
String sha1 = sha1PrivateKey(new String(privateKey)); String sha1 = sha1PrivateKey(new String(privateKey));