Renewal failure: Failed authorization procedure

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.

Warning: I'm an amateur. I am running running virtual hosts and, strangely, only one of the virtual hosts (photos.kieranpr.com) has the error.

My domain is:

I ran this command:

sudo certbot renew --dry-run

It produced this output:

Waiting for verification...
Cleaning up challenges
Attempting to renew cert (kieranpr.com) from /etc/letsencrypt/renewal/kieranpr.com.conf produced an unexpected error: Failed authorization procedure. www.photos.kieranpr.com (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: 3.236.133.116: Invalid response from http://www.photos.kieranpr.com/.well-known/acme-challenge/bF1lkvh6FVXyGSlcYi6HU-i3ir1Nxv_wLoy-7Pc3iVA: 404, photos.kieranpr.com (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: 3.236.133.116: Invalid response from http://photos.kieranpr.com/.well-known/acme-challenge/SVRNUhxTGkaZQw9ngol8TbrGVbkzZ9IjC9RmVgSUrTo: 404. Skipping.
The following certs could not be renewed:
  /etc/letsencrypt/live/kieranpr.com/fullchain.pem (failure)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
** DRY RUN: simulating 'certbot renew' close to cert expiry
**          (The test certificates below have not been saved.)

The following certs were successfully renewed:
  /etc/letsencrypt/live/kieranpr.com-0001/fullchain.pem (success)

The following certs could not be renewed:
  /etc/letsencrypt/live/kieranpr.com/fullchain.pem (failure)
** DRY RUN: simulating 'certbot renew' close to cert expiry
**          (The test certificates above have not been saved.)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1 renew failure(s), 0 parse failure(s)

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

   Domain: www.photos.kieranpr.com
   Type:   unauthorized
   Detail: 3.236.133.116: Invalid response from
   http://www.photos.kieranpr.com/.well-known/acme-challenge/bF1lkvh6FVXyGSlcYi6HU-i3ir1Nxv_wLoy-7Pc3iVA:
   404

   Domain: photos.kieranpr.com
   Type:   unauthorized
   Detail: 3.236.133.116: Invalid response from
   http://photos.kieranpr.com/.well-known/acme-challenge/SVRNUhxTGkaZQw9ngol8TbrGVbkzZ9IjC9RmVgSUrTo:
   404

   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.29

The operating system my web server runs on is (include version):

Ubuntu 18.04

My hosting provider, if applicable, is:

AWS

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):

certbot 0.27.0

Welcome to the community @kieran2

Can you show the result of this? It should match your DNS entry 3.236.133.116

curl -4 ifconfig.co

If you don't have an Elastic IP AWS may assign new IP after instance restarts.

If that matches can you show result of this command for any certs related to that domain?

sudo certbot certificates

Because it looks like you have used two different methods to create the cert and one of them is failing. Hopefully the one you are not using.

The following certs were successfully renewed:
  /etc/letsencrypt/live/kieranpr.com-0001/fullchain.pem (success)

The following certs could not be renewed:
  /etc/letsencrypt/live/kieranpr.com/fullchain.pem (failure)
1 Like

Hi Mike - thanks.

I don't have an Elastic IP but I don't think the instance has restarted/my other 'domains' are fine

curl -4 ifconfig.co

3.236.133.116

sudo certbot certificates

Found the following certs:
Certificate Name: kieranpr.com-0001
Domains: kieranpr.com data.kieranpr.com www.data.kieranpr.com www.kieranpr.com
Expiry Date: 2022-07-23 13:50:39+00:00 (VALID: 89 days)
Certificate Path: /etc/letsencrypt/live/kieranpr.com-0001/fullchain.pem
Private Key Path: /etc/letsencrypt/live/kieranpr.com-0001/privkey.pem
Certificate Name: kieranpr.com
Domains: kieranpr.com data.kieranpr.com photos.kieranpr.com www.data.kieranpr.com www.kieranpr.com www.photos.kieranpr.com
Expiry Date: 2022-05-26 18:52:37+00:00 (VALID: 32 days)
Certificate Path: /etc/letsencrypt/live/kieranpr.com/fullchain.pem
Private Key Path: /etc/letsencrypt/live/kieranpr.com/privkey.pem

