Created
January 14, 2017 21:40
-
-
Save pallas/8367b3a31e8fa401a30e1e2d7056b0bb to your computer and use it in GitHub Desktop.
Will regenerate courier.pem & restart mail daemons when Let's Encrypt certificate renews.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BASE?=/etc/letsencrypt | |
DOMAIN?=mx.example.com | |
DHBITS:=4096 | |
LIVE:=$(BASE)/live/$(DOMAIN) | |
PRIVKEY:=$(LIVE)/privkey.pem | |
FULLCHAIN:=$(LIVE)/fullchain.pem | |
.PHONY: default | |
default: | |
flock --shared $(BASE) $(MAKE) courier.pem | |
dhparams-%.pem: | |
umask 0077 ; time openssl dhparam -outform PEM $(basename $*) > [email protected] \ | |
&& chown mail.mail [email protected] \ | |
&& mv [email protected] $@ | |
courier.pem: $(PRIVKEY) $(FULLCHAIN) dhparams-$(DHBITS).pem | |
umask 0077 ; cat $+ > [email protected] \ | |
&& chown mail.mail [email protected] \ | |
&& mv [email protected] $@ && \ | |
$(MAKE) maybe-restart | |
.PHONY: maybe-restart | |
maybe-restart: | |
/etc/init.d/courier status \ | |
&& /etc/init.d/courier restart \ | |
|| true | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment