-
Notifications
You must be signed in to change notification settings - Fork 778
letsencrypt updates: renew location for .well-known, add support for multiple hostnames #992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
06a522c
b519bf1
b865ad0
0832bf8
4d2a524
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -19,6 +19,20 @@ run: | |||||||||
LE_WORKING_DIR="${LETSENCRYPT_DIR}" ./acme.sh --upgrade --auto-upgrade | ||||||||||
LE_WORKING_DIR="${LETSENCRYPT_DIR}" ./acme.sh --set-default-ca --server letsencrypt | ||||||||||
|
||||||||||
cat << EOF > /etc/nginx/conf.d/outlets/before-server/20-redirect-http-to-https.conf | ||||||||||
server { | ||||||||||
listen 80; | ||||||||||
|
||||||||||
location ~ /.well-known { | ||||||||||
root /var/www/discourse/public; | ||||||||||
allow all; | ||||||||||
} | ||||||||||
location / { | ||||||||||
return 301 https://${DISCOURSE_HOSTNAME}$request_uri; | ||||||||||
} | ||||||||||
} | ||||||||||
EOF | ||||||||||
|
||||||||||
cat << EOF > /etc/nginx/letsencrypt.conf | ||||||||||
user www-data; | ||||||||||
worker_processes auto; | ||||||||||
|
@@ -41,7 +55,6 @@ run: | |||||||||
|
||||||||||
server { | ||||||||||
listen 80; | ||||||||||
listen [::]:80; | ||||||||||
|
||||||||||
location ~ /.well-known { | ||||||||||
root /var/www/discourse/public; | ||||||||||
|
@@ -51,6 +64,11 @@ run: | |||||||||
} | ||||||||||
EOF | ||||||||||
|
||||||||||
if [ -f "/proc/net/if_inet6" ] ; then | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this file exist if IPv6 is enabled but no interfaces have v6 addresses? We want to listen on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll admit this was a somewhat blind attempt at mimicking what the web_ssl does here: discourse_docker/templates/web.ssl.template.yml Lines 62 to 65 in e957176
But if this isn't necessary, perhaps we can remove the references in both places and simplify everywhere There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't actually know what the behavior is when IPv6 is enabled but not configured anywhere. Maybe that If There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Survey says "yes". The default install on Debian has |
||||||||||
sed -i 's/listen 80;/listen 80;\nlisten [::]:80;/g' /etc/nginx/conf.d/outlets/before-server/20-redirect-http-to-https.conf | ||||||||||
sed -i 's/listen 80;/listen 80;\nlisten [::]:80;/g' /etc/nginx/letsencrypt.conf | ||||||||||
fi | ||||||||||
|
||||||||||
sed -Ei "s/^#?ACCOUNT_EMAIL=.+/ACCOUNT_EMAIL=${LETSENCRYPT_ACCOUNT_EMAIL}/" \ | ||||||||||
/shared/letsencrypt/account.conf | ||||||||||
|
||||||||||
|
@@ -71,8 +89,15 @@ run: | |||||||||
LETSENCRYPT_DIR="/shared/letsencrypt" | ||||||||||
/usr/sbin/nginx -c /etc/nginx/letsencrypt.conf | ||||||||||
|
||||||||||
extra_domains() { | ||||||||||
if [ -n "$DISCOURSE_HOSTNAME_ALIASES" ]; then | ||||||||||
domains=$(echo $DISCOURSE_HOSTNAME_ALIASES | sed "s/,/ -d /g") | ||||||||||
echo "-d $domains" | ||||||||||
fi | ||||||||||
} | ||||||||||
|
||||||||||
issue_cert() { | ||||||||||
LE_WORKING_DIR="${LETSENCRYPT_DIR}" ${LETSENCRYPT_DIR}/acme.sh --issue $2 -d ${DISCOURSE_HOSTNAME} --keylength $1 -w /var/www/discourse/public | ||||||||||
LE_WORKING_DIR="${LETSENCRYPT_DIR}" ${LETSENCRYPT_DIR}/acme.sh --issue $2 -d ${DISCOURSE_HOSTNAME} $(extra_domains) --keylength $1 -w /var/www/discourse/public | ||||||||||
} | ||||||||||
|
||||||||||
cert_exists() { | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In, for example,
samples/web_only.yml
, we tell operators to uncomment bothweb.ssl.template.yml
andweb.letsencrypt.ssl.template.yml
.However, the
configure-letsencrypt
andconfigure-ssl
scripts are writing to the same outlet. So future changes to the latter are going to be mysteriously overwritten by the former.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair point - perhaps something simple we could do is bundle the /.well-known passthrough location into the base ssl template? It's not a path used by Discourse anywhere, and maybe it's... well known... enough that it's OK to have in the base ssl template.