OK. Checking your server it is sending the cert that expires in 32 days and includes the photos domain.

So, you should delete the unused cert to avoid confusion (and unneeded work by LE). Did you create this while debugging the failing photos domain?

sudo certbot delete --cert-name kieranpr.com-0001

The photos domain must have worked ~60 days ago to get in the cert expiring in 32. Can you show the contents of this file? Blackout the account id if you wish:

sudo cat /etc/letsencrypt/renewal/kieranpr.com.conf

and show output of this:

sudo apachectl -S

Thanks

2 Likes

Thanks Mike. I deleted the one I created in debugging. And you're right that the cert worked before for all three 'domains' - I also don't think I've changed the photos 'domain' config since; but could be wrong.

Output of sudo cat /etc/letsencrypt/renewal/kieranpr.com.conf:

version = 0.27.0
archive_dir = /etc/letsencrypt/archive/kieranpr.com
cert = /etc/letsencrypt/live/kieranpr.com/cert.pem
privkey = /etc/letsencrypt/live/kieranpr.com/privkey.pem
chain = /etc/letsencrypt/live/kieranpr.com/chain.pem
fullchain = /etc/letsencrypt/live/kieranpr.com/fullchain.pem

# Options used in the renewal process
[renewalparams]
account =
authenticator = apache
installer = apache
server = https://acme-v02.api.letsencrypt.org/directory

Output of sudo apachectl -S:

VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server kieranpr.com (/etc/apache2/sites-enabled/000-kieranpr.conf:1)
         port 80 namevhost kieranpr.com (/etc/apache2/sites-enabled/000-kieranpr.conf:1)
                 alias www.kieranpr.com
         port 80 namevhost data.kieranpr.com (/etc/apache2/sites-enabled/data.kieranpr-le-ssl.conf:17)
                 alias www.data.kieranpr.com
         port 80 namevhost data.kieranpr.com (/etc/apache2/sites-enabled/data.kieranpr.conf:1)
                 alias www.data.kieranpr.com
         port 80 namevhost kieranpr.com (/etc/apache2/sites-enabled/kieranpr-le-ssl.conf:17)
                 alias www.kieranpr.com
         port 80 namevhost photos.kieranpr.com (/etc/apache2/sites-enabled/photos.kieranpr-le-ssl.conf:17)
                 alias www.photos.kieranpr.com
         port 80 namevhost photos.kieranpr.com (/etc/apache2/sites-enabled/photos.kieranpr.conf:1)
                 alias www.photos.kieranpr.com
*:443                  is a NameVirtualHost
         default server kieranpr.com (/etc/apache2/sites-enabled/000-kieranpr.conf:14)
         port 443 namevhost kieranpr.com (/etc/apache2/sites-enabled/000-kieranpr.conf:14)
                 alias www.kieranpr.com
         port 443 namevhost data.kieranpr.com (/etc/apache2/sites-enabled/data.kieranpr-le-ssl.conf:2)
                 alias www.data.kieranpr.com
         port 443 namevhost data.kieranpr.com (/etc/apache2/sites-enabled/data.kieranpr.conf:14)
                 alias www.data.kieranpr.com
         port 443 namevhost kieranpr.com (/etc/apache2/sites-enabled/kieranpr-le-ssl.conf:2)
                 alias www.kieranpr.com
         port 443 namevhost photos.kieranpr.com (/etc/apache2/sites-enabled/photos.kieranpr-le-ssl.conf:2)
                 alias www.photos.kieranpr.com
         port 443 namevhost photos.kieranpr.com (/etc/apache2/sites-enabled/photos.kieranpr.conf:14)
                 alias www.photos.kieranpr.com
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex default: dir="/var/run/apache2/" mechanism=default 
Mutex watchdog-callback: using_defaults

Multiple name:port overlaps found.

This is a big defect in Apache - which allows for this to happen [without even a warning].

2 Likes

@kieran2 Rudy beat me to it! If you need help resolving it please show the contents of each of the apache conf files. Start with just the photos domain files as a similar fix will probably apply to data

