ports/security/lego/files/deploy.sh.sample.in
Rodrigo Osorio 9b6f8163df Add new port security/lego
Lego is a new let's encrypt client write in Go with
support for number of ACME challenges and no external
dependencies.

PR:		237349
Submitted by:	Matthew Horan <matt@matthoran.com>
2019-07-24 07:50:14 +00:00

30 lines
667 B
Bash

#!/bin/sh -e
SSLDIR="%%PREFIX%%/etc/ssl"
copy_certs () {
local certdir certfile domain keyfile rc
rc=1
certdir="${SSLDIR}/lego/certificates"
certfiles="$(find "${certdir}" -name "*.crt" -not -name "*.issuer.crt")"
for certfile in $certfiles
do
domain="$(basename "$certfile" .crt)"
keyfile="$(dirname "$certfile")/${domain}.key"
if ! cmp -s "${certfile}" "${SSLDIR}/certs/${domain}.crt"
then
cp "${certfile}" "${SSLDIR}/certs/${domain}.crt"
cp "${keyfile}" "${SSLDIR}/private/${domain}.key"
rc=0
fi
done
return $rc
}
if copy_certs
then
output=$(service nginx reload 2>&1) || (echo "$output" && exit 1)
fi