24 lines
621 B
Bash
24 lines
621 B
Bash
|
#!/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}"
|