We have a domain using a certificate installed with LetsEncrypt, at five.epicollect.net
Now we are migrating to a new server, which is live but with a temporary domain name. (http://fi–ec5dev3.dide.ic.ac.uk/)
I am trying to generate a new certificate on the new server covering both domains, so when we point five.epicollect.net to the new server https will still work.
I tried, from the new server fi–ec5dev3.dide.ic.ac.uk:
Failed authorization procedure. five.epicollect.net (tls-sni-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Incorrect validation certificate for tls-sni-01 challenge. Requested 695b7c76c82623839355b212f327af59.f5eb69fb808f144b95c3674b88d87f59.acme.invalid from 129.31.26.230:443. Received 2 certificate(s), first certificate had names “five.epicollect.net”
IMPORTANT NOTES:
The following errors were reported by the server:
Domain: five.epicollect.net
Type: unauthorized
Detail: Incorrect validation certificate for tls-sni-01 challenge.
Requested
695b7c76c82623839355b212f327af59.f5eb69fb808f144b95c3674b88d87f59.acme.invalid
from 129.31.26.230:443. Received 2 certificate(s), first
certificate had names “five.epicollect.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.
Yes, but I think the auth redirection method is better!
If you set an HTTP 301 redirect from /.well-known/acme-challenge on the old machine to the same location on the new machine, then the new machine can pass HTTP-01 validation for both names, e.g. using the Certbot --webroot method.
But it does not mention any 301 redirect, though. It asks me to specify the web root of each server where the temporary verification file will be placed.
The documentation assumes that Certbot will be run on the web server where the DNS record is already pointing. The situation where DNS records for two or more subject names point to different servers, and/or you want to obtain a certificate for a name which points to a server other than the one where you’re running Certbot, is considered a much more advanced case, which I guess currently isn’t mentioned in the documentation at all.
The thing that makes me not recommend --manual is that certbot renew cannot renew certificates obtained with it (at least if you literally use it in the manual mode).
I tried a few things, the file test.txt is accessible, folders have 755 permission.
When I run sudo certbot certonly --webroot -w /var/www/html_prod/shared/public/ -d five.epicollect.net -d fi--ec5dev3.dide.ic.ac.uk
I get the following error
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for five.epicollect.net
http-01 challenge for fi--ec5dev3.dide.ic.ac.uk
Using the webroot path /var/www/html_prod/shared/public for all unmatched domains.
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. fi--ec5dev3.dide.ic.ac.uk (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://fi--ec5dev3.dide.ic.ac.uk/.well-known/acme-challenge/BOHzIjplae56vjC7B_vopSTV5-0wOaO_7P8CTDmeICE: "<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="v", five.epicollect.net (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://five.epicollect.net/.well-known/acme-challenge/rEJVv8HOl48SSAQfjKm2GPCnHHFA8HKjIqEuVclMs-4: "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>Index of /.well-known/acme-challenge</title>
</"
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: fi--ec5dev3.dide.ic.ac.uk
Type: unauthorized
Detail: Invalid response from
http://fi--ec5dev3.dide.ic.ac.uk/.well-known/acme-challenge/BOHzIjplae56vjC7B_vopSTV5-0wOaO_7P8CTDmeICE:
"<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="v"
Domain: five.epicollect.net
Type: unauthorized
Detail: Invalid response from
http://five.epicollect.net/.well-known/acme-challenge/rEJVv8HOl48SSAQfjKm2GPCnHHFA8HKjIqEuVclMs-4:
"<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>Index of /.well-known/acme-challenge</title>
</"
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.
I tried removing the directory listing, I placed an index.html instead, still no luck.
Now I am locked out after a few attempts There were too many requests of a given type :: Error creating new authz :: Too many invalid authorizations recently.
so I need to wait 1 hour at least, right?
edit: If I remove .well-know/acme-challenge folders from fi--ec5dev3.dide.ic.ac.uk certbot does not create them and I get a 404
edit 2:
using curl curl -i http://fi--ec5dev3.dide.ic.ac.uk/.well-known/acme-challenge/test | cat -A
But also everything else in that folder redirects to the other FOLDER.
So, http://five.epicollect.net/.well-known/acme-challenge/test.txt
returns
http://fi–ec5dev3.dide.ic.ac.uk/.well-known/acme-challenge/
NOT
http://fi–ec5dev3.dide.ic.ac.uk/.well-known/acme-challenge/test.txt
as expected.
Hi @rg305 thanks for spotting that, I fixed the redirect.
I am using an .htaccess file with:
RewriteEngine on
RewriteRule ^(.*)$ http://fi--ec5dev3.dide.ic.ac.uk/.well-known/acme-challenge/$1 [R=301]
Not the redirection appears to work, but I still get a 404:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for fi--ec5dev3.dide.ic.ac.uk
http-01 challenge for five.epicollect.net
Using the webroot path /var/www/html_prod/shared/public for all unmatched domains.
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. five.epicollect.net (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://five.epicollect.net/.well-known/acme-challenge/EB0tCZQhn9kQlsoOuojuiTXqoiz-NrqPQOmoxNkk5zE: "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p", fi--ec5dev3.dide.ic.ac.uk (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://fi--ec5dev3.dide.ic.ac.uk/.well-known/acme-challenge/8SMtvsSKu2PG1xlDhzjg6-_1ZX9fG5t-51hKRaU8lic: "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p"
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: five.epicollect.net
Type: unauthorized
Detail: Invalid response from
http://five.epicollect.net/.well-known/acme-challenge/EB0tCZQhn9kQlsoOuojuiTXqoiz-NrqPQOmoxNkk5zE:
"<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p"
Domain: fi--ec5dev3.dide.ic.ac.uk
Type: unauthorized
Detail: Invalid response from
http://fi--ec5dev3.dide.ic.ac.uk/.well-known/acme-challenge/8SMtvsSKu2PG1xlDhzjg6-_1ZX9fG5t-51hKRaU8lic:
"<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p"
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.
you don’t really show enough of your coding to be sure…
But it may be that:
RewriteEngine on
RewriteRule ^(.*)$ http://fi–ec5dev3.dide.ic.ac.uk/.well-known/acme-challenge/$1 [R=301]
I do not have any other code to show you, I only have a .htaccess with
RewriteEngine on
RewriteRule ^(.*)$ http://fi--ec5dev3.dide.ic.ac.uk/.well-known/acme-challenge/$1 [R=301]
on five.epicollect.net, my main domain, which has got already a LetsEncrypt certificate.
The redirection works fine, have you tried?
if you open the http://five.epicollect.net/.well-known/acme-challenge/xxx in your browser, you are redirected to http://fi–ec5dev3.dide.ic.ac.uk/.well-known/acme-challenge/xxx, and a 404 error because obviously xxx does not exist. All as expected.
On my main domain five.epicollect.net, there is a redirection from http to https since there is already a certificate installed, could that be the problem?
It looks like Cerbot cannot create the temporary files for the verification.
@schoen, I suppose the manual mode would be my only option here?
Do you mean that, because of the symlink, /var/www/html_prod/shared/public and /var/www/html_prod/current/public are the same directory? Can you double-check that with