summaryrefslogtreecommitdiff
path: root/letsencrypt-helpers/request-letsencrypt
blob: c63f973185b20a7f524285db94e56239b33dfd5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh

set -e
set -u

cd ~/certs

if [ "$#" != 1 ]; then
  echo >&2 "Usage: $0 <fqdn>"
  exit 1
fi

cn="$1"
shift

if ! [ -e "$cn.csr" ] ; then
  echo >&2 "$cn.csr does not exist."
  exit 1
fi

tmp="`tempfile`"
trap "rm -f '$tmp'" EXIT

echo $PATH
acme --account-key ~/account.key --csr "$cn".csr --acme-dir ~/acme-challenge/ > "$tmp"
if [ -e "$cn-letsencrypt.pem" ]; then
  savelog "$cn-letsencrypt.pem"
fi
cp "$tmp" "$cn-letsencrypt.pem"