openaustralia / infrastructure

Automated setup and configuration for most of OpenAustralia Foundation's servers
8 stars 2 forks source link

Certbot unable to renew certificates on Righttoknow #147

Closed jamezpolley closed 4 years ago

jamezpolley commented 4 years ago

In fixing #146 certbot was updated to use the Nginx method to update certs on RightToKnow. However, testing shows that this is not working. Nginx logs show the requests from the LetsEncrypt validation server being received by Nginx and redirected, then refused:

18737:127.0.0.1 - - [30/Mar/2020:10:52:42 +1100] "GET /.well-known/acme-challenge/7FmPrjZrROeq3DVU5drvYQNOCN2jctWjAt6Xrn5_PH8 HTTP/1.1" 301 185 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)"
18744:127.0.0.1 - - [30/Mar/2020:10:52:43 +1100] "GET /.well-known/acme-challenge/7FmPrjZrROeq3DVU5drvYQNOCN2jctWjAt6Xrn5_PH8 HTTP/1.1" 502 173 "http://righttoknow.org.au/.well-known/acme-challenge/7FmPrjZrROeq3DVU5drvYQNOCN2jctWjAt6Xrn5_PH8" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)"
66:2020/03/30 10:52:43 [crit] 19038#19038: *1648464 connect() to unix:/tmp/passenger.FwL43Wg/agents.s/core failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: www.righttoknow.org.au, request: "GET /.well-known/acme-challenge/7FmPrjZrROeq3DVU5drvYQNOCN2jctWjAt6Xrn5_PH8 HTTP/1.1", upstream: "passenger:unix:/tmp/passenger.FwL43Wg/agents.s/core:", host: "www.righttoknow.org.au", referrer: "http://righttoknow.org.au/.well-known/acme-challenge/7FmPrjZrROeq3DVU5drvYQNOCN2jctWjAt6Xrn5_PH8"
jamezpolley commented 4 years ago

Certbot works with nginx by creating a new vhost config which looks a bit like this:

server {
  listen 80
  .....
}

This fails on RTK as Nginx doesn't listen on port 80, varnish does. Varnish forwards the request to Nginx on :8000 which doesn't know how to handle the request.

Couple of possible ways to handle this:

I'm going to go ahead with the third option for now.

mlandauer commented 4 years ago

Looks to be happening again

jamezpolley commented 4 years ago

Tracking new issue in https://github.com/openaustralia/infrastructure/issues/152