[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [metrics-cloud/master] cloudformation: Allow SSH key to be overriden with env



commit bd228c774921e9e5112589bb0162cae23f8136cf
Author: Iain R. Learmonth <irl@xxxxxxxx>
Date:   Wed Mar 25 12:38:08 2020 +0000

    cloudformation: Allow SSH key to be overriden with env
---
 cloudformation/identify_user.sh | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/cloudformation/identify_user.sh b/cloudformation/identify_user.sh
index f01bbc5..470f28a 100755
--- a/cloudformation/identify_user.sh
+++ b/cloudformation/identify_user.sh
@@ -1,8 +1,20 @@
 #!/bin/zsh
-#aws ec2 describe-key-pairs | jq -r '.KeyPairs[].KeyName' | grep `aws iam get-user | jq -r .User.UserName`
+
+# If overridden with an environment variable, use that.
+if [[ -v $TOR_METRICS_SSH_KEY ]]; then
+	echo $TOR_METRICS_SSH_KEY
+	exit 0
+done
+
+# Otherwise, make a guess based on the username.
+#
+# The available key pairs can be found with:
+#
+#   aws ec2 describe-key-pairs | jq -r '.KeyPairs[].KeyName' | \
+#   grep `aws iam get-user | jq -r .User.UserName`
 declare -A keypairs
 keypairs[acute]="acute yubikey 4"
-keypairs[irl]="irl macbook 16"
+keypairs[irl]="irl yubikey 4"
 keypairs[karsten]="karsten's key"
 
 cur_user=$(aws iam get-user | jq -r .User.UserName)

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits