Skip to content

Instantly share code, notes, and snippets.

@dlenski
Last active December 6, 2022 09:14
Show Gist options
  • Save dlenski/e42a08fa27e97b0dbb0c0024c99a8bc4 to your computer and use it in GitHub Desktop.
Save dlenski/e42a08fa27e97b0dbb0c0024c99a8bc4 to your computer and use it in GitHub Desktop.
Check speed of ssh cipher(s) on your system
# Based on:
# http://www.systutorials.com/5450/improving-sshscp-performance-by-choosing-ciphers/#comment-28725
ciphers="$(egrep '^\s*Ciphers' /etc/ssh/sshd_config|sed 's/Ciphers//; s/,/ /')"
if [[ -n "$ciphers" ]]; then
echo "/etc/ssh/sshd_config allows these ciphers: $ciphers"
else
ciphers="$(ssh -Q cipher)"
echo "ssh -Q cipher reports these ciphers: $ciphers"
else
read -rd '' ciphers <<EOF
3des-cbc aes128-cbc aes128-ctr [email protected] aes192-cbc aes192-ctr
aes256-cbc aes256-ctr [email protected] arcfour arcfour128 arcfour256
blowfish-cbc cast128-cbc [email protected] [email protected]
EOF
fi
for i in $ciphers
do
dd if=/dev/zero bs=1000000 count=1000 2> /dev/null |
ssh -c $i localhost "(time -p cat) > /dev/null" 2>&1 |
grep real | awk '{print "'$i': "1000 / $2" MB/s" }'
done
@joeharr4
Copy link

joeharr4 commented May 1, 2018

I added a feature (name remote host) and a little doc, and fixed a bug (only one comma in list of ciphers converted to space)...
https://gist.github.com/joeharr4/c7599c52f9fad9e53f62e9c8ae690e6b
There's no pull requests in gist, so here's the fork you can pull back.
--jh--

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment