Security: Fix Weak Key Exchange Algorithm in SSH

Ein Security-Scan eines Servers meldet folgendes Ergebnis: The remote SSH server is configured to allow / support weak key exchange (KEX) algorithm(s). Wie lässt sich die SSH-Verbindung absichern?

Schritt 1: Default Crypto-Richtlinien deaktivieren

nano /etc/sysconfig/sshd

## change 
#CRYPTO_POLICY= 

## to 
CRYPTO_POLICY=

Mehr zu Crypto-Policies

Schritt 2: Update der MACs, Kex-Algorythmen und Cyphers in /etc/ssh/sshd_config

KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com

Schritt 3: SSH-Server neu starten

sshd -t
systemctl restart sshd

Schritt 4: Weak cyphers testen

ssh -vv -oCiphers=3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc [user@ip-address]

wenn hier die folgende Fehlermeldung erscheint, wurden das Finding behoben:

$ ssh -vv -oCiphers=3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc root@192.168.0.10 -p22
:::::::::::::::::::::::::::::::::::::::
...
Unable to negotiate with <ip-address> port 22: no matching cipher found
prev Automatische, KI-basierte Übersetzungsprozesse mit deepL in TYPO3
next Update Debian 11 auf Debian 12 (bookworm)