+++ date = "2026-12-06T20:57:47+00:00" lastmod = "2026-12-06T20:59:49+00:00" tags = [ "gists", "linux" ] +++ My [SSH hardening guide](https://www.thedroneely.com/posts/extreme-ssh-hardening/) has iced over. It's old but for the eternally spooked the overall idea remains. Personally, if you can avoid {{< abbr SSH "Secure Shell" >}} ([?](https://en.wikipedia.org/wiki/SSH)), that's one less worry. {{< disclose "The first hullabaloo appears to be that newer `KexAlgorithms` or key exchange algorithms are advised:" >}} ```shell { caption="In [/etc/ssh/sshd_config](https://man.netbsd.org/NetBSD-11.0/sshd_config.5#:~:text=Specifies%20the%20permitted%20KEX%20%28Key%20Exchange%29%20algorithms), the leftmost comma separated client's choice preferred" } KexAlgorithms mlkem768x25519-sha256,sntrup761x25519-sha512 ``` ```shell { caption="Helpful enumeration commands",options="hl_lines=5" } ssh -Q mac # List client message authentication codes ssh -Q cipher # List client ciphers ssh -Q kex # List client key exchange algorithms ssh -Q key # List client key types nmap --script ssh2-enum-algos -p 22 localhost # (If port open, unfiltered, and nmap --script exists) List all of the above on the server in one shot ``` {{}} {{< disclose `The second hullabaloo is that migrating to newer [authentication keys](https://www.openssh.org/txt/release-10.6#:~:text=All%3A%20enable%20hybrid%20post%2Dquantum%20ssh%2Dmldsa44%2Ded25519%20signature%20algorithm%2E) are advised.` >}} ```shell { caption="Generate additional keys if supported",options="hl_lines=2" } ssh-keygen -t ecdsa -b 384 # Higher client key bits (384 or 521 > 256) ssh-keygen -t mldsa44-ed25519 # New client keys ssh-keygen -A # Add missing host/server keys (RSA/ECDSA/ED25519/MLDSA44-ED25519) ``` ```shell { caption="Check client-server debug output for key algorithm support or enumerate" } ssh -vT git@gitlab.com ssh -vT git@codeberg.org ssh -vT git@github.com ``` ```shell { caption="Confirm kex: algorithm, attempt key: and accepted authentication keys",options="hl_lines=1 13" } debug1: kex: algorithm: mlkem768x25519-sha256 debug1: Will attempt key: /home/user/.ssh/id_rsa debug1: Will attempt key: /home/user/.ssh/id_xmss debug1: Will attempt key: /home/user/.ssh/id_ecdsa debug1: Will attempt key: /home/user/.ssh/id_ecdsa_sk debug1: Will attempt key: /home/user/.ssh/id_ed25519 debug1: Will attempt key: /home/user/.ssh/id_ed25519_sk debug1: Will attempt key: /home/user/.ssh/id_mldsa44_ed25519 debug1: Server accepts key: /home/user/.ssh/id_rsa RSA SHA256:0000000000000000000000000000000000000000000 agent/explicit debug1: Server accepts key: /home/user/.ssh/id_ecdsa ECDSA SHA256:1111111111111111111111111111111111111111111 agent/explicit debug1: Server accepts key: /home/user/.ssh/id_mldsa44_ed25519 MLDSA44-ED25519 SHA256:3333333333333333333333333333333333333333333 agent/explicit ``` {{}}