Search code examples
haproxylets-encryptcertbot

LetsEncrypt on multiple HaProxy instances across servers


Looking at the instructions here: https://certbot.eff.org/lets-encrypt/ubuntubionic-haproxy

I'm in a situation where I have 2 HaProxy instances, each in a docker container, on different machines. The domain names are the same. This is done for redundancy purposes.

Googling "multiple letsencrypt" or "multiple certbot" just leads to solutions for creating certificates for many domains at the same time.

This is good for subdomains, but it doesn't explain what I'm expected to do if I have more than 1 server running haproxy.

Run certbot on 1 server only, then copy the file over? If so, what about renewing the certificate? Can it no longer be automated?

Also, because of urls, certain subdomains will go to one server or the other. But both must be able to serve all the urls.

Or does this situation call for a different approach entirely? Should I use the manual mode, generate the certificates, and then update them manually?

Thanks for any help.


Solution

  • Eventually found a solution: you can start certbot with a custom port, --http-01-port as you can read here: https://eff-certbot.readthedocs.io/en/stable/using.html.

    If all your haproxys detect the incoming challenge URL "/.well-known/acme-challenge", you can have them redirect to that host/port combo. So all challenges end up at the certbot.

    Then find a way to move the certificate around.