clan-infra/targets/web01/decrypt.sh

16 lines
371 B
Bash
Raw Normal View History

2023-07-17 08:31:59 +00:00
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p coreutils sops openssh
set -euox pipefail
2023-09-05 14:09:51 +00:00
HOST="clan.lol"
2023-07-17 08:31:59 +00:00
while ! ping -4 -W 1 -c 1 "$HOST"; do
sleep 1
done
while ! timeout 4 ssh -p 2222 "root@$HOST" true; do
sleep 1
done
2023-09-05 14:09:51 +00:00
clan secrets get zfs-key | ssh -p 2222 "root@${HOST}" "zpool import -f -a; cat > /tmp/secret.key && zfs load-key -a && touch /tmp/decrypted"