Skip to content

Commit

Permalink
Bypass basic auth for letsencrypt acme requests, reload nginx after s…
Browse files Browse the repository at this point in the history
…sl renewals
  • Loading branch information
jc21 committed Mar 16, 2018
1 parent b324110 commit 36896bc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 5 additions & 1 deletion manager/src/backend/internal/ssl.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ const internalSsl = {
.then(result => {
logger.info(result);
internalSsl.interval_processing = false;
return result;

return internalNginx.reload()
.then(() => {
return result;
});
})
.catch(err => {
logger.error(err);
Expand Down
9 changes: 4 additions & 5 deletions manager/src/backend/templates/proxy.conf.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ server {
ssl_certificate_key /etc/letsencrypt/live/<%- hostname %>/privkey.pem;
<% } -%>

<% if (typeof access_list_id !== 'undefined' && access_list_id) { -%>
auth_basic "Authorization required";
auth_basic_user_file /config/access/<%- access_list_id %>;
<% } -%>

<%- typeof advanced !== 'undefined' && advanced ? advanced : '' %>

location / {
<% if (typeof access_list_id !== 'undefined' && access_list_id) { -%>
auth_basic "Authorization required";
auth_basic_user_file /config/access/<%- access_list_id %>;
<% } -%>
<%- typeof force_ssl !== 'undefined' && force_ssl ? 'include conf.d/include/force-ssl.conf;' : '' %>
include conf.d/include/proxy.conf;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# We use ^~ here, so that we don't check other regexes (for speed-up). We actually MUST cancel
# other regex checks, because in our other config files have regex rule that denies access to files with dotted names.
location ^~ /.well-known/acme-challenge/ {
auth_basic off;

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

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

0 comments on commit 36896bc

Please sign in to comment.