Can't renew cert on OSX apache

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. https://crt.sh/?q=example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is: spectreknows.me

I ran this command: sudo certbot renew --dry-run

It produced this output: $ sudo certbot renew --dry-run
Saving debug log to /var/log/letsencrypt/letsencrypt.log


Processing /etc/letsencrypt/renewal/spectreknows.me.conf


Cert is due for renewal, auto-renewing…
Plugins selected: Authenticator webroot, Installer None
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for spectreknows.me
Using the webroot path /Users/mono1/git/spectre/client/build for all unmatched domains.
Waiting for verification…
Challenge failed for domain spectreknows.me
http-01 challenge for spectreknows.me
Cleaning up challenges
Attempting to renew cert (spectreknows.me) from /etc/letsencrypt/renewal/spectreknows.me.conf produced an unexpected error: Some challenges have failed… Skipping.
All renewal attempts failed. The following certs could not be renewed:
/etc/letsencrypt/live/spectreknows.me/fullchain.pem (failure)


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

All renewal attempts failed. The following certs could not be renewed:
/etc/letsencrypt/live/spectreknows.me/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: spectreknows.me
    Type: connection
    Detail: Fetching
    https://spectreknows.me.well-known/acme-challenge/CzRnD0gN-DOww3GDXulYxcac1zc0PTH4-ATWnrhHi3M:
    Invalid host in redirect target “spectreknows.me.well-known”. Check
    webserver config for missing ‘/’ in redirect target.

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

My web server is (include version): Apache/2.4.34 (Unix)

The operating system my web server runs on is (include version): OS X 10.14, Darwin Kernel Version 18.0.0

My hosting provider, if applicable, is:

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 1.0.0

Your HTTP to HTTPS redirect is missing a slash (/).

Thanks for the quick reply. I fixed that problem (I think), now I get the following (I’m wondering if it is because the site is password protected via htaccess) ?

$ certbot renew
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/spectreknows.me.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cert is due for renewal, auto-renewing...
Plugins selected: Authenticator webroot, Installer None
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for spectreknows.me
Using the webroot path /Users/mono1/git/spectre/client/build for all unmatched domains.
Waiting for verification...
Challenge failed for domain spectreknows.me
http-01 challenge for spectreknows.me
Cleaning up challenges
Attempting to renew cert (spectreknows.me) from /etc/letsencrypt/renewal/spectreknows.me.conf produced an unexpected error: Some challenges have failed.. Skipping.
All renewal attempts failed. The following certs could not be renewed:
  /etc/letsencrypt/live/spectreknows.me/fullchain.pem (failure)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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

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

   Domain: spectreknows.me
   Type:   unauthorized
   Detail: Invalid response from
   https://spectreknows.me/.well-known/acme-challenge/EBHNqLaRdeKaIKd2Vze7Guh_lgZz-jP-_N_FUq4PJhU
   [144.214.18.68]: "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML
   2.0//EN\">\n<html><head>\n<title>401
   Unauthorized</title>\n</head><body>\n<h1>Unauthorized</"

Well, probably. I'm pretty sure the Let's Encrypt servers can't hack their way through your password protection :wink:

You should allow access to /.well-known/acme-challenge/ without a password protection.

Right, I was thinking that. So I just added an exclusion rule for .well-known (which doesn’t exist) in my htaccess. Now I get the error below. Is this because I have rewrite rules (for react) in my htaccess ?

RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]

Error:

$ certbot renew
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/spectreknows.me.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cert is due for renewal, auto-renewing...
Plugins selected: Authenticator webroot, Installer None
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for spectreknows.me
Using the webroot path /Users/mono1/git/spectre/client/build for all unmatched domains.
Waiting for verification...
Challenge failed for domain spectreknows.me
http-01 challenge for spectreknows.me
Cleaning up challenges
Attempting to renew cert (spectreknows.me) from /etc/letsencrypt/renewal/spectreknows.me.conf produced an unexpected error: Some challenges have failed.. Skipping.
All renewal attempts failed. The following certs could not be renewed:
  /etc/letsencrypt/live/spectreknows.me/fullchain.pem (failure)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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

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

   Domain: spectreknows.me
   Type:   unauthorized
   Detail: Invalid response from
   https://spectreknows.me/.well-known/acme-challenge/ewIJP77Xl_hBmio8dQsU7z_sh6RKkS3BlbLKbpG3b2s
   [144.214.18.68]: "<!doctype html><html lang=\"en\"><head><meta
   charset=\"utf-8\"/><link rel=\"shortcut icon\"
   href=\"/favicon.ico\"/><meta name=\"viewport\""

   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.

Yes.   

Does certbot create that directory and file during the renew process, then delete it?

Any idea how I can exclude that single directory from the rewrite rules?

See the Apache documentation for RewriteCond.

Getting there, maybe. So I added the .well-known directory and placed a htaccess inside that disables the rewriting. So I can now access test files at, for example: https://spectreknows.me/.well-known/acme-challenge/file
But I get the following error:

 - The following errors were reported by the server:

   Domain: spectreknows.me
   Type:   unauthorized
   Detail: Invalid response from
   https://spectreknows.me/.well-known/acme-challenge/2ePIT3plqYURFHf0kAUEe87FaAf5QXxWYfZS_Y2E32s
   [144.214.18.68]: "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML
   2.0//EN\">\n<html><head>\n<title>404 Not
   Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p"

How does that file come into being?
https://spectreknows.me/.well-known/acme-challenge/2ePIT3plqYURFHf0kAUEe87FaAf5QXxWYfZS_Y2E32s

It's placed there by certbot. It's different for every different authorization. As the previous authorization failed, you're getting a new authorization and therefore, a different token and a different filename (and probably different contents).

Ok, looks like I got it. There was an old path for webroot in /etc/letsencrypt/renewal/spectreknows.me.conf. Thanks for your help!

Is there a guide somewhere as to how to make renewal happen automatically in the future, with a cron or launchctl or whatever?

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/spectreknows.me.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cert is due for renewal, auto-renewing...
Plugins selected: Authenticator webroot, Installer None
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for spectreknows.me
Using the webroot path /Library/WebServer/Documents/spectre for all unmatched domains.
Waiting for verification...
Cleaning up challenges

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
new certificate deployed without reload, fullchain is
/etc/letsencrypt/live/spectreknows.me/fullchain.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Congratulations, all renewals succeeded. The following certs have been renewed:
  /etc/letsencrypt/live/spectreknows.me/fullchain.pem (success)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

See item 6: https://certbot.eff.org/lets-encrypt/osx-other.html

Yeah, so I see that that cronjob was already there. I’m guessing it ran and failed, then I got the reminder email about the expiration. So I will wait another 90 days to see if there is any issue

Thanks again for your help

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