This commit is contained in:
heinzel
2019-10-18 16:50:21 +02:00
parent 452a020368
commit cd193da78f
16 changed files with 526 additions and 108 deletions

View File

@@ -0,0 +1,36 @@
#!/bin/sh
LIVE_DIR="/etc/letsencrypt/live"
DEFAULT_LINK="${LIVE_DIR}/default"
DEST_DIR="/etc/httpd/certs"
CERT_DIR=""
if test "$1" != "" ; then
CERT_DIR="$1"
elif test "$RENEWED_LINEAGE" != "" ; then
CERT_DIR="$RENEWED_LINEAGE"
elif test -d "$DEFAULT_LINK" ; then
CERT_DIR="$DEFAULT_LINK"
else
echo "You must name a certificate dir either as argument or via RENEWED_LINEAGE" >&2
exit 64
fi
cert_name=`basename $CERT_DIR`
if test -d "$DEST_DIR" ; then
echo "Installing key and certs for $cert_name in $DEST_DIR"
key_source_file="${CERT_DIR}/privkey.pem"
key_dest_file="${DEST_DIR}/privkey.pem"
certs_source_file="${CERT_DIR}/fullchain.pem"
certs_dest_file="${DEST_DIR}/fullchain.pem"
touch "$key_dest_file"
chmod 600 "$key_dest_file"
echo "Copy $key_source_file to $key_dest_file"
cat "$key_source_file" > "$key_dest_file"
echo "Copy $certs_source_file to $certs_dest_file"
cat "$certs_source_file" > "$certs_dest_file"
fi

View File

@@ -0,0 +1,24 @@
#!/bin/sh
LIVE_DIR="/etc/letsencrypt/live"
DEFAULT_LINK="${LIVE_DIR}/default"
CERT_DIR=""
if test "$1" != "" ; then
CERT_DIR="$1"
elif test "$RENEWED_LINEAGE" != "" ; then
CERT_DIR="$RENEWED_LINEAGE"
else
echo "You must name a certificate dir either as argument or via RENEWED_LINEAGE" >&2
exit 64
fi
cert_name=`basename $CERT_DIR`
echo "Setting $cert_name as default certificate name"
if test -L "$DEFAULT_LINK" ; then
rm "$DEFAULT_LINK"
elif test -e "$DEFAULT_LINK" ; then
echo "Not a symbolic link: $DEFAULT_LINK" >&2
exit 78
fi
ln -s "$cert_name" "$DEFAULT_LINK"