aboutsummaryrefslogtreecommitdiff
path: root/sshtool
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-04-20 13:07:39 +0200
committerAlex Auvolat <alex@adnab.me>2022-04-20 13:07:39 +0200
commitd056b385d71d5b33165ab87cbedffb243d168c8a (patch)
tree36dd218ff23ca150775815ae71c87d711301afa6 /sshtool
parent9c9c776213478023d4cab6290efcb6adfdbbbe86 (diff)
downloadnixcfg-d056b385d71d5b33165ab87cbedffb243d168c8a.tar.gz
nixcfg-d056b385d71d5b33165ab87cbedffb243d168c8a.zip
Refactor secrets
Diffstat (limited to 'sshtool')
-rwxr-xr-xsshtool13
1 files changed, 13 insertions, 0 deletions
diff --git a/sshtool b/sshtool
index 94a3ea0..b5de384 100755
--- a/sshtool
+++ b/sshtool
@@ -68,6 +68,19 @@ EOG
EOF
}
+function copy_secret {
+ local FROM=$1
+ local TO=$2
+ cat <<EOF
+echo '- write secret $TO from $FROM'
+base64 -d <<EOG | tee $TO > /dev/null
+$(base64 <$FROM)
+EOG
+chown root:root $TO
+chmod 0600 $TO
+EOF
+}
+
for NIXHOST in $NIXHOSTLIST; do
NIXHOST=${NIXHOST%.*}