Cannot get certificate for a domain, challenge fails

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. crt.sh | example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.
(see form below) I also did the following: I put a text file in the .well-known/acme-challenge directory and was able to access the file from outside the server.
My domain is: lpac-asterisk.covici.com

I ran this command:certbot -d lpac-asterisk.covici.com

It produced this output:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Requesting a certificate for lpac-asterisk.covici.com
Performing the following challenges:
http-01 challenge for lpac-asterisk.covici.com
Waiting for verification...
Challenge failed for domain lpac-asterisk.covici.com
http-01 challenge for lpac-asterisk.covici.com
Cleaning up challenges
Some challenges have failed.

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: lpac-asterisk.covici.com
   Type:   unauthorized
   Detail: 166.84.7.53: Invalid response from
   http://lpac-asterisk.covici.com/.well-known/acme-challenge/kS4usAGLw-UG_C1P1gnCV3HWDH9U-ivlNEEI4-SkVIY:
   403

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A/AAAA record(s) for that domain
   contain(s) the right IP address.

My web server is (include version):Apache/2.4.52 (Debian)

The operating system my web server runs on is (include version):Linux 5.10.0-8-cloud

My hosting provider, if applicable, is:panix.com

I can login to a root shell on my machine (yes or no, or I don't know):yes

I'm using a control panel to manage my site (no, or provide the name and version of the control panel):no

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot):1.12.0

Hi @covici, and welcome to the LE community forum :slight_smile:

403 error generally means that it required authentication.
I get a 404 error on that request.
Perhaps you didn't copy all of that message.

In any case, since we are dealing with Apache, let's start by verifying the config.
Show:
sudo apachectl -t -D DUMP_VHOSTS

3 Likes

Well, certbot deletes whats in acme-challenge, that is why you got the 404. All I get with that apachectl command is syntax ok, should I just give you whats in 00default.conf ?

I expected 404 not 403 as shown in your error message.

Please copy and paste the entire command [between the quotes]:
"sudo apachectl -t -D DUMP_VHOSTS"

It has to provide more than just "syntax ok".

3 Likes

OK, I got some of the case incorrectly as I had to copy by hand to another computer, so I get:

VirtualHost configuration:

*:80 lpac-asterisk.covici.com (/etc/apache2/sites-enabled/000-default.conf:1)

Is that all of the output?

Let's have a look at that file.

3 Likes

OK, here is the actual config file

<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName [www.example.com](http://www.example.com)
ServerName lpac-asterisk.covici.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
#RewriteEngine on
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

You could try removing all the commented lines.
Like this:

<VirtualHost *:80>
ServerName lpac-asterisk.covici.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

If that fails, you could try using --webroot.
For that, you shoud first place a test text file in the expected challenge location:
/var/www/html/.well-known/acme-challenge/{some-file-name}
[you may need to create that complete file path first]
And then see if you can reach that test file from the Internet.
http://lpac-asterisk.covici.com/.well-known/acme-challenge/{same-file-name-as-above}

2 Likes

Removing the comments did not do anything. I was able to get the file 123.txt from outside my server like this

http://lpac-asterisk.covici.com/.well-known/acme-challenge/123.txt

You should be able to do this yourself.

I just wanted to say thanks for all your help so far.

1 Like

Ok I would suggest we test with --webroot.

certbot certonly \
--webroot -w /var/www/html \
-d lpac-asterisk.covici.com \
--cert-name testing \
--test-cert
2 Likes

My reply by Email is not getting through, I am getting 4.3.2 Please try again later.

I hope the reply gets through.

Meanwhile, here is the output of the command you had me put in:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Enter email address (used for urgent renewal and security notices)
 (Enter 'c' to cancel): covici@ccs.covici.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf. You must
agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: y

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: n
Account registered.
Requesting a certificate for lpac-asterisk.covici.com
Performing the following challenges:
http-01 challenge for lpac-asterisk.covici.com
Using the webroot path /var/www/html for all unmatched domains.
Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/testing/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/testing/privkey.pem
   Your certificate will expire on 2024-02-15. To obtain a new or
   tweaked version of this certificate in the future, simply run
   certbot again. To non-interactively renew *all* of your
   certificates, run "certbot renew"

Perfect.
Let's check on that cert status with:

certbot certificates

Then we can delete it [it's only a test cert - not valid].
And we can get you a real cert :slight_smile:

2 Likes

Well, I still cannot send mail, so here is the output of your command:

certbot certificates
Saving debug log to /var/log/letsencrypt/letsencrypt.log


Found the following certs:
Certificate Name: testing
Serial Number: fa171d261a3b098c3fba956d37ed54548c6d
Key Type: RSA
Domains: lpac-asterisk.covici.com
Expiry Date: 2024-02-15 04:01:19+00:00 (INVALID: TEST_CERT)
Certificate Path: /etc/letsencrypt/live/testing/fullchain.pem
Private Key Path: /etc/letsencrypt/live/testing/privkey.pem


I'm not sure what that requires...

But this needs to be replaced:

Let's start with deleting that TEST CERT:
certbot delete --cert-name testing

Then check that is has been removed:
certbot certificates

3 Likes

Here is the output from the delete, which number should I choose?

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Cert not yet due for renewal

You have an existing certificate that has exactly the same domains or certificate name you requested and isn't close to expiry.
(ref: /etc/letsencrypt/renewal/testing.conf)

What would you like to do?


1: Attempt to reinstall this existing certificate
2: Renew & replace the certificate (may be subject to CA rate limits)


Select the appropriate number [1-2] then [enter] (press 'c' to cancel):

You must have mistyped something in that command.
You are being asked to create a new cert.
Press "c" to cancel that request.
Then copy&paste this command:

certbot delete --cert-name testing

It should produce:

certbot delete --cert-name testing
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
The following certificate(s) are selected for deletion:

  * testing

WARNING: Before continuing, ensure that the listed certificates are not being
used by any installed server software (e.g. Apache, nginx, mail servers).
Deleting a certificate that is still being used will cause the server software
to stop working. See https://certbot.org/deleting-certs for information on
deleting certificates safely.

Are you sure you want to delete the above certificate(s)?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o:
2 Likes

OK, this time it worked, must have typed it wrong. So now, how to proceed?

Try:

certbot certonly \
--webroot -w /var/www/html \
-d lpac-asterisk.covici.com \
--cert-name LPAC
2 Likes

OK, that was successful, now how do I make that cert actually work?

Thanks.

1 Like