From b72a880868c859a2918f501fc6a35bc8053698dd Mon Sep 17 00:00:00 2001 From: Giles Bradshaw Date: Fri, 18 Dec 2020 20:46:26 +0000 Subject: [PATCH] feat: use comments in config files to file certificates config files in /etc/nginx/conf.d can contain: ``` ``` certificates files are in /etc/nginx/conf.d/certificates these contain un commented lines --- src/nginx_conf.d/certbot.conf | 2 +- src/scripts/util.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nginx_conf.d/certbot.conf b/src/nginx_conf.d/certbot.conf index a045362..6f7f072 100644 --- a/src/nginx_conf.d/certbot.conf +++ b/src/nginx_conf.d/certbot.conf @@ -1,7 +1,7 @@ server { # Listen on plain old HTTP listen 80 default_server reuseport; - listen [::]:80 default_server reuseport; + #listen [::]:80 default_server reuseport; # Pass this particular URL off to certbot, to authenticate HTTPS certificates location '/.well-known/acme-challenge' { diff --git a/src/scripts/util.sh b/src/scripts/util.sh index b5f96b1..fec19bf 100644 --- a/src/scripts/util.sh +++ b/src/scripts/util.sh @@ -15,14 +15,14 @@ error() { # /etc/letsencrypt/live//privkey.pem parse_domains() { # For each configuration file in /etc/nginx/conf.d/*.conf* - for conf_file in /etc/nginx/conf.d/*.conf*; do + for conf_file in /etc/nginx/conf.d/certificates/*.conf*; do sed -n -r -e 's&^\s*ssl_certificate_key\s*\/etc/letsencrypt/live/(.*)/privkey.pem;\s*(#.*)?$&\1&p' $conf_file | xargs echo done } # Given a config file path, spit out all the ssl_certificate_key file paths parse_keyfiles() { - sed -n -e 's&^\s*ssl_certificate_key\s*\(.*\);&\1&p' "$1" + sed -n -e 's&^\s*# ssl_certificate_key\s*\(.*\);&\1&p' "$1" } # Given a config file path, return 0 if all keyfiles exist (or there are no