2

Errors message in Terminal are (switch 1st, router 2nd):

MacMini:/ MacAdmin$ ssh [email protected] #Switch
Unable to negotiate with 192.168.3.2 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1

MacMini:/ MacAdmin$ ssh [email protected] #Router
Unable to negotiate with 192.168.3.1 port 22: no matching key exchange method
found. Their offer: [email protected],diffie-hellman-group-exchange-sha256

UPDATE 1:
Using Pete's suggestion below, I receive this error about "no matching MAC found"

MacMini:/ MacAdmin$ ssh -oKexAlgorithms=+diffie-hellman-group-exchange-sha256 192.168.3.1
Unable to negotiate with 192.168.3.1 port 22: no matching MAC found. Their offer: > [email protected],[email protected],hmac-ripemd160->[email protected],[email protected],hmac-sha2-512,hmac-sha2-256,hmac->ripemd160,[email protected]

Here is the output of my SSH config file (/etc/ssh/ssh_config):

MacMini:/ MacAdmin$ cat /etc/ssh/ssh_config
#   $OpenBSD: ssh_config,v 1.33 2017/05/07 23:12:57 djm Exp $

# This is the ssh client system-wide configuration file.  See
# ssh_config(5) for more information.  This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

# Configuration data is parsed as follows:
#  1. command line options
#  2. user-specific file
#  3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Site-wide defaults for some commonly used options.  For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.

# Host *
#   ForwardAgent no
#   ForwardX11 no
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   BatchMode no
#   CheckHostIP yes
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_dsa
#   IdentityFile ~/.ssh/id_ecdsa
#   IdentityFile ~/.ssh/id_ed25519
#   Port 22
#   Protocol 2
   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
   MACs hmac-md5,hmac-sha1,[email protected]
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com
#   RekeyLimit 1G 1h

Host 192.168.3.1
HostkeyAlgorithms ssh-dss,ssh-rsa
KexAlgorithms +diffie-hellman-group1-sha1
MacMini:/ MacAdmin$ 

Update 2:
I don't know how to properly edit my SSH config file (/etc/ssh/ssh_config) but I have a decent workaround with this command:
ssh -oKexAlgorithms=+diffie-hellman-group-exchange-sha256 [email protected] [email protected]

2 Answers 2

4

Try this:

ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 192.168.3.2
ssh -oKexAlgorithms=+diffie-hellman-group-exchange-sha256 192.168.3.1

If I'm reading it right, you've set the cipher for 192.168.3.1 (router) to diffie-hellman-group1-sha1, but it only offers diffie-hellman-group-exchange-sha256 in the DH family.

More info on OpenSSH legacy connections here. Related to that, SHA1 ciphers have been deprecated for good reason - they're considered unsafe or broken, so it would be pertinent to investigate whether your router or switch software can be updated to a modern, more secure version.

5
  • 1
    Thank you, @Pete Cooper! That worked for the switch, but I still cannot seem to get into the pfSense router via SSH. I will update my post with the output from the terminal command you suggested... Mar 12, 2019 at 13:10
  • 1
    Your config sets MACs to hmac-md5,hmac-sha1,[email protected], but there's no common ground with the router MACs. Give this a spin:ssh -oKexAlgorithms=+diffie-hellman-group-exchange-sha256 [email protected] 192.168.3.1. That's the first MAC in the offered list. If that doesn't work, replace [email protected] with the next one ([email protected]) and so on until you find a working one. Edits: formatting. Mar 12, 2019 at 19:24
  • Thanks again, Pete. This indeed worked for the connection to my switch: ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 [email protected] Mar 13, 2019 at 15:48
  • ...how could I alter my /etc/ssh/ssh_config file so that I can simply use ssh [email protected] to connect?? Mar 13, 2019 at 15:49
  • I'm having to use the long commands (can't figure out how to edit my /etc/ssh/ssh_config properly) but this did indeed solve my issue, at least as a workaround - thank you, Pete! :) Mar 20, 2019 at 4:14
0

Another solution is to create ~/.ssh/config with -

HostkeyAlgorithms +ssh-dss
KexAlgorithms +diffie-hellman-group1-sha1

This way you won't need to do this every time.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .