Pregunta :¿Cómo deshabilitar algoritmos HMAC inseguros y de cifrado débil en servicios SSH en CentOS/RHEL 8?
Para deshabilitar cifrados débiles y algoritmos HMAC inseguros en servicios ssh en CentOS/RHEL 8, siga las instrucciones a continuación:
1. Edite /etc/sysconfig/sshd y descomente la línea CRYPTO_POLICY:
Antes:
# CRYPTO_POLICY=[Original value]
Después:
CRYPTO_POLICY=[New value]
2. Asegúrese de que se hayan agregado los cifrados, MAC y KexAlgorithms correctos al archivo /etc/ssh/sshd_config.
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256 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
3. Reinicie el servicio sshd:
# systemctl restart sshd
4. Para probar si los cifrados CBC débiles están habilitados, ejecute el siguiente comando:
# ssh -vv -oCiphers=3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc [@IP of your Server]
Si tiene éxito, le pedirá una contraseña. Esto significa que los cifrados débiles están habilitados.
Si falla, debería recibir un mensaje como este:
Unable to negotiate withport 22: no matching cipher found. Their offer: aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes128-gcm@openssh.com,aes128-ctr
Esto significa que las mitigaciones están funcionando correctamente.
5. Para probar si los algoritmos HMAC débiles están habilitados, ejecute el siguiente comando:
# ssh -vv -oMACs=hmac-md5,hmac-md5-96,hmac-sha1,hmac-sha1-96,hmac-md5-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha1-96-etm@openssh.com,umac-64-etm@openssh.com [@IP of your Server]Cómo deshabilitar algoritmos HMAC inseguros y de cifrado débil en servicios SSH para CentOS/RHEL 6 y 7