LetsEncrypt HTTP-01 || ALPN-01 challenge with NAT & HAProxy
-
Here are some hightlights of my situation:
- I'm using a unique WAN IP
- Multiple domains routed with HAProxy
- Domains are supplied by multiple registrars (mostly OVH & Gandi)
- All HTTP is redirected to HTTPS
HTTP-01 & ALPN-01 challenges seem to be the easiest methods for my case.
If I understand well, these challenge methods require the WAN IP to redirect respectively the ports 80 or 443 to the standalone HTTP server.So for example if I'm using the HTTP challenge and add a NAT rule to redirect the port 80 on pfSense IP, my first question is:
How can I still get the regular requests on 80 ?
that is supposed to return the HTTPS redirectionMaybe a dump question, I'm sure there is something I'm not getting here.
-
You can't do it that way.
Since you are already using the ports for HAProxy, you'll need to either use a DNS-based ACME method or use a method that integrates with HAProxy to serve the ACME content.
Search around the forum, there are setup examples that use a python script with HAProxy to integrate it into the ACME process.
-
The HAProxy hint did the trick. For others searching, here is what I did on HAProxy config:
- Defined a specific backend pointing on 127.0.0.1 with the port defined on ACME config
- On the frontend added an ACL to forward the requests for which path starts with
/.well-know/...
onto the previous backend
Seems to work fine.
Don't hesitate to suggest any improvement though.
In another hand I saw that it could be a small security breach, but I don't see the issue, I'd be interested to know.Thanks for the help.