Introducción
Este documento describe cómo resolver/resolver problemas de SSH en un Nexus 9000 después de una actualización de código.
Antes de explicar la causa de los problemas de SSH, es necesario conocer la vulnerabilidad 'Cifradores de modo CBC de servidor SSH habilitados y Algoritmos MAC débiles de SSH habilitados' que afecta a la plataforma Nexus 9000.
ID de CVE - CVE- 2008-5161 (Cifradores de modo CBC de servidor SSH habilitados y algoritmos MAC débiles SSH habilitados)
Descripción del problema - Vulnerabilidad activada de los cifradores de modo CBC del servidor SSH (Cifradores de modo CBC del servidor SSH habilitados)
El servidor SSH está configurado para admitir cifrado de bloqueo de cifrado (CBC). Esto podría permitir que un atacante recupere el mensaje de texto sin formato del texto cifrado. Tenga en cuenta que este complemento sólo verifica las opciones del servidor SSH y no verifica las versiones de software vulnerables.
Solución recomendada: inhabilite el cifrado del modo CBC y active el modo de contador (CTR) o el cifrado del modo Galois/Counter Mode (GCM)
Referencia - Base de datos nacional de vulnerabilidades - Detalles de CVE-2008-5161
Problema
Después de actualizar el código a 7.0(3)I2(1), no puede SSH en el Nexus 9000 y recibir este error:
no matching cipher found: client aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se server
aes128-ctr,aes192-ctr,aes256-ctr
Solución
La razón por la que no puede realizar el SSH en el Nexus 9000 después de actualizar al código 7.0(3)I2(1) y posteriores es que los cifrados débiles se desactivan a través de la corrección de ID de bug de Cisco CSCuv3937.
La solución a largo plazo para este problema es utilizar el cliente SSH actualizado/más reciente que tiene los tipos débiles de cifrado antiguos inhabilitados.
La solución temporal es agregar cifras débiles de nuevo en el Nexus 9000. Hay dos opciones posibles para la solución temporal, que depende de la versión del código.
Opción temporal 1. Comando ssh cipher-mode soft (disponible con NXOS 7.0(3)I4(6) o posterior)
- Introducido a través del ID de bug de Cisco CSCvc71792: implemente un botón para permitir el cifrado débil aes128-cbc, aes192-cbc, aes256-cbc.
- Agrega soporte para estas cifras débiles: aes128-cbc, aes192-cbc y aes256-cbc.
- Todavía no hay soporte para el cifrado 3des-cbc.
! baseline: only strong Ciphers aes128-ctr,aes192-ctr,aes256-ctr allowed
9k# conf t
Enter configuration commands, one per line. End with CNTL/Z.
9k(config)# feature bash
9k(config)# run bash sudo grep -i cipher /isan/etc/dcos_sshd_config
#secure ciphers and MACs
#CSCun41202
: Disable weaker Ciphers and MACs
Ciphers aes128-ctr,aes192-ctr,aes256-ctr <<----- only strong ciphers
! enable the weak aes-cbc ciphers with NXOS command
! Note that weak cipher 3des-cbc is still disabled.
9k# conf t
Enter configuration commands, one per line. End with CNTL/Z.
9k(config)# ssh cipher-mode weak
9k(config)# end
!! verification:
9k# run bash sudo grep -i cipher /isan/etc/dcos_sshd_config
#secure ciphers and MACs
#CSCun41202
: Disable weaker Ciphers and MACs
Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,aes192-cbc,aes256-cbc <<---
! rollback: use the 'no' form of the command
9k# conf t
Enter configuration commands, one per line. End with CNTL/Z.
9k(config)# no ssh cipher-mode weak
9k(config)# end
Opción temporal 2. Utilice Bash para Modificar el Archivo sshd_config y Volver a Agregar Explícitamente los Cifradores Débiles
Si comenta la línea de cifrado del archivo /isan/etc/sshd_config, se admiten todos los cifrados predeterminados (esto incluye aes128-cbc, 3des-cbc, aes192-cbc y aes256-cbc).
n9k#Config t
n9k(config)#feature bash-shell
n9k(config)#Run bash
bash-4.2$ sudo su -
root@N9K-1#cd /isan/etc
root@N9K-1#cat dcos_sshd_config | egrep Cipher
#CSCun41202 : Disable weaker Ciphers and MACs
Ciphers aes128-ctr,aes192-ctr,aes256-ctr <<<< only allowed ciphers (eliminate known vulnerability).
!! Create a back up of the existing SSHD_CONFIG
root@N9K-1#mv dcos_sshd_config dcos_sshd_config.backup
!! comment out the cipher line and save to config (effectively removing the restriction)
cat dcos_sshd_config.backup | sed 's@^Cipher@# Cipher@g' > dcos_sshd_config
!! Verify
root@N9K-1#cat dcos_sshd_config | egrep Cipher
#CSCun41202 : Disable weaker Ciphers and MACs
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr << see inserted comment # before Cipher (to remove the limitation)
root@N9K-1#exit
logout
bash-4.2$ exit
exit
N9K-1(config)# no feature bash
N9K-1(config)# exit
Tenga en cuenta que cuando vuelva a agregar las cifras antiguas, utilizará cifras débiles y, por lo tanto, supone un riesgo para la seguridad.