My domain is:
https://wiki.healthylondon.org
I ran this command:
sudo certbot renew --webroot -w /opt/bitnami/apache2/htdocs
It produced this output:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
-------------------------------------------------------------------------------
Processing /etc/letsencrypt/renewal/wiki.healthylondon.org.conf
-------------------------------------------------------------------------------
Cert is due for renewal, auto-renewing...
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for wiki.healthylondon.org
Using the webroot path /opt/bitnami/apache2/htdocs for all unmatched domains.
Waiting for verification...
Cleaning up challenges
Unable to clean up challenge directory /opt/bitnami/apache2/htdocs/.well-known/acme-challenge
Attempting to renew cert from /etc/letsencrypt/renewal/wiki.healthylondon.org.conf produced an unexpected error: Failed authorization procedure. wiki.healthylondon.org (http-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: Fetching https://wiki.healthylondon.org.well-known/acme-challenge/<TOKEN>: Error getting validation data. Skipping.
All renewal attempts failed. The following certs could not be renewed:
/etc/letsencrypt/live/wiki.healthylondon.org/fullchain.pem (failure)
1 renew failure(s), 0 parse failure(s)
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: wiki.healthylondon.org
Type: connection
Detail: Fetching
https://wiki.healthylondon.org.well-known/acme-challenge/<TOKEN>:
Error getting validation data
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. 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.25 (Unix) (via Bitnami)
The operating system my web server runs on is (include version):
Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-116-generic x86_64)
My hosting provider, if applicable, is:
Bitnami MediaWiki stack deployed to Azure
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
So I’m able to renew certificates on a staging version of the site, which was originally setup with webroot. However, on this production server where I originally set things up using the apache plugin I am unable to renew the certs. Trying with the apache plugin that I originally used to set this up I get the following:
sudo certbot renew --apache --apache-server-root /opt/bitnami/apache2 --apache-challenge-location /opt/bitnami/apache2 --apache-handle-sites FALSE --apache-vhost-root /opt/bitnami/apache2/conf/bitnami
Saving debug log to /var/log/letsencrypt/letsencrypt.log
-------------------------------------------------------------------------------
Processing /etc/letsencrypt/renewal/wiki.healthylondon.org.conf
-------------------------------------------------------------------------------
Cert is due for renewal, auto-renewing...
Renewing an existing certificate
Performing the following challenges:
tls-sni-01 challenge for wiki.healthylondon.org
Error while running apache2ctl graceful.
httpd not running, trying to start
Action 'graceful' failed.
The Apache error log may have more information.
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Cleaning up challenges
Error while running apache2ctl graceful.
httpd not running, trying to start
Action 'graceful' failed.
The Apache error log may have more information.
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Encountered exception during recovery
Error while running apache2ctl graceful.
httpd not running, trying to start
Action 'graceful' failed.
The Apache error log may have more information.
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/certbot/error_handler.py", line 99, in _call_registered
self.funcs[-1]()
File "/usr/lib/python2.7/dist-packages/certbot/auth_handler.py", line 284, in _cleanup_challenges
self.auth.cleanup(achalls)
File "/usr/lib/python2.7/dist-packages/certbot_apache/configurator.py", line 1908, in cleanup
self.restart()
File "/usr/lib/python2.7/dist-packages/certbot_apache/configurator.py", line 1797, in restart
self._reload()
File "/usr/lib/python2.7/dist-packages/certbot_apache/configurator.py", line 1808, in _reload
raise errors.MisconfigurationError(str(err))
MisconfigurationError: Error while running apache2ctl graceful.
httpd not running, trying to start
Action 'graceful' failed.
The Apache error log may have more information.
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Attempting to renew cert from /etc/letsencrypt/renewal/wiki.healthylondon.org.conf produced an unexpected error: Error while running apache2ctl graceful.
httpd not running, trying to start
Action 'graceful' failed.
The Apache error log may have more information.
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
. Skipping.
All renewal attempts failed. The following certs could not be renewed:
/etc/letsencrypt/live/wiki.healthylondon.org/fullchain.pem (failure)
1 renew failure(s), 0 parse failure(s)
If I shut down the apache server first I get this error:
sudo certbot renew --apache --apache-server-root /opt/bitnami/apache2 --apache-challenge-location /opt/bitnami/apache2 --apache-handle-sites FALSE --apache-vhost-root /opt/bitnami/apache2/conf/bitnami
Saving debug log to /var/log/letsencrypt/letsencrypt.log
-------------------------------------------------------------------------------
Processing /etc/letsencrypt/renewal/wiki.healthylondon.org.conf
-------------------------------------------------------------------------------
Cert is due for renewal, auto-renewing...
Renewing an existing certificate
Performing the following challenges:
tls-sni-01 challenge for wiki.healthylondon.org
Waiting for verification...
Cleaning up challenges
Attempting to renew cert from /etc/letsencrypt/renewal/wiki.healthylondon.org.conf produced an unexpected error: Failed authorization procedure. wiki.healthylondon.org (tls-sni-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: Connection refused. Skipping.
All renewal attempts failed. The following certs could not be renewed:
/etc/letsencrypt/live/wiki.healthylondon.org/fullchain.pem (failure)
1 renew failure(s), 0 parse failure(s)
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: wiki.healthylondon.org
Type: connection
Detail: Connection refused
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. 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.
After trying various changes to the httpd.conf to try and open up port 80 (to no avail) I gave up and tried the webroot approach - as documented at the start of this post.
I’ve adjusted the httpd.conf to allow the .well-known/acme-challenge folder to be visible - I put in an index.html which I was able to see here (before I deleted it - see below):
https://wiki.healthylondon.org/.well-known/acme-challenge/
but the webroot approach also fails. What seems particularly suspect is that it says it is trying to fetch Fetching https://wiki.healthylondon.org.well-known/acme-challenge/TOKEN
so I wonder if the absence of that slash is preventing access to the webserver, although I can see from the logs that the correct hit is coming in:
133.202.198.78 - - [26/Jul/2017:04:00:17 +0000] “GET /.well-known/acme-challenge/ HTTP/1.1” 404 268
I just tried removing the .well-known/acme-challenge/
on the off chance that me having created it was preventing the certbot from creating it - and that didn’t help …
I also just tried doing things manually:
sudo certbot certonly --debug --force-renew -a manual -d wiki.healthylondon.org
and created the file with the contents myself and that also failed:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for wiki.healthylondon.org
-------------------------------------------------------------------------------
NOTE: The IP of this machine will be publicly logged as having requested this
certificate. If you're running certbot in manual mode on a machine that is not
your server, please ensure you're okay with that.
Are you OK with your IP being logged?
-------------------------------------------------------------------------------
(Y)es/(N)o: Y
-------------------------------------------------------------------------------
Make sure your web server displays the following content at
http://wiki.healthylondon.org/.well-known/acme-challenge/<TOKEN>-GWi9FcoIrbM before continuing:
<TOKEN>-<KEY>
If you don't have HTTP server configured, you can run the following
command on the target server (as root):
mkdir -p /tmp/certbot/public_html/.well-known/acme-challenge
cd /tmp/certbot/public_html
printf "%s" <TOKEN>-<KEY> > .well-known/acme-challenge<TOKEN>
# run only once per server:
$(command -v python2 || command -v python2.7 || command -v python2.6) -c \
"import BaseHTTPServer, SimpleHTTPServer; \
s = BaseHTTPServer.HTTPServer(('', 80), SimpleHTTPServer.SimpleHTTPRequestHandler); \
s.serve_forever()"
-------------------------------------------------------------------------------
Press Enter to Continue
Waiting for verification...
Cleaning up challenges
Exiting abnormally:
Traceback (most recent call last):
File "/usr/bin/certbot", line 11, in <module>
load_entry_point('certbot==0.14.2', 'console_scripts', 'certbot')()
File "/usr/lib/python2.7/dist-packages/certbot/main.py", line 742, in main
return config.func(config, plugins)
File "/usr/lib/python2.7/dist-packages/certbot/main.py", line 682, in certonly
lineage = _get_and_save_cert(le_client, config, domains, certname, lineage)
File "/usr/lib/python2.7/dist-packages/certbot/main.py", line 77, in _get_and_save_cert
renewal.renew_cert(config, domains, le_client, lineage)
File "/usr/lib/python2.7/dist-packages/certbot/renewal.py", line 296, in renew_cert
new_certr, new_chain, new_key, _ = le_client.obtain_certificate(domains)
File "/usr/lib/python2.7/dist-packages/certbot/client.py", line 313, in obtain_certificate
self.config.allow_subset_of_names)
File "/usr/lib/python2.7/dist-packages/certbot/auth_handler.py", line 81, in get_authorizations
self._respond(resp, best_effort)
File "/usr/lib/python2.7/dist-packages/certbot/auth_handler.py", line 138, in _respond
self._poll_challenges(chall_update, best_effort)
File "/usr/lib/python2.7/dist-packages/certbot/auth_handler.py", line 202, in _poll_challenges
raise errors.FailedChallenges(all_failed_achalls)
FailedChallenges: Failed authorization procedure. wiki.healthylondon.org (http-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: Fetching https://wiki.healthylondon.org.well-known/acme-challenge/<TOKEN>: Error getting validation data
Please see the logfiles in /var/log/letsencrypt for more details.
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: wiki.healthylondon.org
Type: connection
Detail: Fetching
https://wiki.healthylondon.org.well-known/acme-challenge/<TOKEN>:
Error getting validation data
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. 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.
looking at the access_log I think that I might have cached the file as empty when I checked it could be loaded:
bitnami@bitnami-mediawiki-8a65:/opt/bitnami/apache2/logs$ tail access_log
64.71.168.196 - - [26/Jul/2017:04:14:24 +0000] "HEAD /.well-known/acme-challenge/ HTTP/1.1" 200 -
64.71.168.196 - - [26/Jul/2017:04:14:24 +0000] "GET /.well-known/acme-challenge/ HTTP/1.1" 200 6
133.202.198.78 - - [26/Jul/2017:04:18:42 +0000] "GET /.well-known/acme-challenge/ HTTP/1.1" 404 225
133.202.198.78 - - [26/Jul/2017:04:18:43 +0000] "GET /favicon.ico HTTP/1.1" 200 99678
66.133.109.36 - - [26/Jul/2017:04:19:05 +0000] "GET /.well-known/acme-challenge/<TOKEN> HTTP/1.1" 301 308
66.133.109.36 - - [26/Jul/2017:04:23:37 +0000] "GET /.well-known/acme-challenge/<TOKEN> HTTP/1.1" 301 308
133.202.198.78 - - [26/Jul/2017:04:30:17 +0000] "GET /.well-known/acme-challenge/<TOKEN> HTTP/1.1" 200 -
133.202.198.78 - - [26/Jul/2017:04:30:35 +0000] "GET /.well-known/acme-challenge/<TOKEN> HTTP/1.1" 200 88
133.202.198.78 - - [26/Jul/2017:04:30:36 +0000] "GET /favicon.ico HTTP/1.1" 200 99678
66.133.109.36 - - [26/Jul/2017:04:30:52 +0000] "GET /.well-known/acme-challenge/<TOKEN> HTTP/1.1" 301 308
I was just about to try again but now I’ve tripped the too many request limits (maybe should have been using dry-run?) urgh …
Any insight into why some of the simpler methods don’t work would be very much appreciated. I’ll have another go at this manual method in a few hours …