How to disable a weak ssh cipher,100% working tested on Fedora 29.
The problem:
Nessus report my samba4 server use not strong ciphers aes256-cbc and aes128-cbc.
So I put those lines in /etc/ssh/sshd_config
MACs hmac-sha2-512,hmac-sha2-256
Ciphers aes256-ctr,aes192-ctr,aes128-ctr
KexAlgorithms diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,curve25519-sha256,[email protected]
Et voilà!..it still use the cbc cipher because this command work :(
ssh -c aes256-cbc samba4
So I check the useful systemd and I discover sshd service is using another file for ciphers
/etc/crypto-policies/back-ends/opensshserver.config
Backup the file for safety
cp /etc/crypto-policies/back-ends/opensshserver.config /etc/crypto-policies/back-ends/opensshserver.config.old
Edit it,and remove the cbc cipher.
Restart the service
systemctl restart sshd
And finally test,works fine..cbc disabled.
ssh -c aes256-cbc samba4
Unable to negotiate with 192.168.0.48 port 22: no matching cipher found. Their offer: [email protected],[email protected],aes256-ctr,[email protected],aes128-ctr
/etc/ssh/sshd_configand for the SSH client it will be in/etc/ssh/ssh_config. You want to look for theCipherline in each, and for example have justCipher aes256-ctrspecified. Then restart SSH via/etc/init.d/sshd restartor via the equivalent systemd command.sshd_configif you really care about SSH security, otherwise it can be all security theater.cipherslist is just one setting out of many for having SSH properly implemented... Protocol, PermitRootLogin, AuthorizedKeysFile, PermitEmptyPasswords, IgnoreRhosts, PermitTunnel, and so on. You can rely on their default settings as implemented in your linux distribution, butIgnornance is bliss only up until you have a problem