You are not logged in.

#1 2014-08-25 00:41:39

darkfoon
Member
Registered: 2007-08-29
Posts: 42

OpenSSH SSHD Ciphers, KEX and MACs ordering during negotiation

Looking at the man page for sshd_config I see the default list of algorithms for Ciphers, Key Exchange (KEX) and MACs.
In my set up, I have selected a subset of these algorithms for use (i.e. I don't want to allow old or weak algorithms).
What I want to know; which order are the algorithms negotiated?

I know the client and the server have to agree on which algorithm to use. But does the list need to be ordered from most preferred -> least preferred? Or The other way around?  The lists in the man page appear to be ordered first by algorithm group, with preferred groups first, but within each group, the algorithms seem to be ordered from least preferred to most.

Basically, my question boils down to, will the client and server negotiate the "strongest" algorithm they both support (where "strongest" is defined internally to OpenSSH), or will it pick the first/latest algorithm in both (server and client) supported algorithms lists?

How can I tell which algorithms are negotiated for a given connection?  I have run ssh with -v -v -v and I see a lot of spew from kex_parse_kexinit. But I can't tell which algorithm is settled upon from that spew.

Thanks

Offline

#2 2014-08-25 01:09:02

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,354

Re: OpenSSH SSHD Ciphers, KEX and MACs ordering during negotiation

I don't know the answer, but you might just try connecting from a client using -vvv and watch as the negotiation unfolds.  But, as I write this, it occurs that the client might choose which algorithm to try first.  OTOH, maybe the host offers a suggestion and the client says yes or no.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2014-08-25 01:48:03

darkfoon
Member
Registered: 2007-08-29
Posts: 42

Re: OpenSSH SSHD Ciphers, KEX and MACs ordering during negotiation

ssh -vvv user@host and ssh -v -v -v user@host produce the same debug output.

It's not particularly clear to me where the Key-exchange algorithm is negotiated.   I see logging that appears to be the negotiated MAC and Cipher, but I don't understand why those ciphers are chosen, instead of ones earlier in the list (both client and server are the same version of OpenSSH, so they should both support the same algorithms)

Offline

Board footer

Powered by FluxBB