Created
February 2, 2015 15:40
-
-
Save mikemackintosh/1f00c7f703317d1fe5e4 to your computer and use it in GitHub Desktop.
Used to generate max-length SSH keys for TMate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
gen_key() { | |
bits=4096 | |
keytype=$1 | |
ks="${keytype}_" | |
key="keys/ssh_host_${ks}key" | |
if [ ! -e "${key}" ] ; then | |
if [ "${keytype}" = 'dsa' ] ; then | |
bits=1024 | |
elif [ "${keytype}" = 'ecdsa' ] ; then | |
bits=521 | |
fi | |
ssh-keygen -t ${keytype} -f "${key}" -b $bits -N '' | |
return $? | |
fi | |
} | |
mkdir -p keys | |
gen_key dsa && gen_key rsa && gen_key ecdsa || exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment