Skip to content

Commit 36896bc

Browse files
committed
Bypass basic auth for letsencrypt acme requests, reload nginx after ssl renewals
1 parent b324110 commit 36896bc

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

manager/src/backend/internal/ssl.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ const internalSsl = {
3030
.then(result => {
3131
logger.info(result);
3232
internalSsl.interval_processing = false;
33-
return result;
33+
34+
return internalNginx.reload()
35+
.then(() => {
36+
return result;
37+
});
3438
})
3539
.catch(err => {
3640
logger.error(err);

manager/src/backend/templates/proxy.conf.ejs

+4-5
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@ server {
2020
ssl_certificate_key /etc/letsencrypt/live/<%- hostname %>/privkey.pem;
2121
<% } -%>
2222

23-
<% if (typeof access_list_id !== 'undefined' && access_list_id) { -%>
24-
auth_basic "Authorization required";
25-
auth_basic_user_file /config/access/<%- access_list_id %>;
26-
<% } -%>
27-
2823
<%- typeof advanced !== 'undefined' && advanced ? advanced : '' %>
2924

3025
location / {
26+
<% if (typeof access_list_id !== 'undefined' && access_list_id) { -%>
27+
auth_basic "Authorization required";
28+
auth_basic_user_file /config/access/<%- access_list_id %>;
29+
<% } -%>
3130
<%- typeof force_ssl !== 'undefined' && force_ssl ? 'include conf.d/include/force-ssl.conf;' : '' %>
3231
include conf.d/include/proxy.conf;
3332
}

rootfs/etc/nginx/conf.d/include/letsencrypt-acme-challenge.conf

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# We use ^~ here, so that we don't check other regexes (for speed-up). We actually MUST cancel
33
# other regex checks, because in our other config files have regex rule that denies access to files with dotted names.
44
location ^~ /.well-known/acme-challenge/ {
5+
auth_basic off;
56

67
# Set correct content type. According to this:
78
# https://community.letsencrypt.org/t/using-the-webroot-domain-verification-method/1445/29
@@ -14,7 +15,7 @@ location ^~ /.well-known/acme-challenge/ {
1415
# there to "webroot".
1516
# Do NOT use alias, use root! Target directory is located here:
1617
# /var/www/common/letsencrypt/.well-known/acme-challenge/
17-
root /config/letsencrypt-acme-challenge;
18+
root /config/letsencrypt-acme-challenge;
1819
}
1920

2021
# Hide /acme-challenge subdirectory and return 404 on all requests.

0 commit comments

Comments
 (0)