#!/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