Hello everybody.
I have the following dockerized structure.
- Reverse proxy (nginx)
- Nextcloud service
- Custom certbot service (running with cron)
The certbot service and the reverse proxy have one common volume to share the certificate files (e.g .pem file) The communication between the reverse proxy and the nextcloud instance is done in plain http and not https.
I'm pretty sure that this same structure last time worked and managed successfully to renew the certificate but suddenly I'm dealing with the following:
/var/log/letsencrypt/letsencrypt.log
2023-04-12 17:47:04,027:DEBUG:acme.client:Storing nonce: B37CfrJCEbMZQ8SJfuCzFEJJHPj2cyRUVhwP-3DwTf_gRRE
2023-04-12 17:47:04,028:INFO:certbot._internal.auth_handler:Challenge failed for domain cloud.eigenval.xyz
2023-04-12 17:47:04,028:INFO:certbot._internal.auth_handler:http-01 challenge for cloud.eigenval.xyz
2023-04-12 17:47:04,029:DEBUG:certbot._internal.display.obj:Notifying user:
Certbot failed to authenticate some domains (authenticator: nginx). The Certificate Authority reported these problems:
Domain: cloud.eigenval.xyz
Type: unauthorized
Detail: 94.130.148.89: Invalid response from https://cloud.eigenval.xyz/.well-known/acme-challenge/PZFnLMgdXShlupzOXi1BvOSAqWR7pmDfu8tVGO_VJJI: 404
Hint: The Certificate Authority failed to verify the temporary nginx configuration changes made by Certbot. Ensure the listed domains point to this nginx server and that it is acc
essible from the internet.
2023-04-12 17:47:04,030:DEBUG:certbot._internal.error_handler:Encountered exception:
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/certbot/_internal/auth_handler.py", line 90, in handle_authorizations
self._poll_authorizations(authzrs, max_retries, best_effort)
File "/usr/lib/python3.9/site-packages/certbot/_internal/auth_handler.py", line 178, in _poll_authorizations
raise errors.AuthorizationError('Some challenges have failed.')
certbot.errors.AuthorizationError: Some challenges have failed.
2023-04-12 17:47:04,030:DEBUG:certbot._internal.error_handler:Calling registered functions
2023-04-12 17:47:04,030:INFO:certbot._internal.auth_handler:Cleaning up challenges
2023-04-12 17:47:05,164:ERROR:certbot._internal.renewal:Failed to renew certificate cloud.eigenval.xyz with error: Some challenges have failed.
2023-04-12 17:47:05,167:DEBUG:certbot._internal.renewal:Traceback was:
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/certbot/_internal/renewal.py", line 475, in handle_renewal_request
main.renew_cert(lineage_config, plugins, renewal_candidate)
File "/usr/lib/python3.9/site-packages/certbot/_internal/main.py", line 1386, in renew_cert
renewed_lineage = _get_and_save_cert(le_client, config, lineage=lineage)
File "/usr/lib/python3.9/site-packages/certbot/_internal/main.py", line 122, in _get_and_save_cert
renewal.renew_cert(config, domains, le_client, lineage)
File "/usr/lib/python3.9/site-packages/certbot/_internal/renewal.py", line 335, in renew_cert
new_cert, new_chain, new_key, _ = le_client.obtain_certificate(domains, new_key)
File "/usr/lib/python3.9/site-packages/certbot/_internal/client.py", line 389, in obtain_certificate
orderr = self._get_order_and_authorizations(csr.data, self.config.allow_subset_of_names)
File "/usr/lib/python3.9/site-packages/certbot/_internal/client.py", line 439, in _get_order_and_authorizations
authzr = self.auth_handler.handle_authorizations(orderr, self.config, best_effort)
File "/usr/lib/python3.9/site-packages/certbot/_internal/auth_handler.py", line 90, in handle_authorizations
self._poll_authorizations(authzrs, max_retries, best_effort)
File "/usr/lib/python3.9/site-packages/certbot/_internal/auth_handler.py", line 178, in _poll_authorizations
raise errors.AuthorizationError('Some challenges have failed.')
certbot.errors.AuthorizationError: Some challenges have failed.
2023-04-12 17:47:05,167:DEBUG:certbot._internal.display.obj:Notifying user:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2023-04-12 17:47:05,167:ERROR:certbot._internal.renewal:All simulated renewals failed. The following certificates could not be renewed:
2023-04-12 17:47:05,167:ERROR:certbot._internal.renewal: /etc/letsencrypt/live/cloud.eigenval.xyz/fullchain.pem (failure)
2023-04-12 17:47:05,168:DEBUG:certbot._internal.display.obj:Notifying user:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2023-04-12 17:47:05,168:DEBUG:certbot._internal.log:Exiting abnormally:
Traceback (most recent call last):
File "/usr/bin/certbot", line 33, in <module>
sys.exit(load_entry_point('certbot==1.21.0', 'console_scripts', 'certbot')())
File "/usr/lib/python3.9/site-packages/certbot/main.py", line 15, in main
return internal_main.main(cli_args)
File "/usr/lib/python3.9/site-packages/certbot/_internal/main.py", line 1574, in main
return config.func(config, plugins)
File "/usr/lib/python3.9/site-packages/certbot/_internal/main.py", line 1460, in renew
renewal.handle_renewal_request(config)
File "/usr/lib/python3.9/site-packages/certbot/_internal/renewal.py", line 500, in handle_renewal_request
raise errors.Error("{0} renew failure(s), {1} parse failure(s)".format(
certbot.errors.Error: 1 renew failure(s), 0 parse failure(s)
2023-04-12 17:47:05,168:ERROR:certbot._internal.log:1 renew failure(s), 0 parse failure(s)
The nginx config looks like:
server {
server_name cloud.eigenval.xyz;
listen [::]:443 ssl http2 ipv6only=on;
listen 443 ssl http2;
ssl_certificate /etc/letsencrypt/live/cloud.eigenval.xyz/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/cloud.eigenval.xyz/privkey.pem;
include snippets/ssl-params.conf;
client_max_body_size 100M;
location / {
proxy_pass http://10.0.0.3:80;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_pass_header Server;
proxy_cache_bypass $http_upgrade;
proxy_hide_header X-Frame-Options;
proxy_redirect off;
}
# Make a regex exception for `/.well-known` so that clients can still
# access it despite the existence of the regex rule
# `location ~ /(\.|autotest|...)` which would otherwise handle requests
# for `/.well-known`.
location ^~ /.well-known {
# The rules in this block are an adaptation of the rules
# in `.htaccess` that concern `/.well-known`.
location = /.well-known/carddav { return 301 /remote.php/dav/; }
location = /.well-known/caldav { return 301 /remote.php/dav/; }
location /.well-known/acme-challenge { try_files $uri $uri/ =404; }
location /.well-known/pki-validation { try_files $uri $uri/ =404; }
# Let Nextcloud's API for `/.well-known` URIs handle all other
# requests by passing them to the front-end controller.
return 301 /index.php$request_uri;
}
}
And finally the command that cron runs is the certbot renew --quiet
What could possible go wrong?
Thanks in advance.