This repository has been archived on 2023-05-08. You can view files and clone it, but cannot push or open issues or pull requests.
tf-debian-vm/files/get_cert.sh

13 lines
282 B
Bash
Raw Normal View History

2023-04-05 14:48:38 +00:00
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
CAHOST=root@hermes.dmz
eval "$(jq -r '@sh "PUBKEY=\(.pubkey) HOST=\(.host)"')"
# TODO: Can this be done more eye-pleasingly?
CERT=$(ssh $CAHOST '/root/ca.sh host "'"$PUBKEY"'" "'"$HOST"'".dmz')
jq -n --arg cert "$CERT" '{"cert":$cert}'