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
|
|
11 for DOMAIN in "$@"
|
|
12 do
|
|
13 LINKDIR=/etc/letsencrypt/live/"$DOMAIN"
|
|
14 if [ ! -d "$LINKDIR" ]
|
|
15 then
|
|
16 echo "No certificates for $DOMAIN, skipping"
|
|
17 continue
|
|
18 fi
|
|
19 REALCERTFILE=`readlink -f "$LINKDIR"/cert.pem`
|
|
20 PEMFILE=`dirname "$REALCERTFILE"`/combined.pem
|
|
21 touch "$PEMFILE"
|
|
22 chown root:root "$PEMFILE"
|
|
23 chmod 400 "$PEMFILE"
|
|
24 cat "$LINKDIR"/privkey.pem "$LINKDIR"/cert.pem >"$PEMFILE"
|
|
25 ln -s -f -r "$PEMFILE" "$LINKDIR"/combined.pem
|
|
26 done
|