Ok, you got me there. I was running certbot 1.12.0 but I removed it, installed snapd, certbot, certbot-dns-route53 and now
~# certbot --version
certbot 2.11.0
but still:
# sudo certbot certonly --register-unsafely-without-email --agree-tos --preferred-challenges dns -d crm.linkscrambler.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
How would you like to authenticate with the ACME CA?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Apache Web Server plugin (apache)
2: Obtain certificates using a DNS TXT record (if you are using AWS Route53 for
DNS). (dns-route53)
3: Runs an HTTP server locally which serves the necessary validation files under
the /.well-known/acme-challenge/ request path. Suitable if there is no HTTP
server already running. HTTP challenge only (wildcards not supported).
(standalone)
4: Saves the necessary validation files to a .well-known/acme-challenge/
directory within the nominated webroot path. A seperate HTTP server must be
running and serving files from the webroot path. HTTP challenge only (wildcards
not supported). (webroot)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-4] then [enter] (press 'c' to cancel): 2
An unexpected error occurred:
ValueError: Requesting acme-v02.api.letsencrypt.org/directory: Network is unreachable
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
server ~ # HTTPS_PROXY=https://localhost/ certbot show_account
Saving debug log to /var/log/letsencrypt/letsencrypt.log
An unexpected error occurred:
requests.exceptions.ProxyError: HTTPSConnectionPool(host='acme-v02.api.letsencrypt.org', port=443): Max retries exceeded with url: /directory (Caused by ProxyError('Unable to connect to proxy', SSLError(SSLCertVerificationError(1, "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'localhost'. (_ssl.c:1004)"))))
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
server ~ #
(I'm not running a proxy on localhost, just testing the HTTPS_PROXY environment variable.. Without it Certbot of course works like a charm.)
But I'm not using Snap. Looking at the Certbot v1.9.0 changelog though, it should also work with Snap:
Upgraded the version of httplib2 used in our snaps and Docker images to add support for proxy environment variables (…)
Indeed, it worked fine but after a clean install. Maybe the old certbot version was not removed correctly or some leftover changes from when trying to troubleshoot it the first time.