Avamar: "Clave pública del servidor SSH demasiado pequeña" y "Configuración criptográfica SSH obsoleta" se informan en un informe de análisis de seguridad
Summary: Las vulnerabilidades "Clave pública del servidor SSH demasiado pequeña" y "Configuración criptográfica SSH obsoleta" se informan en un informe de análisis de seguridad.
Symptoms
Se informó la siguiente vulnerabilidad de seguridad en el informe de análisis de seguridad.
Title: SSH Server Public Key Too Small
Results: Algorithm Length ssh-rsa 1024 bit
Threat: The SSH protocol (Secure Shell) is a method for secure remote login from one computer to another. The SSH Server is using a small Public Key.
Best practices require that RSA digital signatures be 2048 or more bits long to provide adequate security. Key lengths of 1024 are acceptable through 2013, but since 2011 they are considered deprecated.
For more information, please refer to NIST Special Publication 800-131A (http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar1.pdf).
Only server keys that are not part of a certificate are reported in this QID.
QID: 38739
Title: Deprecated SSH Cryptographic Settings
Results: Type Name
key exchange diffie-hellman-group1-sha1
cipher arcfour256
cipher arcfour128
cipher 3des-cbc
cipher blowfish-cbc
cipher cast128-cbc
cipher arcfour
Threat: The target is using deprecated SSH cryptographic settings to communication
Cause
La variable SSH La clave pública está configurada de manera predeterminada con 1024 bits en lugar de 2048 bits, y puede estar utilizando elementos obsoletos SSH Configuración criptográfica.
Resolution
1. Inicie sesión en Avamar Utility Node como administrador.
2. Eleve al privilegio raíz.
3. Determinar qué cifrados se pueden utilizar:
cat /etc/ssh/sshd_config | grep -i ciphers
Resultado de muestra:
# Ciphers and keying
Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,aes192-cbc,aes256-cbc
4. Ejecute el siguiente comando para confirmar qué cifrados se utilizan:
ssh -Q cipher
Resultado de muestra:
3des-cbc
blowfish-cbc
cast128-cbc
arcfour
arcfour128
arcfour256
aes128-cbc
aes192-cbc
aes256-cbc
rijndael-cbc@lysator.liu.se
aes128-ctr
aes192-ctr
aes256-ctr
aes128-gcm@openssh.com
aes256-gcm@openssh.com
chacha20-poly1305@openssh.com
5. Haga una copia de respaldo de /etc/ssh/sshd_config archivo:
cp -p /etc/ssh/sshd_config /etc/ssh/sshd_config.`date +%y%m%d`
6. Mediante vi, edite el archivo /etc/ssh/sshd_config archivo:
vi /etc/ssh/sshd_config
7. Realice los siguientes cambios:
un. Elimine todos los ajustes criptográficos de SSH obsoletos que aparecen en el informe de análisis de seguridad. En este ejemplo, los que se enumeran a continuación:
cipher arcfour256
cipher arcfour128
cipher 3des-cbc
cipher blowfish-cbc
cipher cast128-cbc
cipher arcfour
b. Cambie el siguiente parámetro de 1024 a 2048:
ServerKeyBits 2048
c. Elimine los comentarios en estas líneas para especificar qué claves SSH va a utilizar:
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
8. Compruebe el tamaño de cada una de estas claves:
ssh-keygen -lf /etc/ssh/ssh_host_rsa_key.pub
Resultado de muestra:
2048 82:4e:33:4a:1f:e6:81:7f:ef:c7:4c:1f:c7:b2:ce:59 [MD5] root@linux-host1 (RSA)
ssh-keygen -lf /etc/ssh/ssh_host_ecdsa_key.pub
Resultado de muestra:
256 a9:2b:e7:0b:ab:0b:be:2f:d4:9b:6c:2d:6c:fb:3d:e9 [MD5] root@linux-host1 (ECDSA)
ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub
Resultado de muestra:
256 65:c5:1e:1c:ac:a3:7c:05:90:21:a3:3c:7e:d6:d4:bd [MD5] root@linux-host1 (ED25519)
Si los tamaños (el primer número en la salida, resaltado en rojo) son menores que los de la salida anterior, se deben generar nuevas claves.
Si es necesario, ejecute el comando correspondiente para la clave o claves que se generarán:
sudo ssh-keygen -N '' -b 2048 -t rsa -f /etc/ssh/ssh_host_rsa_key
sudo ssh-keygen -N '' -b 256 -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
sudo ssh-keygen -N '' -b 256 -t ed25519 -f /etc/ssh/ssh_host_ed25519_key
Confirme si hay sobrescrituras de claves:
Generating public/private rsa key pair.
/etc/ssh/ssh_host_rsa_key already exists.
Overwrite (y/n)? y
Your identification has been saved in /etc/ssh/ssh_host_rsa_key.
Your public key has been saved in /etc/ssh/ssh_host_rsa_key.pub.
The key fingerprint is:
47:60:91:14:b1:15:6e:6d:ea:e9:36:37:31:08:d3:69 root@vmtest-debian8
The key's randomart image is:
+---[RSA 2048]----+
| .B=o. |
| ..= . |
| ..+.o |
| ooEo |
| S+o. |
| o..o |
| o o |
| .o o |
| ..o . |
+-----------------+
9. Verifique que la configuración no contenga ningún error:
sshd -t
No debería haber ningún resultado. Si hay errores, corríjalos antes de continuar.
10. Reinicie el sshd servicio:
service sshd restart
11. Para comprobar qué cifrados se aceptan después de aplicar estos cambios, ejecute el siguiente comando en cada cifrado enumerado anteriormente:
ssh -c "cipher_name" localhost
-
- Si se acepta el cifrado, el resultado debe coincidir con el Apéndice A
- Si se rechaza el cifrado, el resultado debe coincidir con el Apéndice B
Additional Information
APÉNDICE A:
root@hostname:~/#: ssh -c "cipher_name" localhost
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
Last login: Mon Oct 1 14:05:28 2018 from XX.XX.XX.XXX
*****************************************************************
* *
* This is the Avamar Virtual Appliance *
* *
* Please read the documentation before performing *
* any administrative functions on this node. *
* For help, contact EMC at 877.534.2867 (USA only) or *
* https://support.emc.com. *
* *
*****************************************************************
root@hostname:~/#:
APÉNDICE B:
root@hostname:~/#: ssh -c "cipher_name" localhost
no matching cipher found: client "cipher_name" server valid_cipher, valid_cipher, valid_cipher