bin/make-cert, bin/fix-cert-chain: Hack certificate chains for compatiblity.
[distorted-letsencrypt] / bin / make-cert
1 #! /bin/sh
2 set -e
3 usage=" TAG"
4 prog=$(readlink -e "$0")
5 . "${prog%/*}/../config.sh"
6 . "$home/lib/lib.sh"
7
8 run_as_user "$@"
9
10 ## Pick out the certificate tag.
11 case $# in 0) fail_usage ;; esac
12 tag=$1; shift
13 case $# in 0) ;; *) fail_usage ;; esac
14
15 prepare_tmp $tag
16
17 ## Make sure there's no proxy. I get `urn:acme:error:badNonce' with high
18 ## probability if I use IPv6, so avoid rolling the dice.
19 unset http_proxy
20
21 ## Let's go.
22 cert=$home/cert/$tag
23 cd $cert
24 dehydrated -f $HOME/dehydrated-config.sh -fc -s req >full-chain.new
25 fix-cert-chain full-chain.new >full-chain.fixed
26 mv full-chain.fixed full-chain
27 rm full-chain.new