eletrotupi / tcc/ ansible/roles/uacme/templates/acme-update-certs.j21c52a0ba618ba144fac9b1a112e5c5cc1b248571
448 B | 31 lines Raw
1
#!/bin/sh -eu
2

3
stats() {
4
	cert="/etc/ssl/uacme/$1/cert.pem"
5

6
	if ! [ -e "$cert" ]
7
	then
8
		return
9
	fi
10

11
	expiration="$(openssl x509 -enddate -noout -in "$cert" \
12
		| cut -d= -f2)"
13

14
	printf 'Domain %s will expire in: "%s" %s\n' "$1" "$expiration"
15
}
16

17
acme() {
18
	exec >>/var/log/acme-$1.log 2>&1
19
	date
20

21
	site=$1
22
	shift
23

24
	/usr/bin/uacme -v -h {{ acme_hook }} issue $site $* || true
25

26
	stats $site
27

28
	echo "Done \n\n" >> "/var/log/acme-$site.log"
29
}
30

31
acme $1