diff options
-rwxr-xr-x | dehydrated/hook.sh | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/dehydrated/hook.sh b/dehydrated/hook.sh index c68cdf6..48713c0 100755 --- a/dehydrated/hook.sh +++ b/dehydrated/hook.sh @@ -20,25 +20,32 @@ servicehosts() { MAILHOSTS=$(servicehosts mail postconf) CHATHOSTS=$(servicehosts chat ejabberdctl) -case "$ACTION" in - deploy_challenge) ;; - clean_challenge) ;; -# deploy_cert) - deploy_cert|unchanged_cert) +cert_fix() { DOMAIN="$1"; KEYFILE="$2"; FULLCHAINFILE="$4" case "$DOMAIN" in "$MAILHOSTS") + set -x cat "$FULLCHAINFILE" > "/etc/dovecot/$DOMAIN.pem" sg dovecot -c "umask 027; cat '$KEYFILE' > '/etc/dovecot/private/$DOMAIN.pem'" #service dovecot force-reload ;; "$CHATHOSTS") + set -x sg ejabberd -c "umask 027; cat '$KEYFILE' '$FULLCHAINFILE' > '/etc/ejabberd/$DOMAIN.pem'" #service ejabberd force-reload ;; esac +} + +case "$ACTION" in + deploy_challenge) ;; + clean_challenge) ;; + deploy_cert) + cert_fix "$@" + ;; + unchanged_cert) + #cert_fix "$@" ;; - unchanged_cert) ;; *) >&2 echo "ERROR: unsupported action \"$ACTION\"" exit 1 |