如何在 CentOS 6.5 上强化 SSH

信息安全 SSH centos
2021-08-20 19:30:01

我有一个新的(第一次)CentOS 6.5 服务器用于 Web 服务器。我们的安全团队发现了以下弱点:

SSH 服务器配置为允许 MD5 或 96 位 MAC 算法,这两种算法都被认为是弱算法。请注意,此插件仅检查 SSH 服务器的选项,不检查易受攻击的软件版本。

插件输出 支持以下客户端到服务器方法验证码 (MAC) 算法: hmac-md5 hmac-md5-96 hmac-sha1-96

如何在 CentOS 6.5 服务器上禁用 MD5 和/或 96 位 MAC 算法?我尝试运行: authconfig --disablemd5 --updateall 但仍然遇到同样的问题。

4个回答

我不完全确定,但您可能想查看sshd_config.

来自http://wiki.centos.org/HowTos/Network/SecuringSSH

# Protocol 2,1
Protocol 2

将协议 1 更改为协议 2 并重新启动。这应该已经Protocol 2在 Centos 6.5 中设置为,但您可能需要仔细检查。

我发现这使用了不同的协议选项

http://www.snailbook.com/faq/ssh-1-vs-2.auto.html

不确定这是否足以解决您的特定问题。

你知道他们用什么来检查配置吗?

更新:

这是从man sshd_config运行

Ciphers
         Specifies the ciphers allowed for protocol version 2 in order of preference.  Multiple ciphers must be comma-separated.  The supported ciphers are
         “3des-cbc”, “aes128-cbc”, “aes192-cbc”, “aes256-cbc”, “aes128-ctr”, “aes192-ctr”, “aes256-ctr”, “arcfour128”, “arcfour256”, “arcfour”,
         “blowfish-cbc”, and “cast128-cbc”.  The default is:

            aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,
            aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,
            aes256-cbc,arcfour

还有Macs选项:

MACs    Specifies the MAC (message authentication code) algorithms in order of preference.  The MAC algorithm is used in protocol version 2 for data
         integrity protection.  Multiple algorithms must be comma-separated.  The default is:

               hmac-md5,hmac-sha1,umac-64@openssh.com,
               hmac-ripemd160,hmac-sha1-96,hmac-md5-96,
               hmac-sha2-256,hmac-sha2-512

所以我会看一下这些,并/etc/ssh/sshd_config用你想要的密码和macs在你的文件中设置选项。

将以下 2 行添加到您的/etc/ssh/ssh_config/etc/ssh/sshd_config文件中:

Ciphers aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-cbc
MACs hmac-sha1

重启服务。繁荣。符合 FIPS 标准。

现在是 2017 年,是时候更新这些建议了。现在所有 *-CBC 和 RC4 密码都被认为是弱密码。所以我们剩下:

MACs hmac-sha2-512,hmac-sha2-256
Ciphers aes256-ctr,aes192-ctr,aes128-ctr

或者对于支持 OpenSSH 6.7 及更高版本的任何更新:

Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr

MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com

来源:https ://wiki.mozilla.org/Security/Guidelines/OpenSSH#Configuration

我发现这篇文章可能会有所帮助。它指出,通过添加以下行:

 Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128
 MACs hmac-sha1,umac-64@openssh.com,hmac-ripemd160

sshdconfig ( /etc/ssh/sshd_config) 中,您可以删除这些弱 MAC。