~dricottone/huttese-apk

ref: 681f93827680b8cbd5eeb0b2abdb4561846f0fc4 huttese-apk/sr.ht/sr.ht-uacme/acme-update-certs -rw-r--r-- 738 bytes
681f9382 — Drew DeVault py3-stripe: upgrade to 2.63.0 3 years ago
                                                                                
09fc19f3 Drew DeVault
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh -eu
exec >>/var/log/acme.log 2>&1
date

stats() {
	cert="/etc/ssl/uacme/$1/cert.pem"
	if ! [ -e "$cert" ]
	then
		return
	fi
	expiration=$(date -d"$(openssl x509 -enddate -noout -in "$cert" \
		| cut -d= -f2)" -D'%b %d %H:%M:%S %Y GMT' +'%s')
	printf '# TYPE certificate_expiration gauge\n'
	printf '# HELP certificate_expiration Timestamp when SSL certificate will expire\n'
	printf 'certificate_expiration{instance="%s"} %s\n' "$1" "$expiration"
}

acme() {
	site=$1
	shift
	/usr/bin/uacme -v -h /usr/share/uacme/uacme.sh issue $site $* || true
	stats $site | curl --data-binary @- https://push.metrics.sr.ht/metrics/job/$site
}

source /etc/uacme.conf
chmod -R g+rX /etc/ssl/uacme /etc/ssl/uacme/private
doas nginx -s reload