You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@guacamole.apache.org by flittermice <fl...@gmx.at> on 2017/11/22 23:54:17 UTC

SSH handshake failed: only RSA keys possible?

I'm using version 0.9.13. My goal was to make a SSH connection to a host
using my existing ed25519 keys. But I permanently got "SSH handshake failed"
in guacd.

So I have spent many hours of searching for the reason. Finally it turned
out that it is only possible to use RSA keys:
1. ECDSA and Ed25519 private keys will not work because Guacamole won't be
able to recognize the key format.
2. I configured my server to send an Ed25519 host key. This was the reason
for the "SSH handshake failed" errors.

Switching back to RSA keys solved the problem for me.

Should this behaviour be documented? Or should the new key types be
implemented? 
Or am I missing something? 

Thanks!
Flittermice



--
Sent from: http://apache-guacamole-general-user-mailing-list.2363388.n4.nabble.com/

Re: SSH handshake failed: only RSA keys possible?

Posted by Nick Couchman <vn...@apache.org>.
On Sat, Dec 23, 2017 at 10:41 PM, NTMMFTS <ja...@gmail.com> wrote:

> It appears that libssh2 includes the aes256-cbc key exchange method
> supported
> by pfSense, so I modded the ssh.c code and let it compile during
> installation using hanaciamiento's guacamole install script
> (https://sourceforge.net/projects/guacamoleinstallscript/), but guacamole
> won't load at all afterwards.
>
> Here's the code and where I inserted it in ssh.c in the
> guac_common_ssh_create_session function:
>
>     /* Open SSH session */
>         // existing code
>
>         /* added preferred method for key exchange method supported by
> pfSense */
>         int returnval = libssh2_session_method_pref(session,
> LIBSSH2_METHOD_CRYPT_CS, "aes256-cbc");
>     if (returnval != 0) {
>         guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
>                 "Setting session preferred key exchange method to
> AES256-CBC
> failed.");
>         free(common_session);
>         close(fd);
>         return NULL;
>     }
>
>     /* Perform handshake */
>         // existing code
>

First, I don't think this should be necessary to get it working if libssh2
supports that crypt method.  I believe it will use any supported method
without having to set it as a preferred method, no?  That said, setting it
as preferred should not impede the connection, either, so this should be
fine.


>
> Anyone want to comment on this approach or try to get it working?
>

With guacd in debug mode (guacd -L debug), what messages do you see during
the SSH connection?  Also, when you say it "won't load at all with it
afterwards," what does this mean?  It segfaults?  Or guacd runs but the
connection doesn't start?  Or sometihng else?

-Nick

Re: SSH handshake failed: only RSA keys possible?

Posted by NTMMFTS <ja...@gmail.com>.
It appears that libssh2 includes the aes256-cbc key exchange method supported
by pfSense, so I modded the ssh.c code and let it compile during
installation using hanaciamiento's guacamole install script
(https://sourceforge.net/projects/guacamoleinstallscript/), but guacamole
won't load at all afterwards.

Here's the code and where I inserted it in ssh.c in the
guac_common_ssh_create_session function:

    /* Open SSH session */
	// existing code
			
	/* added preferred method for key exchange method supported by pfSense */
	int returnval = libssh2_session_method_pref(session,
LIBSSH2_METHOD_CRYPT_CS, "aes256-cbc");
    if (returnval != 0) {
        guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
                "Setting session preferred key exchange method to AES256-CBC
failed.");
        free(common_session);
        close(fd);
        return NULL;
    }
	
    /* Perform handshake */
	// existing code
	
Anyone want to comment on this approach or try to get it working?

Thanks!

Jay L 



--
Sent from: http://apache-guacamole-general-user-mailing-list.2363388.n4.nabble.com/

Re: SSH handshake failed: only RSA keys possible?

Posted by Nick Couchman <vn...@apache.org>.
On Thu, Nov 23, 2017 at 5:34 AM, flittermice <fl...@gmx.at> wrote:

> Hello Nick,
>
> thanks for the clarification! So libssl2 ist to blame - seems to be a
> little
> antiquated...
>

libssh2, not libssl2.  It hasn't been overly-active, but has seen some
development in the past year.  libssh, which is the other option, isn't
terribly active, either.  It has a more recent release, earlier this year.
I would not consider libssh2 antiquated, though - SSH as a protocol is
fairly stable and does not change frequently, so there isn't much reason
for there to be frequent development on client libraries.  Also, looks like
libssh2 might be preparing for a release - the git repo has bumped to 1.8.0
recently.

It looks like there are some requests out there in the libssh2 github repo
for support for some other key types.  They are fairly old in origin, but
are still be actively discussed.  Here's one example:

https://github.com/libssh2/libssh2/issues/39


>
> Thanks for the proposal to add some documentation.
> I would suggest the description of the parameter "private-key":
> - a reference to libssl2
> - Maybe you could also write that the private key has to be pasted as text.
> Many people believe that a filename has to be given.
>
>
I will take a look and see about putting some of that language in there.  I
think the proper place for libssh2 references would actually be higher up
in the ssh section, as it impacts not only host keys but also supported
ciphers, key exchange methods, and hashes.

-Nick

Re: SSH handshake failed: only RSA keys possible?

Posted by flittermice <fl...@gmx.at>.
Hello Nick,

thanks for the clarification! So libssl2 ist to blame - seems to be a little
antiquated...

Thanks for the proposal to add some documentation. 
I would suggest the description of the parameter "private-key":
- a reference to libssl2
- Maybe you could also write that the private key has to be pasted as text.
Many people believe that a filename has to be given.

TIA,
Flittermice



--
Sent from: http://apache-guacamole-general-user-mailing-list.2363388.n4.nabble.com/

Re: SSH handshake failed: only RSA keys possible?

Posted by Nick Couchman <vn...@apache.org>.
On Wed, Nov 22, 2017 at 6:54 PM, flittermice <fl...@gmx.at> wrote:

> I'm using version 0.9.13. My goal was to make a SSH connection to a host
> using my existing ed25519 keys. But I permanently got "SSH handshake
> failed"
> in guacd.
>
> So I have spent many hours of searching for the reason. Finally it turned
> out that it is only possible to use RSA keys:
> 1. ECDSA and Ed25519 private keys will not work because Guacamole won't be
> able to recognize the key format.
> 2. I configured my server to send an Ed25519 host key. This was the reason
> for the "SSH handshake failed" errors.
>
> Switching back to RSA keys solved the problem for me.
>
> Should this behaviour be documented? Or should the new key types be
> implemented?
> Or am I missing something?
>

Guacamole server (guacd) uses libssh2 for all of the SSH functionality, so
Guacamole supports whatever libssh2 support for host keys and ciphers.  The
following web page has a list of the host keys and ciphers supported by
libssh2:

https://www.libssh2.org/libssh2-vs-libssh.html

It looks like libssh2 only supports ssh-rsa and ssh-dss, and does not
support the ones you are looking for (ssh-ed* and ecdsa-*).

I'm open to brushing up the documentation with some information that at
least points people to the correct place to determine the supported host
keys and ciphers.

-Nick