I'm toying around with OpenSSH configs and poking at the Diffie-Hellman parameters. I'm using GDSSecurity's tool to check DH settings and this page to view other SSH settings.
For funsies, I removed all moduli smaller than 4096 bits from /etc/ssh/moduli
:
$ awk '{print $5}' /etc/ssh/moduli | sort | uniq
4095
6143
8191
I'd expect that the key-exchange should fail if the client accepts only 2048 bit or 3072 bit groups. Interestingly, it does fail in the latter case, but does not in the former, 2048 bit case.
KEX proposal client: diffie-hellman-group-exchange-sha256
KEX proposal server: [email protected],diffie-hellman-group-exchange-sha256
KEX algorithm chosen: diffie-hellman-group-exchange-sha256
KEX client group sizes: min = 2048, nbits = 2048, max = 2048
KEX server-chosen group size in bits: 2048
Warning: Permanently added 'test,x.x.x.x' (ED25519) to the list of known hosts.
KEX proposal client: diffie-hellman-group-exchange-sha256
KEX proposal server: [email protected],diffie-hellman-group-exchange-sha256
KEX algorithm chosen: diffie-hellman-group-exchange-sha256
KEX client group sizes: min = 3072, nbits = 3072, max = 3072
ssh_dispatch_run_fatal: Connection to x.x.x.x: DH GEX group out of range
The aforementioned site also claims a successful key exchange using a 2048 bit group.
I know too little about the details of neither the SSH protocol or OpenSSH to understand what's going on here. Does OpenSSH use a fallback parameter if no appropriate group is available from the moduli file?