审计 OpenSSH
最后更新于
$ ssh-audit example.org
$ ssh-audit -p 2222 example.org
$ ssh-audit -p 22 '[2001:db8::1]'# sh -c 'printf "\n# Restrict key exchange\nKexAlgorithms \
curve25519-sha256,curve25519-sha256@libssh.org,\
diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,\
diffie-hellman-group-exchange-sha256\n" >> /etc/ssh/sshd_config'# sh -c 'printf "# Restrict MACs\nMACs \
umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,\
hmac-sha2-512-etm@openssh.com\n" >> /etc/ssh/sshd_config'# sh -c 'printf "# Restrict HostKey algorithms\nHostKeyAlgorithms \
ssh-ed25519,rsa-sha2-256,rsa-sha2-512\n" >> /etc/ssh/sshd_config'# sshd -t
# rcctl restart sshd$ ssh-audit localhost# awk '$5 >= 3071' /etc/ssh/moduli > /etc/ssh/moduli.safe
# mv -f /etc/ssh/moduli.safe /etc/ssh/moduli
# rcctl restart sshd# cd /etc/ssh
# install -d -m 0700 ./backup-keys && mv ssh_host_* ./backup-keys/
# ssh-keygen -t ed25519 -N '' -f /etc/ssh/ssh_host_ed25519_key
# ssh-keygen -t rsa -b 3072 -o -a 100 -N '' -f /etc/ssh/ssh_host_rsa_keyHostKey /etc/ssh/ssh_host_ed25519_key
HostKey /etc/ssh/ssh_host_rsa_key# sshd -t
# rcctl restart sshd