forked from Neilpang/letsproxy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdatessl.sh
40 lines (26 loc) · 796 Bytes
/
updatessl.sh
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
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env sh
_SCRIPT_="$0"
ACME_BIN="/acme.sh/acme.sh --home /acme.sh --config-home /acmecerts"
DEFAULT_CONF="/etc/nginx/conf.d/default.conf"
CERTS="/etc/nginx/certs"
updatessl() {
nginx -t && nginx -s reload
if grep ACME_DOMAINS $DEFAULT_CONF ; then
for d_list in $(grep ACME_DOMAINS $DEFAULT_CONF | cut -d ' ' -f 2);
do
d=$(echo "$d_list" | cut -d , -f 1)
$ACME_BIN --issue --server letsencrypt --ocsp -k ec-256 \
-d $d_list \
--nginx \
--fullchain-file "$CERTS/$d.crt" \
--key-file "$CERTS/$d.key" \
--reloadcmd "nginx -t && nginx -s reload"
done
#generate nginx conf again.
docker-gen /app/nginx.tmpl /etc/nginx/conf.d/default.conf
else
echo "skip updatessl"
fi
nginx -t && nginx -s reload
}
"$@"