mirror of
https://git.freebsd.org/ports.git
synced 2025-05-13 07:41:50 -04:00
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>
30 lines
667 B
Bash
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
|