From bf2d3308a660f3d9bb7b05db4e08d338dbecb5da Mon Sep 17 00:00:00 2001 From: Joao M Date: Mon, 15 Aug 2022 05:05:10 +0000 Subject: [PATCH] More adjusts to Lets Encrypt --- assets/etc/crontabs/root | 3 +-- assets/scripts/certbot.sh | 2 -- assets/scripts/certbot_to_haproxy.sh | 3 +-- easymapping/__init__.py | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/assets/etc/crontabs/root b/assets/etc/crontabs/root index 9811e66..4c6f3b0 100644 --- a/assets/etc/crontabs/root +++ b/assets/etc/crontabs/root @@ -6,5 +6,4 @@ 0 3 * * 6 run-parts /etc/periodic/weekly 0 5 1 * * run-parts /etc/periodic/monthly * * * * * /scripts/haproxy-reload.sh -#*/2 * * * * /scripts/certbot.sh - +*/2 * * * * /scripts/certbot.sh diff --git a/assets/scripts/certbot.sh b/assets/scripts/certbot.sh index 0d633eb..d06d298 100755 --- a/assets/scripts/certbot.sh +++ b/assets/scripts/certbot.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -@todo - mkdir -p /var/log/letsencrypt ln -sf /dev/stdout /var/log/letsencrypt/letsencrypt.log diff --git a/assets/scripts/certbot_to_haproxy.sh b/assets/scripts/certbot_to_haproxy.sh index 58afeda..d2ea126 100755 --- a/assets/scripts/certbot_to_haproxy.sh +++ b/assets/scripts/certbot_to_haproxy.sh @@ -1,7 +1,5 @@ #!/bin/bash -# @todo - # Loop through all Let's Encrypt certificates for CERTIFICATE in `find /etc/letsencrypt/live/* -type d`; do CERTIFICATE=`basename $CERTIFICATE` @@ -10,4 +8,5 @@ for CERTIFICATE in `find /etc/letsencrypt/live/* -type d`; do cat /etc/letsencrypt/live/$CERTIFICATE/fullchain.pem /etc/letsencrypt/live/$CERTIFICATE/privkey.pem > /etc/haproxy/certs/$CERTIFICATE.pem done +echo "Reloading certificates... " /usr/sbin/haproxy -W -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -x /var/run/haproxy.sock -sf $(cat /run/haproxy.pid) & diff --git a/easymapping/__init__.py b/easymapping/__init__.py index 989e928..e3d434a 100644 --- a/easymapping/__init__.py +++ b/easymapping/__init__.py @@ -148,7 +148,7 @@ class HaproxyConfigGenerator: } easymapping["443"]["hosts"][d[host_label]] = dict(easymapping[port]["hosts"][d[host_label]]) easymapping["443"]["hosts"][d[host_label]]["letsencrypt"] = False - + easymapping["443"]["ssl_cert"] = "/etc/haproxy/certs" # handle SSL