Alon Bar-Lev has posted comments on this change. Change subject: Wrap validation of fingerprint in each connect using EngineSSHClient ......................................................................
Patch Set 3: (5 inline comments) .................................................... File backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ssh/EngineSSHClient.java Line 20: */ Line 21: public class EngineSSHClient extends SSHClient { Line 22: Line 23: private static final Log log = LogFactory.getLog(EngineSSHDialog.class); Line 24: private VDS _vds; please keep line of space Line 25: /** Line 26: * Constructor. Line 27: */ Line 28: public EngineSSHClient() { Line 41: Line 42: public void setVds(VDS vds) { Line 43: _vds = vds; Line 44: setHost(_vds.getHostName(), _vds.getSSHPort()); Line 45: setUser(_vds.getSSHUsername()); please move the setUser and setHost to connect (if _vds != null) Line 46: } Line 47: Line 48: @Override Line 49: public void connect() throws Exception { Line 50: super.connect(); Line 51: if (_vds != null) { Line 52: String actual = getHostFingerprint(); Line 53: String expected = _vds.getSSHKeyFingerprint(); Line 54: if (!actual.equals(expected)) { I still expect the addition of the actual if no expected. Line 55: throw new GeneralSecurityException( Line 56: String.format( Line 57: "Invalid fingerprint %s, expected %s", Line 58: actual, .................................................... File backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ssh/EngineSSHDialog.java Line 17: Line 18: protected SSHClient _getSSHClient() { Line 19: EngineSSHClient client = new EngineSSHClient(); Line 20: client.setVds(_vds); Line 21: return (SSHClient) client; Why do you need the cast? Maybe it is better to add a method SSHDialog::getSSHClient() to allow direct interaction with this object. Line 22: } Line 23: Line 24: public void setVds(VDS vds) { Line 25: _vds = vds; Line 29: * Get host fingerprint. Line 30: * @return fingerprint. Line 31: */ Line 32: public String getHostFingerprint() throws IOException { Line 33: return ((EngineSSHClient) _client).getHostFingerprint(); why the space was added? Line 34: } Line 35: Line 36: /** Line 37: * Use default engine ssh key. -- To view, visit http://gerrit.ovirt.org/16126 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic01517a153406c8bafc672c20b0bf8686763a2f5 Gerrit-PatchSet: 3 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yaniv Bronhaim <ybron...@redhat.com> Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com> Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com> Gerrit-Reviewer: Yaniv Bronhaim <ybron...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches