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

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

MacMini:/ MacAdmin$ ssh NetAdmin@ #Router
Unable to negotiate with port 22: no matching key exchange method
found. Their offer: curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256

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

MacMini:/ MacAdmin$ ssh -oKexAlgorithms=+diffie-hellman-group-exchange-sha256
Unable to negotiate with port 22: no matching MAC found. Their offer: > hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160->etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac->ripemd160,umac-128@openssh.com

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,umac-64@openssh.com
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com
#   RekeyLimit 1G 1h

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 -oMACs=hmac-sha2-512-etm@openssh.com RouterAdmin@


Try this:

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

If I'm reading it right, you've set the cipher for (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.

  • 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... – SamAndrew81 Mar 12 at 13:10
  • 1
    Your config sets MACs to hmac-md5,hmac-sha1,umac-64@openssh.com, but there's no common ground with the router MACs. Give this a spin:ssh -oKexAlgorithms=+diffie-hellman-group-exchange-sha256 -oMACs=hmac-sha2-512-etm@openssh.com That's the first MAC in the offered list. If that doesn't work, replace hmac-sha2-512-etm@openssh.com with the next one (hmac-sha2-256-etm@openssh.com) and so on until you find a working one. Edits: formatting. – Pete Cooper Mar 12 at 19:24
  • Thanks again, Pete. This indeed worked for the connection to my switch: ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 AdminMe@ – SamAndrew81 Mar 13 at 15:48
  • ...how could I alter my /etc/ssh/ssh_config file so that I can simply use ssh AdminMe@ to connect?? – SamAndrew81 Mar 13 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! :) – SamAndrew81 Mar 20 at 4:14

You must log in to answer this question.

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