#!/bin/bash LE_SERVICES_SCRIPT_DIR=/usr/lib/acme/hooks LE_CERTS_DIR=/var/lib/acme/live/$HOSTNAME LE_LOG_DIR=/var/log/letsencrypt HAPROXY_CERTDIR=/etc/pki/certs HAPROXY_CERTFILE=$HAPROXY_CERTDIR/haproxy.pem DATE=$( date ) [ ! -d $LE_LOG_DIR ] && mkdir $LE_LOG_DIR echo "$DATE" >> $LE_LOG_DIR/haproxy.log if [ -f /etc/default/letsencrypt ] ; then . /etc/default/letsencrypt else echo "No letsencrypt default file" >> $LE_LOG_DIR/haproxy.log fi echo "Building the new certificate file" >> $LE_LOG_DIR/haproxy.log cat ${LE_CERTS_DIR}/{fullchain,privkey} > ${HAPROXY_CERTFILE} chmod 440 ${HAPROXY_CERTFILE} chgrp haproxy ${HAPROXY_CERTFILE} echo "Reload the haproxy service" >> $LE_LOG_DIR/haproxy.log service haproxy reload >/dev/null 2>&1 echo "Done." >> $LE_LOG_DIR/haproxy.log exit 0