Right now I am running Ubuntu 16.04 for my servers, and I have 2 web servers (one LAMP one LEMP) behind an HAProxy reverse proxy, which is doing SSL Passthrough. When I run certbot for auto renewal or even doing a cert-only run the service has troubles seeing my domain names and renewing my cert. A while ago I got the cert to renew on my LAMP server, however on my LEMP server I can’t get things to work. I unfortunately let my certificate expire and after that I can’t get any connection to the server to work, even for renewal. I have my reverse proxy directing all traffic to port 443 by default.
Here is the command I use:
letsencrypt certonly --webroot -w /var/www/html/ -d mydomain.com
Here is the error I get:
Failed authorization procedure. mydomain.com (http-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: Could not connect to mydomain.com
These are separate VMs running these web servers. Would it be easier to just scrap all of this and do SSL termination on the reverse proxy instead? Down the line I plan to have 3 domains on a single dynamic IP (using duckdns for my dynamic DNS)
When you say you’re directing all traffic to port 443, does that include traffic that arrives on your HAproxy server on port 80? Or is there no listener on port 80 at all?
The validation mechanism you’re using (http-01) uses HTTP on port 80, so you will definitely need to be serving HTTP on that port. There’s no way to force the first request to be made via HTTPS on a different port. A rewrite to https:// (using HTTP Status Code 301 or 302) would be fine and the validation server would follow that redirect (which should then hit your LEMP server). The certificate used in that connection may be expired and/or self-signed, that won’t be a problem.
I have port 80 and 443 listening on both HAProxy and my internal servers. However, the reverse proxy does redirect using status code 301 as well as my nginx server. My Apache server (which I have gotten a cert with earlier, but doesn’t work with “letsencrypt renew”) just rewrites the URL to https://{SERVER_NAME} when it gets a port 80 request.
Since HAProxy is making the first response to my LEMP server be on port 443, would that be the cause of my certificate receiving failures?
I have reason to believe it is my reverse proxy causing the problems, however I don’t know what the fix is. Currently I can curl my IP address and domain names on port 80, any attempt on port 443 results in and empty reply from the server. However, doing a curl --url https://mydomain1.com works (which has a valid cert) and https://mydomain2.com is using snakeoil for the time being (none of this is currently production), so when I curl mydomain2.com with the --url arg, I get an “Issuer certificate is invalid.” as expected
I think it was because the first time I was issuing curl incorrectly. It does work.
Turns out my HAProxy logs decided to stop working and any change I make to the haproxy.cfg file or haproxy.conf file for rsyslog is continuing to result in no logs or broken configurations. What unreliable software.
I have done some research and decided I’m going to switch HAProxy to do SSL Termination instead of passthrough. I think it will clear up a lot of complications I am having with Let’s Encrypt and I think some other internal network connection issues I am having. I’m going to have to research HAProxy logging more too because it turns out logging in HAProxy sucks