'Key exchange algorithms

I need to exclude any weak key exchange algorithms from my server. According to company's policies kex : diffie-hellman-group1-sha1 & diffie-hellman-group-exchange-sha1 are considered weak. So i give : sudo sshd -T |grep kex and I see no sign of the above algorithms. I thought nothing should be done there, but then I tried to connect to this server from another machine using diffie-hellman-group-exhange-sha1 : sudo ssh -i /etc/ssh/rsa_key admin@server -o KexAlgorithms=diffie-hellman-group-exchange-sha1 -v and to my surprise the server accepts the connection. Can anyone explain ?

ssh


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source