annotate scripts/create-combined-pemfile @ 84:6bd56ca54bfa

Add more information about the history of V3 and V4.
author John "Elwin" Edwards
date Sun, 15 Apr 2018 21:46:57 -0400
parents c99fac2b0dc7
children 08c6e8c87caa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
76
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
1 #!/bin/sh
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
2 # Combines a private key and host cert into a single pemfile, for webservers
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
3 # that require it.
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
4
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
5 if [ $# -lt 1 ]
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
6 then
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
7 echo "No domains given."
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
8 exit 1
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
9 fi
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
10
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
11 for DOMAIN in "$@"
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
12 do
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
13 LINKDIR=/etc/letsencrypt/live/"$DOMAIN"
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
14 if [ ! -d "$LINKDIR" ]
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
15 then
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
16 echo "No certificates for $DOMAIN, skipping"
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
17 continue
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
18 fi
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
19 REALCERTFILE=`readlink -f "$LINKDIR"/cert.pem`
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
20 PEMFILE=`dirname "$REALCERTFILE"`/combined.pem
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
21 touch "$PEMFILE"
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
22 chown root:root "$PEMFILE"
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
23 chmod 400 "$PEMFILE"
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
24 cat "$LINKDIR"/privkey.pem "$LINKDIR"/cert.pem >"$PEMFILE"
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
25 ln -s -f -r "$PEMFILE" "$LINKDIR"/combined.pem
c99fac2b0dc7 Add files related to SSL support.
John "Elwin" Edwards
parents:
diff changeset
26 done