From e2f2220b5dd537eda3e0fe75e532f65ec5da9f2a Mon Sep 17 00:00:00 2001 From: Carlos Mogas da Silva Date: Wed, 16 May 2018 11:47:20 +0100 Subject: [PATCH] Run certbot on startup --- Dockerfile | 1 + haraka.sh | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/Dockerfile b/Dockerfile index 297e465..ebc06a4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,5 +36,6 @@ RUN npm -g install Haraka \ EXPOSE 25 80 587 VOLUME /haraka +VOLUME /etc/letsencrypt ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/haraka.sh b/haraka.sh index fe1a387..9fc1bdd 100644 --- a/haraka.sh +++ b/haraka.sh @@ -8,4 +8,12 @@ fi # Specify hostname echo $HOSTNAME > /haraka/config/me +# Get and install certificates from Let's Encrypt +certbot certonly -n --agree-tos -d "$HOSTNAME" +mkdir -p /haraka/config/tls +cd /haraka/config/tls +ln -s /etc/letsencrypt/live/$HOSTNAME/privkey.pem tls-key.pem +ln -s /etc/letsencrypt/live/$HOSTNAME/fullchain.pem tls-cert.pem +cd - + haraka -c /haraka