2 Likes

You should probably upgrade that. Ubuntu 18 supports snap install.

I think there were some "edge cases" in the older certbot that could cause the duplication you see. I am not certain but 0.27 is quite old anyway.

1 Like

Thanks both - appreciate the help - also apologies I don't know how to quote/markdown properly!

/etc/apache2/sites-enabled/photos.kieranpr-le-ssl.conf is:

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerAdmin admin@kieranpr.com
    ServerName photos.kieranpr.com
    ServerAlias www.photos.kieranpr.com
    DocumentRoot /var/www/photos.kieranpr
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined


Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/kieranpr.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/kieranpr.com/privkey.pem
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:80>
    ServerAdmin admin@kieranpr.com
    ServerName photos.kieranpr.com
    ServerAlias www.photos.kieranpr.com
    DocumentRoot /var/www/photos.kieranpr
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
# Some rewrite rules in this file were disabled on your HTTPS site,
# because they have the potential to create redirection loops.

# RewriteCond %{SERVER_NAME} =photos.kieranpr.com [OR]
# RewriteCond %{SERVER_NAME} =www.photos.kieranpr.com
# RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

</VirtualHost>
</IfModule>

/etc/apache2/sites-enabled/photos.conf is:`

<VirtualHost *:80>
    ServerAdmin admin@kieranpr.com
    ServerName photos.kieranpr.com
    ServerAlias www.photos.kieranpr.com
    DocumentRoot /var/www/photos.kieranpr
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.photos.kieranpr.com [OR]
RewriteCond %{SERVER_NAME} =photos.kieranpr.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<VirtualHost *:443>
        ServerName photos.kieranpr.com
        ServerAlias www.photos.kieranpr.com
        ServerAdmin admin@kieranpr.com
        DocumentRoot /var/www/photos.kieranpr

        SSLEngine on
        Include /etc/letsencrypt/options-ssl-apache.conf
        SSLCertificateFile /etc/letsencrypt/live/kieranpr.com/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/kieranpr.com/privkey.pem
</VirtualHost>

Thanks for adding this. Makes me feel less like an idiot :slight_smile:

2 Likes

I am stepping away for a while but works best to put three backticks before and after each group. Add some regular text between consecutive such blocks. Like:
```
text here
```
And more:
```
second part
```

2 Likes

Ok. I'll take a go at it. If you manually setup these VirtualHosts this should work. If certbot did this then you should upgrade your 0.27 as I noted.

This is just for photos. The other dupes are probably similar. I'll leave that to you to sort.

From:
/etc/apache2/sites-enabled/photos.kieranpr-le-ssl.conf

Remove this VirtualHost entirely:

<IfModule mod_ssl.c>
<VirtualHost *:80>
    ServerAdmin admin@kieranpr.com
    ServerName photos.kieranpr.com
    ServerAlias www.photos.kieranpr.com
    DocumentRoot /var/www/photos.kieranpr
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
# Some rewrite rules in this file were disabled on your HTTPS site,
# because they have the potential to create redirection loops.

# RewriteCond %{SERVER_NAME} =photos.kieranpr.com [OR]
# RewriteCond %{SERVER_NAME} =www.photos.kieranpr.com
# RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

</VirtualHost>
</IfModule>

And, from:
/etc/apache2/sites-enabled/photos.conf
Remove this VirtualHost entirely:

<VirtualHost *:443>
        ServerName photos.kieranpr.com
        ServerAlias www.photos.kieranpr.com
        ServerAdmin admin@kieranpr.com
        DocumentRoot /var/www/photos.kieranpr

        SSLEngine on
        Include /etc/letsencrypt/options-ssl-apache.conf
        SSLCertificateFile /etc/letsencrypt/live/kieranpr.com/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/kieranpr.com/privkey.pem
</VirtualHost>
2 Likes

(I upgraded certbot when you said, forgot to mention.)

Mike, you're a legend. Thanks for giving up your time. Makes sense too that the ssl contains 443 config and the non-ssl is on port 80.

2 Likes

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