Hi, thanks for the information, Aris. I checked out the git master and created a simple patch against it to make it possible via ssh_options_set(). I tested it and it works. Could this feature be included upstream in libssh? The patch is attached.
Regards, Oliver On Sat, Jun 23, 2012 at 3:13 PM, Aris Adamantiadis <[email protected]>wrote: > Hello, > > It was possible to do so in runtime with the old interface > priv.h:int ssh_options_set_algo(ssh_session session, int algo, const > char *list); > > However this function call is unfortunately private. If you include > priv.h, you will be able to user > ssh_options_set_algo(session, SSH_HOSTKEYS, "ssh-dss"); > ssh_options_set_algo(session, SSH_KEX,"diffie-hellman-group1-sha1"); > > However we can't guarantee that this will work in future versions of > libssh. If you wish to make it a feature of libssh, it is quite simple > to add this case to the ssh_options_set() function. > > Kr, > > Aris > > Le 21/06/12 14:20, Oliver Gasser a écrit : > > Hello, > > > > is it possible to specify the host key preference when connecting to a > > server? > > > > In kex.c there is > > > > #ifdef HAVE_ECDH > > #define KEY_EXCHANGE "ecdh-sha2-nistp256,diffie-hellman-group1-sha1" > > #define HOSTKEYS "ecdsa-sha2-nistp256,ssh-rsa,ssh-dss" > > #else > > #define KEY_EXCHANGE "diffie-hellman-group1-sha1" > > #define HOSTKEYS "ssh-rsa,ssh-dss" > > #endif > > > > so they seem to be predefined. Is that correct? And if yes, is it > > possible to circumvent this and specify your own host-key preference > > dynamically? > > > > Regards, > > Oliver Gasser > > > > >
fix_host_keys_string.patch
Description: Binary data
