Certbot - Webroot Directory Misconfiguration means HTTP Challenge Doesn't Pass

Hello,

I’ve tried to renew my certificate but it doesn’t work. On my server I execute the command:

sudo /etc/letsencrypt/certbot-auto renew

which results in:

Cert is due for renewal, auto-renewing…
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for werners.sytes.net
Waiting for verification…
Cleaning up challenges
Attempting to renew cert from /etc/letsencrypt/renewal/werners.sytes.net.conf produced an unexpected error: Failed authorization procedure. werners.sytes.net (http-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: Could not connect to werners.sytes.net. Skipping.

All renewal attempts failed. The following certs could not be renewed:
/etc/letsencrypt/live/werners.sytes.net/fullchain.pem (failure)
1 renew failure(s), 0 parse failure(s)

IMPORTANT NOTES:

  • The following errors were reported by the server:

    Domain: werners.sytes.net
    Type: connection
    Detail: Could not connect to werners.sytes.net

    To fix these errors, please make sure that your domain name was
    entered correctly and the DNS A record(s) for that domain
    contain(s) the right IP address. Additionally, please check that
    your computer has a publicly routable IP address and that no
    firewalls are preventing the server from communicating with the
    client. If you’re using the webroot plugin, you should also verify
    that you are serving files from the webroot path you provided.

I’ve checked all configurations and they seem to work. Whats wrong here?

Thank you and best Regards

Dominik Werner

Certbot can’t access your system. Can you access your server via your domain?

Thank you for your reply. Do you mean something like:

ssh admin@mydomain.com

?
I disabled the public ssh option on purpose for security reasons. Or how exactly should I run the command that certbot will be able to access my system?

The server is reachable over port 80, 443 though. I’m using dynDNS could this be the problem?

Hi @dominikw,

You have misconfigured your site, you site on port 80 is not responding http requests but https.

 $ curl -ikL http://werners.sytes.net
HTTP/1.1 400 Bad Request
Server: nginx
Date: Fri, 26 May 2017 15:49:09 GMT
Content-Type: text/html
Content-Length: 264
Connection: close

<html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head><body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
<hr><center>nginx</center>
</body>
</html>


$ curl -ikL https://werners.sytes.net:80
    HTTP/1.1 200 OK
    Server: nginx
    Date: Fri, 26 May 2017 15:49:16 GMT
    Content-Type: text/html
    Content-Length: 93
    Last-Modified: Tue, 07 Mar 2017 15:15:28 GMT
    Connection: keep-alive
    Keep-Alive: timeout=10
    ETag: "58bece90-5d"
    Strict-Transport-Security: max-age=31536000; includeSubdomains;
    Accept-Ranges: bytes

    <html>
            <head>
                    <title>Test</title>
            </head>
            <body>
                    <p>Lorem Ipsum.</p>
            </body>
    </html>

You should configure your server to only accept http requests on port 80 instead of https.

Cheers,
sahsanu

1 Like

Thank you very much. This solved my problem! :smile:

I’ve intentionally redirected all incoming traffic on port 80 to port 443 for security purposes but this seems to be a bad call when using letsencrypt.

Thanks again, have a nice weekend.

1 Like

It can work OK if you use an HTTP 301 redirect, instead of a port-forwarding redirect. That is a different notion of "redirect" (at a different protocol layer), but it will avoid confusing the CA during the validation process. In that case people who visit your domain in a browser will also successfully get "redirected" in the browser to the secure version of the site.

Thank you for your advice. I’ve reconfigured my server.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.