Mercurial > hg > rlgallery-misc
annotate scripts/create-combined-pemfile @ 97:fb292a0184d9
Add a page about UltraRogue.
author | John "Elwin" Edwards |
---|---|
date | Mon, 05 Apr 2021 21:57:20 -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 |