ubuntuusers.de

KexAlgorithms Konfiguration

Status: Ungelöst | Ubuntu-Version: Server 22.04 (Jammy Jellyfish)
Antworten |

Frankenstein

Avatar von Frankenstein

Anmeldungsdatum:
1. Juni 2020

Beiträge: Zähle...

Hallo ubuntuusers,

ich bin aktuell dabei mein SSH Server etwas abzusichern und habe mich dafür entschieden, nur bestimmte KexAlgorithms zu erlauben.

Soweit ich das verstanden habe, muss ich in der sshd_config auf dem Server folgendes hinterlegen:

KexAlgorithms curve25519-sha256@libssh.org

und auf meinem Client in der .ssh/config Datei dasselbe beim entsprechenden Host, zum Beispiel:

  Host srv-a.test.de
  HostName 123.123.123.123
  User myuser
  PreferredAuthentications publickey
  IdentityFile "C:\Users\USERNAME\.ssh\id_ed25519v2"
  KexAlgorithms curve25519-sha256@libssh.org

ich habe anschließend den SSH Server neu gestartet, allerdings bekomme ich auf dem Server folgende Fehlermeldung:

Sep  8 14:18:34 srv-a sshd[9910]: Connection reset by authenticating user myuser 234.234.234.243 port 55442 [preauth]
Sep  8 14:18:40 srv-a sshd[9912]: Unable to negotiate with 123.123.123.123 port 53881: no matching key exchange method found. Their offer: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 [preauth]

Kann mir da jemand behilflich sein, um zu verstehen, was ich falsch mache?

Bearbeitet von sebix:

Bitte verwende in Zukunft Codeblöcke, um die Übersicht im Forum zu verbessern!

Frankenstein

(Themenstarter)
Avatar von Frankenstein

Anmeldungsdatum:
1. Juni 2020

Beiträge: 47

//Edit

Hier noch einmal die Ergebnisse vom Client von:

ssh -G myuser@123.123.123.123

user myuser
hostname 123.123.123.123
port 22
addkeystoagent false
addressfamily any
batchmode no
canonicalizefallbacklocal yes
canonicalizehostname false
challengeresponseauthentication yes
checkhostip yes
compression no
controlmaster false
enablesshkeysign no
clearallforwardings no
exitonforwardfailure no
fingerprinthash SHA256
forwardagent no
forwardx11 no
forwardx11trusted no
gatewayports no
gssapiauthentication no
gssapidelegatecredentials no
hashknownhosts no
hostbasedauthentication no
identitiesonly no
kbdinteractiveauthentication yes
nohostauthenticationforlocalhost no
passwordauthentication yes
permitlocalcommand no
proxyusefdpass no
pubkeyauthentication yes
requesttty auto
streamlocalbindunlink no
stricthostkeychecking ask
tcpkeepalive yes
tunnel false
verifyhostkeydns false
visualhostkey no
updatehostkeys false
canonicalizemaxdots 1
connectionattempts 1
forwardx11timeout 1200
numberofpasswordprompts 3
serveralivecountmax 3
serveraliveinterval 0
ciphers chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
hostkeyalgorithms ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
hostbasedkeytypes ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
kexalgorithms curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
casignaturealgorithms ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
loglevel INFO
macs umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
pubkeyacceptedkeytypes ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
xauthlocation /usr/X11R6/bin/xauth
identityfile ~/.ssh/id_rsa
identityfile ~/.ssh/id_dsa
identityfile ~/.ssh/id_ecdsa
identityfile ~/.ssh/id_ed25519
identityfile ~/.ssh/id_xmss
canonicaldomains
globalknownhostsfile __PROGRAMDATA__\ssh/ssh_known_hosts __PROGRAMDATA__\ssh/ssh_known_hosts2
userknownhostsfile ~/.ssh/known_hosts ~/.ssh/known_hosts2
connecttimeout none
tunneldevice any:any
controlpersist no
escapechar ~
ipqos af21 cs1
rekeylimit 0 0
streamlocalbindmask 0177
syslogfacility USER

- Seitens des Servers einmal die Query Ergebnisse: -

ssh -Q cipher

-

3des-cbc
aes128-cbc
aes192-cbc
aes256-cbc
aes128-ctr
aes192-ctr
aes256-ctr
aes128-gcm@openssh.com
aes256-gcm@openssh.com
chacha20-poly1305@openssh.com

-

ssh -Q mac

-

hmac-sha1
hmac-sha1-96
hmac-sha2-256
hmac-sha2-512
hmac-md5
hmac-md5-96
umac-64@openssh.com
umac-128@openssh.com
hmac-sha1-etm@openssh.com
hmac-sha1-96-etm@openssh.com
hmac-sha2-256-etm@openssh.com
hmac-sha2-512-etm@openssh.com
hmac-md5-etm@openssh.com
hmac-md5-96-etm@openssh.com
umac-64-etm@openssh.com
umac-128-etm@openssh.com

-

ssh -Q key

-

ssh-ed25519
ssh-ed25519-cert-v01@openssh.com
sk-ssh-ed25519@openssh.com
sk-ssh-ed25519-cert-v01@openssh.com
ssh-rsa
ssh-dss
ecdsa-sha2-nistp256
ecdsa-sha2-nistp384
ecdsa-sha2-nistp521
sk-ecdsa-sha2-nistp256@openssh.com
ssh-rsa-cert-v01@openssh.com
ssh-dss-cert-v01@openssh.com
ecdsa-sha2-nistp256-cert-v01@openssh.com
ecdsa-sha2-nistp384-cert-v01@openssh.com
ecdsa-sha2-nistp521-cert-v01@openssh.com
sk-ecdsa-sha2-nistp256-cert-v01@openssh.com

-

ssh -Q kex

-

diffie-hellman-group1-sha1
diffie-hellman-group14-sha1
diffie-hellman-group14-sha256
diffie-hellman-group16-sha512
diffie-hellman-group18-sha512
diffie-hellman-group-exchange-sha1
diffie-hellman-group-exchange-sha256
ecdh-sha2-nistp256
ecdh-sha2-nistp384
ecdh-sha2-nistp521
curve25519-sha256
curve25519-sha256@libssh.org
sntrup761x25519-sha512@openssh.com

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14314

Frankenstein schrieb:

ich habe anschließend den SSH Server neu gestartet, allerdings bekomme ich auf dem Server folgende Fehlermeldung:

Wann bekommst Du auf dem Server diese Fehlermeldung? Wie ist auf dem Server die Ausgabe von:

sshd -t

? Wie ist auf dem Client die Ausgabe von:

ssh -v <host>

?

Frankenstein

(Themenstarter)
Avatar von Frankenstein

Anmeldungsdatum:
1. Juni 2020

Beiträge: 47

Die Fehlermeldung erhalte ich im auth.log, nachdem ich versucht habe vom Client zum Server zu verbinden.

Wie ist auf dem Server die Ausgabe von

Keinerlei Output

Wie ist auf dem Client die Ausgabe von

OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug1: Reading configuration data C:\\Users\\USERNAME/.ssh/config
debug1: Connecting to 123.123.123.123 [123.123.123.123] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\USERNAME/.ssh/id_rsa type -1
debug1: identity file C:\\Users\\USERNAME/.ssh/id_rsa-cert type -1
debug1: identity file C:\\Users\\USERNAME/.ssh/id_dsa type -1
debug1: identity file C:\\Users\\USERNAME/.ssh/id_dsa-cert type -1
debug1: identity file C:\\Users\\USERNAME/.ssh/id_ecdsa type -1
debug1: identity file C:\\Users\\USERNAME/.ssh/id_ecdsa-cert type -1
debug1: identity file C:\\Users\\USERNAME/.ssh/id_ed25519 type 3
debug1: identity file C:\\Users\\USERNAME/.ssh/id_ed25519-cert type -1
debug1: identity file C:\\Users\\USERNAME/.ssh/id_xmss type -1
debug1: identity file C:\\Users\\USERNAME/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.9p1 Ubuntu-3
debug1: match: OpenSSH_8.9p1 Ubuntu-3 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 123.123.123.123:22 as 'myuser'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-ed25519 SHA256:fyUNV5mnKlVcyLxS9Srm4swjoDXtwDvaW+repD5rdLE
debug1: Host '123.123.123.123' is known and matches the ED25519 host key.
debug1: Found key in C:\\Users\\USERNAME/.ssh/known_hosts:2
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: C:\\Users\\USERNAME/.ssh/id_ed25519 ED25519 SHA256:gJ0T9dMQotRD8jVpqgts1zudEvg90x7zOrnzTet4lro agent
debug1: Will attempt key: myuser@mydomain.tld ED25519 SHA256:VC7neW9st1ACZvIkdydBMLqCD3Pm4mJ2Zf7TzUiAvmQ agent
debug1: Will attempt key: C:\\Users\\USERNAME/.ssh/id_rsa
debug1: Will attempt key: C:\\Users\\USERNAME/.ssh/id_dsa
debug1: Will attempt key: C:\\Users\\USERNAME/.ssh/id_ecdsa
debug1: Will attempt key: C:\\Users\\USERNAME/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com>
debug1: kex_input_ext_info: publickey-hostbound@openssh.com (unrecognised)
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: C:\\Users\\USERNAME/.ssh/id_ed25519 ED25519 SHA256:gJ0T9dMQotRD8jVpqgts1zudEvg90x7zOrnzTet4lro agent
debug1: Authentications that can continue: publickey
debug1: Offering public key: myuser@mydomain.tld ED25519 SHA256:VC7neW9st1ACZvIkdydBMLqCD3Pm4mJ2Zf7TzUiAvmQ agent
debug1: Authentications that can continue: publickey
debug1: Trying private key: C:\\Users\\USERNAME/.ssh/id_rsa
debug1: Trying private key: C:\\Users\\USERNAME/.ssh/id_dsa
debug1: Trying private key: C:\\Users\\USERNAME/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\USERNAME/.ssh/id_xmss
debug1: No more authentication methods to try.
myuser@123.123.123.123: Permission denied (publickey).

Achso, hier auch nochmal die Client .ssh/config Datei:

Host srv-a.mydomain.tld
  HostName 123.123.123.123
  User myuser
  PreferredAuthentications publickey
  IdentityFile "C:\Users\USERNAME\.ssh\id_ed25519v2"
  KexAlgorithms curve25519-sha256@libssh.org

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14314

Frankenstein schrieb:

OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug1: Reading configuration data C:\\Users\\USERNAME/.ssh/config

Wenn Du keinen ssh-Client auf einem Linux-System hast, dann versuch mal mit einer Linux-Live-CD/DVD (oder gleichwertig), statt aus Windows.

EDIT:

BTW: Ich habe es bei mir, mit einem Linux-ssh-Client "OpenSSH_7.3p1" und einem Linux-sshd-Server "OpenSSH_8.4p1" getestet und es funktioniert mit "KexAlgorithms curve25519-sha256@libssh.org" (auf Server und Client).

Frankenstein

(Themenstarter)
Avatar von Frankenstein

Anmeldungsdatum:
1. Juni 2020

Beiträge: 47

Ich hab schnell ein zweiten kleinen Linux Cloud Server (OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022) aufgesetzt, dieselbe .ssh/config Datei genommen und mich auch per ssh HOSTNAME auf den Server (OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022) verbunden. Funktioniert einwandfrei....

Jetzt stehe ich noch mehr auf dem Schlauch 😀

//Edit

Ich habe es gerade mal mit WSL2 versucht (OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f 31 Mar 2020). Auch das funktioniert einwandfrei.

//Edit2

Ich habe nun die OpenSSH_for_Windows Version (OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2) auf die aktuellste verfügbare Version aktualisiert (OpenSSH_for_Windows_8.9p1, LibreSSL 3.4.3). Dies konnte ich mit Hilfe folgender Anleitung tun: https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH

Leider hat das auch nicht zum Erfolg geführt. Der ssh-ed25519 Algorithmus ist immer noch nicht implementiert.

Gerne hoch voten: https://github.com/PowerShell/Win32-OpenSSH/issues/1978

Antworten |