SSH 强化:安全配置与访问控制
1. 强化 Ubuntu 22.04 的 SSH 配置
在 Ubuntu 22.04 上强化 SSH 安全,可按以下步骤操作:
1. 打开 /etc/ssh/sshd_config
文件,在特定两行下插入以下三行:
Ciphers -aes128-ctr,aes192-ctr,aes128-gcm@openssh.com
KexAlgorithms ecdh-sha2-nistp384
MACs -hmac-sha1-etm@openssh.com,hmac-sha1,umac-64-etm@openssh.com,umac-64@openssh.com,umac-128-etm@openssh.com,umac-128@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-256
这里, Ciphers
和 MACs
行中,前面带 -
号的算法表示禁用; KexAlgorithms
行无 -
号,意味着该行列出的算法是唯一启用的。
2. 保存文件并重启 SSH 守护进程,验证其是否正确启动:
sudo systemctl restart ssh
sudo systemctl status ssh