Error renewing production certificates

Hi,

I have two servers, staging and production. The staging server is still renewing as expected with the following commands, but I can no longer renew on production using http-01. Previously, I needed to manually renew using DNS, but I would like to reset up automatic renewal.

Any advice appreciated.

-G

My domain is: api.cogrammar.com

I ran this command:
sudo certbot renew --apache --preferred-challenges http --dry-run

It produced this output:
Saving debug log to /var/log/letsencrypt/letsencrypt.log


Processing /etc/letsencrypt/renewal/api.cogrammar.com.conf


Cert is due for renewal, auto-renewing…
Plugins selected: Authenticator apache, Installer apache
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for api.cogrammar.com
http-01 challenge for hyperiondev.cogrammar.com
Waiting for verification…
Cleaning up challenges
Attempting to renew cert (api.cogrammar.com) from /etc/letsencrypt/renewal/api.cogrammar.com.conf produced an unexpected error: Failed authorization procedure. api.cogrammar.com (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from https://api.cogrammar.com/.well-known/acme-challenge/3NufqUa1X5AWnbYkwc1J9UCxoyIXkrrFmagjPMg5OxQ [52.14.210.95]: "

Not Found

The requested URL /.well-known/acme-challenge/3NufqUa1X5AWnbYkwc1J9UCxoyIXkrrFmagjPMg5OxQ was not found on ". Skipping.


Processing /etc/letsencrypt/renewal/demo.cogrammar.com.conf


Cert not due for renewal, but simulating renewal for dry run
Plugins selected: Authenticator apache, Installer apache
Renewing an existing certificate


new certificate deployed with reload of apache server; fullchain is
/etc/letsencrypt/live/demo.cogrammar.com/fullchain.pem


The following certs could not be renewed:
/etc/letsencrypt/live/api.cogrammar.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/demo.cogrammar.com/fullchain.pem (success)

The following certs could not be renewed:
/etc/letsencrypt/live/api.cogrammar.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:

My web server is (include version):
ubuntu@api.cogrammar.com:~$ apache2 -v
Server version: Apache/2.4.29 (Ubuntu)
Server built: 2019-09-16T12:58:48

The operating system my web server runs on is (include version):
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic

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

1 Like

Hi @garethdwyer

your command uses --apache. That adds a location definition, so the standard redirect shouldn't be used.

But

Letsencrypt sees that redirect.

Looks like your Apache configuration is buggy.

What says

apachectl -S
1 Like

Thanks for the response. It does indeed show an error

AH00526: Syntax error on line 48 of /etc/apache2/sites-enabled/000-default-le-ssl.conf:
SSLCertificateFile: file '/etc/letsencrypt/live/api.cogrammar.com/fullchain.pem' does not exist or is empty
Action '-S' failed.
The Apache error log may have more information.

and yet the site currently has a valid certificate.

1 Like

I fixed this by

  • making backups of the -le-ssl.conf virtualhosts in /etc/apache2/sites-enabled that letsencrypt created
  • disabling these with sudo a2dissite api.cogrammar.com.conf and sudo a2dissite hyperiondev.cogrammar.com.conf
  • getting LetsEncrypt to recreate these files with a new certificate with
sudo certbot -d api.cogrammar.com -d hyperiondev.cogrammar.com --apache 
3 Likes

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