Skip to content

Commit

Permalink
Show tmate.conf settings when generating keys
Browse files Browse the repository at this point in the history
  • Loading branch information
nviennot committed Aug 1, 2019
1 parent b657cdf commit 7c0ab36
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions create_keys.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
#!/bin/bash
set -eu

gen_key() {
keytype=$1
ks="${keytype}_"
key="keys/ssh_host_${ks}key"
if [ ! -e "${key}" ] ; then
ssh-keygen -t ${keytype} -f "${key}" -N ''
return $?
SIG=$(ssh-keygen -l -E SHA256 -f $key.pub | cut -d ' ' -f 2)
fi
}

mkdir -p keys
gen_key rsa && gen_key ed25519 || exit 1
gen_key rsa
RSA_SIG=$SIG
gen_key ed25519
ED25519_SIG=$SIG


echo ""
echo "You may use the following settings this in your .tmate.conf:"
echo ""
echo "set -g tmate-server-host localhost"
echo "set -g tmate-server-port 22"
echo "set -g tmate-server-rsa-fingerprint \"$RSA_SIG\""
echo "set -g tmate-server-ed25519-fingerprint \"$ED25519_SIG\""

0 comments on commit 7c0ab36

Please sign in to comment.