1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#!/bin/sh set -x -e cd /root chmod 0600 .ssh/id_ed25519 cat > .ssh/config <<EOF Host backuphost HostName $TARGET_SSH_HOST Port $TARGET_SSH_PORT User $TARGET_SSH_USER EOF consul kv export | \ gzip | \ age -r "$(cat /root/.ssh/id_ed25519.pub)" | \ ssh backuphost "cat > $TARGET_SSH_DIR/consul/consul_kv_export.gz.age"