Summary
The built-in SSH server currently advertises a number of key exchange, MAC, and host key algorithms that are considered weak or broken. The defaults should be tightened so a fresh installation passes a baseline SSH security audit out of the box.
Details
Running ssh-audit against a default deployment flags the following as fail:
- Key exchange
ecdh-sha2-nistp256
ecdh-sha2-nistp384
ecdh-sha2-nistp521
- MAC
- Host key
Reproduction
docker run -it --rm positronsecurity/ssh-audit -p 2222 gitea.local
Impact
Default deployments expose algorithms that are known-weak or deprecated upstream. The current workaround requires manually setting several GITEA__server__SSH_SERVER_* variables, which most users will never do.
Workaround
There is no exposed option to restrict host key algorithms, so ssh-rsa remains advertised.
Acceptance criteria
References
Summary
The built-in SSH server currently advertises a number of key exchange, MAC, and host key algorithms that are considered weak or broken. The defaults should be tightened so a fresh installation passes a baseline SSH security audit out of the box.
Details
Running
ssh-auditagainst a default deployment flags the following asfail:ecdh-sha2-nistp256ecdh-sha2-nistp384ecdh-sha2-nistp521hmac-sha1ssh-rsaReproduction
Impact
Default deployments expose algorithms that are known-weak or deprecated upstream. The current workaround requires manually setting several
GITEA__server__SSH_SERVER_*variables, which most users will never do.Workaround
There is no exposed option to restrict host key algorithms, so
ssh-rsaremains advertised.Acceptance criteria
SSH_SERVER_KEY_EXCHANGES,SSH_SERVER_CIPHERS, andSSH_SERVER_MACSupdated to the secure list above.SSH_SERVER_HOST_KEY_ALGORITHMSoption added, with a default that excludesssh-rsa.ssh-auditagainst a fresh install reports no[fail]entries.References