aboutsummaryrefslogtreecommitdiff
path: root/sshtool
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-12-23 00:07:02 +0100
committerAlex Auvolat <alex@adnab.me>2022-12-23 00:07:02 +0100
commit827987d2018ce1a48697b10c039c3cf2ec0d1a19 (patch)
tree7bc091f28411c8a2a4ff78982d11e8c026e3936a /sshtool
parent94a9c8afa8471cbb328262e6385fbda3383f7dde (diff)
downloadnixcfg-827987d2018ce1a48697b10c039c3cf2ec0d1a19.tar.gz
nixcfg-827987d2018ce1a48697b10c039c3cf2ec0d1a19.zip
cleanup
Diffstat (limited to 'sshtool')
-rwxr-xr-xsshtool17
1 files changed, 15 insertions, 2 deletions
diff --git a/sshtool b/sshtool
index 8719ffa..262f0e3 100755
--- a/sshtool
+++ b/sshtool
@@ -1,10 +1,11 @@
#!/usr/bin/env bash
-cd $(dirname $0)
-
CMDFILE="$1"
shift 1
+cd $(dirname $CMDFILE)
+CMDFILE=./$(basename $CMDFILE)
+
CLUSTER="$1"
if [ -z "$CLUSTER" ] || [ ! -d "cluster/$CLUSTER" ]; then
echo "Usage: $CMDFILE <cluster name>"
@@ -36,6 +37,7 @@ EOG
chmod +x /tmp/deploytool_askpass
export SUDO_ASKPASS=/tmp/deploytool_askpass
sudo -A sh - <<'EOEVERYTHING'
+set -e
EOF
}
@@ -97,6 +99,17 @@ chmod 0600 $TO
EOF
}
+function pipe_pass {
+ local PASSKEY=$1
+ local CMD=$2
+ cat <<EOF
+echo '- pipe secret $PASSKEY to command $CMD'
+base64 -d <<EOG | $CMD > /dev/null
+$(pass $PASSKEY | base64)
+EOG
+EOF
+}
+
for NIXHOST in $NIXHOSTLIST; do
NIXHOST=${NIXHOST%.*}