jean-cloud-services/services/dnscerts.jean-cloud.org/acme-dns.sh

19 lines
748 B
Bash
Raw Normal View History

2023-09-15 08:57:47 +00:00
#!/bin/bash
2023-10-16 08:47:35 +00:00
if [ "$#" -ne 2 ] ; then
echo "Usage: $0 <service_name> <workdir>" >&2
2023-09-15 08:57:47 +00:00
exit 1
fi
service="$1"
2023-10-16 08:47:35 +00:00
workdir="$2"
2023-09-15 08:57:47 +00:00
nginxfile="/docker/$service/nginx_server.conf"
if [ -f "$nginxfile" ] ; then
nginxdomains="$(extract_domain_nginx_conf.sh "$nginxfile" | template.sh "/docker/$service/.env")"
2023-09-16 18:17:34 +00:00
domains="$(echo "$nginxdomains" | tr ' ' '\n' | sort -u | resolvable.sh ns.jean-cloud.org | sed -z -e 's/\n$//' -e 's/\n/ -d /g' )"
2023-09-15 08:57:47 +00:00
[ -z "$domains" ] && exit 0
echo "--------------- -d $domains"
2023-10-16 08:47:35 +00:00
certbot certonly --config-dir "$DATA_DIR/certs" --work-dir "$workdir/work" --logs-dir "$workdir/logs" --agree-tos -m contact@jean-cloud.org -n --cert-name "$service" --dns-rfc2136 --dns-rfc2136-credentials "$DATA_DIR/rfc2136.ini" -d $domains
2023-09-15 08:57:47 +00:00
fi