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
This commit is contained in:
parent
eaa43581bd
commit
b72a880868
|
@ -1,7 +1,7 @@
|
||||||
server {
|
server {
|
||||||
# Listen on plain old HTTP
|
# Listen on plain old HTTP
|
||||||
listen 80 default_server reuseport;
|
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
|
# Pass this particular URL off to certbot, to authenticate HTTPS certificates
|
||||||
location '/.well-known/acme-challenge' {
|
location '/.well-known/acme-challenge' {
|
||||||
|
|
|
@ -15,14 +15,14 @@ error() {
|
||||||
# /etc/letsencrypt/live/<primary_domain_name>/privkey.pem
|
# /etc/letsencrypt/live/<primary_domain_name>/privkey.pem
|
||||||
parse_domains() {
|
parse_domains() {
|
||||||
# For each configuration file in /etc/nginx/conf.d/*.conf*
|
# 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
|
sed -n -r -e 's&^\s*ssl_certificate_key\s*\/etc/letsencrypt/live/(.*)/privkey.pem;\s*(#.*)?$&\1&p' $conf_file | xargs echo
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Given a config file path, spit out all the ssl_certificate_key file paths
|
# Given a config file path, spit out all the ssl_certificate_key file paths
|
||||||
parse_keyfiles() {
|
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
|
# Given a config file path, return 0 if all keyfiles exist (or there are no
|
||||||
|
|
Loading…
Reference in New Issue