ssh.rocks

ssh_config linter

Paste your ~/.ssh/config. Algorithm lists are rated entry by entry, and the settings that quietly remove protection are called out.

The + trap

OpenSSH lets an algorithm list start with +, - or ^. Ciphers +aes256-cbc does not set the cipher list — it adds that cipher to the defaults. A line that looks like it is configuring cryptography carefully is re-enabling something OpenSSH removed on purpose. - is the safe direction: it removes.

A baseline to start from

Conservative rather than maximal. Pinning these lists means you stop negotiating anything newer, so revisit it when you upgrade OpenSSH — a hardening config from 2018 is how people end up without post-quantum key exchange today.

# ~/.ssh/config — a conservative modern baseline.
#
# These lists REPLACE OpenSSH's defaults rather than extending them, which is
# what makes them a floor. Note the direction of the risk: pinning a list means
# you stop negotiating anything new, so revisit it when you upgrade OpenSSH.

Host *
    # Key exchange. curve25519 first; the post-quantum hybrid is preferred
    # automatically by OpenSSH 9+ where both ends have it.
    KexAlgorithms           sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group16-sha512

    # Authenticated encryption only.
    Ciphers                 chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr

    # Encrypt-then-MAC only. Ignored for the AEAD ciphers above, which carry
    # their own integrity — this matters for the -ctr fallbacks.
    MACs                    hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com

    # Refuse SHA-1 host key signatures and DSA outright.
    HostKeyAlgorithms       ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256
    PubkeyAcceptedAlgorithms ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256

    # Refuse a host you have never seen, but do not silently accept a CHANGED
    # key. 'accept-new' is the setting people reach for 'no' to get.
    StrictHostKeyChecking   accept-new

    # Keys, not passwords.
    PasswordAuthentication  no
    PubkeyAuthentication    yes

    # Do not hand the remote host your agent or your display.
    ForwardAgent            no
    ForwardX11              no

    # Hash known_hosts so a stolen laptop does not enumerate your fleet.
    HashKnownHosts          yes