From b0df53a6eee9bd6900d2b0b09ac0ad12c8281d16 Mon Sep 17 00:00:00 2001 From: Victor LABORIE Date: Mon, 6 Nov 2017 11:04:13 +0100 Subject: [PATCH] evoacme: add postix hook --- evoacme/files/hooks/reload_postfix | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 evoacme/files/hooks/reload_postfix diff --git a/evoacme/files/hooks/reload_postfix b/evoacme/files/hooks/reload_postfix new file mode 100755 index 00000000..50ee20ce --- /dev/null +++ b/evoacme/files/hooks/reload_postfix @@ -0,0 +1,32 @@ +#!/bin/sh + +readonly PROGNAME=$(basename "$0") +readonly ARGS=$@ + +readonly VERBOSE=${VERBOSE:-"0"} +readonly QUIET=${QUIET:-"0"} + +error() { + >&2 echo "${PROGNAME}: $1" + exit 1 +} +debug() { + if [ "${VERBOSE}" = "1" ] && [ "${QUIET}" != "1" ]; then + >&2 echo "${PROGNAME}: $1" + fi +} + +if [ -n "$(pidof master)" ]; then + if $($(command -v postconf) > /dev/null); then + if $($(command -v postconf)|grep -E "^smtpd_tls_cert_file"|grep -q "letsencrypt"); then + debug "Postfix detected... reloading" + service postfix reload + else + debug "Postfix doesn't use Let's Encrypt certificate. Skip." + fi + else + error "Postfix config is broken, you must fix it !" + fi +else + debug "Postfix is not running. Skip." +fi