Mercurial > hg > rlgallery-misc
annotate scripts/create-combined-pemfile @ 92:bdb07be334ca
Add release 2021.03 to the download page.
author | John "Elwin" Edwards |
---|---|
date | Tue, 23 Mar 2021 21:30:04 -0400 |
parents | 08c6e8c87caa |
children |
rev | line source |
---|---|
76 | 1 #!/bin/sh |
2 # Combines a private key and host cert into a single pemfile, for webservers | |
3 # that require it. | |
4 | |
5 if [ $# -lt 1 ] | |
6 then | |
7 echo "No domains given." | |
8 exit 1 | |
9 fi | |
10 | |
88
08c6e8c87caa
Certificate post-hook script: add option to restart lighttpd.
John "Elwin" Edwards
parents:
76
diff
changeset
|
11 if [ "$1" = "-r" ] |
08c6e8c87caa
Certificate post-hook script: add option to restart lighttpd.
John "Elwin" Edwards
parents:
76
diff
changeset
|
12 then |
08c6e8c87caa
Certificate post-hook script: add option to restart lighttpd.
John "Elwin" Edwards
parents:
76
diff
changeset
|
13 RESTART=1 |
08c6e8c87caa
Certificate post-hook script: add option to restart lighttpd.
John "Elwin" Edwards
parents:
76
diff
changeset
|
14 shift |
08c6e8c87caa
Certificate post-hook script: add option to restart lighttpd.
John "Elwin" Edwards
parents:
76
diff
changeset
|
15 else |
08c6e8c87caa
Certificate post-hook script: add option to restart lighttpd.
John "Elwin" Edwards
parents:
76
diff
changeset
|
16 RESTART=0 |
08c6e8c87caa
Certificate post-hook script: add option to restart lighttpd.
John "Elwin" Edwards
parents:
76
diff
changeset
|
17 fi |
08c6e8c87caa
Certificate post-hook script: add option to restart lighttpd.
John "Elwin" Edwards
parents:
76
diff
changeset
|
18 |
76 | 19 for DOMAIN in "$@" |
20 do | |
21 LINKDIR=/etc/letsencrypt/live/"$DOMAIN" | |
22 if [ ! -d "$LINKDIR" ] | |
23 then | |
24 echo "No certificates for $DOMAIN, skipping" | |
25 continue | |
26 fi | |
27 REALCERTFILE=`readlink -f "$LINKDIR"/cert.pem` | |
28 PEMFILE=`dirname "$REALCERTFILE"`/combined.pem | |
29 touch "$PEMFILE" | |
30 chown root:root "$PEMFILE" | |
31 chmod 400 "$PEMFILE" | |
32 cat "$LINKDIR"/privkey.pem "$LINKDIR"/cert.pem >"$PEMFILE" | |
33 ln -s -f -r "$PEMFILE" "$LINKDIR"/combined.pem | |
34 done | |
88
08c6e8c87caa
Certificate post-hook script: add option to restart lighttpd.
John "Elwin" Edwards
parents:
76
diff
changeset
|
35 |
08c6e8c87caa
Certificate post-hook script: add option to restart lighttpd.
John "Elwin" Edwards
parents:
76
diff
changeset
|
36 if [ "$RESTART" = 1 ] |
08c6e8c87caa
Certificate post-hook script: add option to restart lighttpd.
John "Elwin" Edwards
parents:
76
diff
changeset
|
37 then |
08c6e8c87caa
Certificate post-hook script: add option to restart lighttpd.
John "Elwin" Edwards
parents:
76
diff
changeset
|
38 systemctl restart lighttpd |
08c6e8c87caa
Certificate post-hook script: add option to restart lighttpd.
John "Elwin" Edwards
parents:
76
diff
changeset
|
39 fi |