去年,我写了一篇关于保护Cisco IOS SSH服务器的帖子 。为Cisco ASA创建一个也是有意义的,特别是当我在2012年重新启用关于在Cisco ASA上启用SSH的帖子时。该博客文章不包括可提高Cisco ASA SSH服务器安全性的高级配置。在这篇文章中,我想分享网络工程师应考虑添加到其ASA模板中的最低级SSH配置。
在我们通过SSH连接到Cisco ASA之前,我们需要有一份我们需要配置的清单。
虽然 配置启用密码是个好主意 ,但SSH是可选的。
您必须在本地至少拥有一个用户帐户。
配置ASA的身份验证方法。验证方法可以是本地,RADIUS或TACACS +。
生成RSA或ECDSA密钥对。
配置ACL以允许特定的IP地址或范围。
我的老帖子介绍了如何设置启用密码。它与如何设置启用密码的命令相同,但在较新的ASA软件中,与旧版ASA软件中基于MD5的哈希相比,它使用PBKDF2加密密码。
1 2 | ASA5506(config)# enable password strongpasswordhere ASA5506(config)# show run | i enable password |
正如我在旧帖子中所述,要在ASA上启用SSH,我们首先需要生成RSA密钥对。目前NIST建议使用2048位或更高。在这篇文章中,我将使用4096位密钥对。
1 | ASA5506(config)# crypto key generate rsa modulus 4096 |
配置Cisco ASA SSH服务器仅接受版本2是最佳做法。原因是因为SSHv1存在漏洞。也就是说,请务必将其添加到您的ASA模板中。
1 2 3 4 5 6 7 8 9 10 11 | ASA5506# show ssh Idle Timeout: 10 minutes Versions allowed: 1 and 2 <-- Output omitted --> ASA5506# config t ASA5506(config)# ssh version 2 ASA5506(config)# show ssh Idle Timeout: 10 minutes Version allowed: 2 <-- Output omitted --> |
默认情况下,似乎ASA的加密算法配置为使用媒体设置。不幸的是,我似乎无法使用show run all命令验证它 。但是,show ssh和 show ssh ciphers的组合 可以解决这个问题。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ASA5506# show ssh Idle Timeout: 10 minutes Versions allowed: 2 Cipher encryption algorithms enabled: aes128-cbc aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr <-- Output omitted --> ASA5506# show ssh ciphers Available SSH Encryption and Integrity Algorithms Encryption Algorithms: all: 3des-cbc aes128-cbc aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr low: 3des-cbc aes128-cbc aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr medium: aes128-cbc aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr fips: aes128-cbc aes256-cbc high: aes256-cbc aes256-ctr <-- Output omitted --> |
客户端和服务器协商加密算法。也就是说,客户端可能会选择较弱的密码。为避免这种情况,我们将指定使用更安全的密码。根据这个 帖子,当可用时,最好使用EAX或GCM。如果没有,则使用CTR超过CBC模式。通过指定加密算法,我们告诉ASA仅向尝试连接它的任何客户端提供AES-256-CTR模式。
以下是使用默认SSH密码加密的SSH到Cisco ASA的详细输出。
1 2 3 4 5 6 7 | Mac-mini:~ networkjutsu$ ssh -vvv ASA5506 OpenSSH_7.6p1, LibreSSL 2.6.2 <-- Output omitted --> debug2: ciphers ctos: aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr debug2: ciphers stoc: aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr <-- Output omitted --> |
我们将ASA配置为仅使用AES256 CTR模式。
1 2 3 4 5 6 | ASA5506(config)# ssh cipher encryption custom aes256-ctr ASA5506(config)# show ssh Idle Timeout: 10 minutes Version allowed: 2 Cipher encryption algorithms enabled: aes256-ctr Cipher integrity algorithms enabled: hmac-sha1 hmac-sha1-96 |
以下是使用上述SSH密码加密配置与Cisco ASA设备建立SSH连接的详细输出。
1 2 3 4 5 6 7 | Mac-mini:~ networkjutsu$ ssh -vvv ASA5506 OpenSSH_7.6p1, LibreSSL 2.6.2 <-- Output omitted --> debug2: ciphers ctos: aes256-ctr debug2: ciphers stoc: aes256-ctr <-- Output omitted --> |
默认情况下,似乎ASA的完整性算法配置为使用介质设置。不幸的是,我似乎无法使用show run all命令验证它 。但是,show ssh和 show ssh ciphers的组合 可以解决这个问题。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ASA5506# show ssh Idle Timeout: 10 minutes Version allowed: 2 Cipher encryption algorithms enabled: aes256-ctr Cipher integrity algorithms enabled: hmac-sha1 hmac-sha1-96 <-- Output omitted --> ASA5506# show ssh ciphers Available SSH Encryption and Integrity Algorithms <-- Output omitted --> Integrity Algorithms: all: hmac-sha1 hmac-sha1-96 hmac-md5 hmac-md5-96 low: hmac-sha1 hmac-sha1-96 hmac-md5 hmac-md5-96 medium: hmac-sha1 hmac-sha1-96 fips: hmac-sha1 high: hmac-sha1 |
ASA SSH完整性算法的默认设置是中等。这意味着,它将同时接受HMAC-SHA1和HMAC-SHA1-96。两种算法之间的区别在于摘要长度。HMAC-SHA1-96是截断的消息摘要。由于我的理解有限,HMAC-SHA1-96是HMAC-SHA1的弱化版本,因为缩短了消息摘要。
以下是使用默认SSH完整性算法的SSH到Cisco ASA的详细输出。
1 2 3 4 5 6 7 | Mac-mini:~ networkjutsu$ ssh -vvv ASA5506 OpenSSH_7.6p1, LibreSSL 2.6.2 <-- Output omitted --> debug2: MACs ctos: hmac-sha1,hmac-sha1-96 debug2: MACs stoc: hmac-sha1,hmac-sha1-96 <-- Output omitted --> |
让我们将ASA配置为仅使用HMAC-SHA1。
1 2 3 4 5 6 | ASA5506(config)# ssh cipher integrity custom aes256-ctr ASA5506(config)# show ssh Idle Timeout: 10 minutes Version allowed: 2 Cipher encryption algorithms enabled: aes256-ctr Cipher integrity algorithms enabled: hmac-sha1 |
以下是使用上述SSH完整性算法配置与Cisco ASA设备建立SSH连接的详细输出。
1 2 3 4 5 6 7 | Mac-mini:~ networkjutsu$ ssh -vvv ASA5506 OpenSSH_7.6p1, LibreSSL 2.6.2 <-- Output omitted --> debug2: MACs ctos: hmac-sha1,hmac-sha1-96 debug2: MACs stoc: hmac-sha1,hmac-sha1-96 <-- Output omitted --> |
ASA支持两种Diffie-Hellman密钥交换方法,这些方法是DH Group 1(768-bit)和DH Group 14(2048-bit)。默认情况下,ASA设置为使用Diffie-Hellman Group 1.不幸的是,这低于NIST建议在这个时代使用的内容。
这是具有默认SSH密钥交换配置的Cisco ASA。我发布了 没有ssh 密钥-确认交换。
1 2 3 | ASA5506(config)# no ssh key-exchange ASA5506(config)# sh run all | i ssh key-exchange ssh key-exchange group dh-group1-sha1 |
以下是使用默认SSH密钥交换的SSH连接到Cisco ASA的详细输出。
1 2 3 4 5 6 7 8 | Mac-mini:~ networkjutsu$ ssh -vvv ASA5506 OpenSSH_7.6p1, LibreSSL 2.6.2 <-- Output omitted --> debug1: kex: algorithm: diffie-hellman-group1-sha1 debug1: kex: host key algorithm: ssh-rsa debug1: kex: server->client cipher: aes256-ctr MAC: hmac-sha1 compression: none debug1: kex: client->server cipher: aes256-ctr MAC: hmac-sha1 compression: none <-- Output omitted --> |
让我们配置ASA以使用DH Group 14。
1 | ASA5506(config)# ssh key-exchange group dh-group14-sha1 |
以下是更改密钥交换方法后我与Cisco ASA的SSH连接的详细输出。
1 2 3 4 5 6 7 8 | Mac-mini:~ networkjutsu$ ssh -vvv ASA5506 OpenSSH_7.6p1, LibreSSL 2.6.2 <-- Output omitted --> debug1: kex: algorithm: diffie-hellman-group14-sha1 debug1: kex: host key algorithm: ssh-rsa debug1: kex: server->client cipher: aes256-ctr MAC: hmac-sha1 compression: none debug1: kex: client->server cipher: aes256-ctr MAC: hmac-sha1 compression: none <-- Output omitted --> |
将远程管理限制到某个IP地址是最佳做法。它还需要添加ACL,否则我们将无法通过SSH访问Cisco ASA。也就是说,我在这里包含了命令。
1 | ssh 192.168.1.0 255.255.255.0 management |
这里介绍的所有配置都是我所说的所有Cisco ASA设备的最低安全标准。毕竟,它是一个网络安全设备,因此必须正确地保护它。虽然这篇文章只是保护管理平面的一小部分,但网络工程师必须采用其他安全配置。
评论专区