40scripts/certs2-40.sh

24 lines
621 B
Bash
Raw Normal View History

2023-03-11 20:07:32 +00:00
#!/bin/sh
set -e
ssh_host="fg"
certname=fg.dafu.dev
key=$(cat /mnt/docker/volumes/caddy_caddy_data/_data/caddy/certificates/acme-v02.api.letsencrypt.org-directory/${certname}/${certname}.key)
crt=$(cat /mnt/docker/volumes/caddy_caddy_data/_data/caddy/certificates/acme-v02.api.letsencrypt.org-directory/${certname}/${certname}.crt)
run_ssh_script() { printf "%s" "${1}" | ssh $ssh_host; }
fg_set_cert_script="
execute batch start
config vpn certificate local
edit ${certname}
set private-key \"${key}\"
set certificate \"${crt}\"
end
execute batch end
execute batch lastlog
"
run_ssh_script "${fg_set_cert_script}"