NextCloud Auto Setup - ConnectionError: HTTPSConnectionPool(host='acme-v02.api.letsencrypt.org', port=443): Max retries exceeded with url: /directory


#1

Domain: files.oshawk.uk
OS: Ubuntu 18.04
Command: nextcloud.enable-https lets-encrypt
Output:

Attempting to obtain certificates... error running certbot:

Saving debug log to /var/snap/nextcloud/current/certs/certbot/logs/letsencrypt.log
Plugins selected: Authenticator nextcloud:webroot, Installer None
An unexpected error occurred:
ConnectionError: HTTPSConnectionPool(host='acme-v02.api.letsencrypt.org', port=443): Max retries exceeded with url: /directory (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fea5805b710>: Failed to establish a new connection: [Errno -2] Name or service not known',))

Log file:

2018-09-29 11:56:37,946:DEBUG:certbot.main:certbot version: 0.26.1
2018-09-29 11:56:37,947:DEBUG:certbot.main:Arguments: ['--text', '--config-dir', '/var/snap/nextcloud/current/certs/certbot/config', '--work-dir', '/var/snap/nextcloud/current/certs/certbot/work', '--logs-dir', '/var/snap/nextcloud/current/certs/certbot/logs', '--authenticator', 'nextcloud:webroot', '--nextcloud:webroot-path', '/var/snap/nextcloud/current/certs/certbot', '--rsa-key-size', '4096', '--email', 'oshawk@protonmail.com', '--non-interactive', '--agree-tos', '--force-renewal', '-d', 'files.oshawk.uk']
2018-09-29 11:56:37,947:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#manual,PluginEntryPoint#nextcloud:webroot,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot)
2018-09-29 11:56:37,988:DEBUG:certbot.log:Root logging level set at 20
2018-09-29 11:56:37,990:INFO:certbot.log:Saving debug log to /var/snap/nextcloud/current/certs/certbot/logs/letsencrypt.log
2018-09-29 11:56:37,991:DEBUG:certbot.plugins.selection:Requested authenticator nextcloud:webroot and installer None
2018-09-29 11:56:38,002:DEBUG:certbot.plugins.selection:Single candidate plugin: * nextcloud:webroot
Description: Place files in webroot directory without running chown
Interfaces: IAuthenticator, IPlugin
Entry point: webroot = certbot_nextcloud_plugin.webroot:Authenticator
Initialized: <certbot_nextcloud_plugin.webroot.Authenticator object at 0x7fc3c2518f50>
Prep: True
2018-09-29 11:56:38,003:DEBUG:certbot.plugins.selection:Selected authenticator <certbot_nextcloud_plugin.webroot.Authenticator object at 0x7fc3c2518f50> and installer None
2018-09-29 11:56:38,003:INFO:certbot.plugins.selection:Plugins selected: Authenticator nextcloud:webroot, Installer None
2018-09-29 11:56:38,690:DEBUG:acme.client:Sending GET request to https://acme-v02.api.letsencrypt.org/directory.
2018-09-29 11:56:38,697:DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org:443
2018-09-29 11:56:38,700:DEBUG:certbot.log:Exiting abnormally:
Traceback (most recent call last):
  File "/snap/nextcloud/8971/bin/certbot", line 11, in <module>
    sys.exit(main())
  File "/snap/nextcloud/8971/lib/python2.7/site-packages/certbot/main.py", line 1364, in main
    return config.func(config, plugins)
  File "/snap/nextcloud/8971/lib/python2.7/site-packages/certbot/main.py", line 1238, in certonly
    le_client = _init_le_client(config, auth, installer)
  File "/snap/nextcloud/8971/lib/python2.7/site-packages/certbot/main.py", line 641, in _init_le_client
    acc, acme = _determine_account(config)
  File "/snap/nextcloud/8971/lib/python2.7/site-packages/certbot/main.py", line 520, in _determine_account
    config, account_storage, tos_cb=_tos_cb)
  File "/snap/nextcloud/8971/lib/python2.7/site-packages/certbot/client.py", line 180, in register
    acme = acme_from_config_key(config, key)
  File "/snap/nextcloud/8971/lib/python2.7/site-packages/certbot/client.py", line 50, in acme_from_config_key
    return acme_client.BackwardsCompatibleClientV2(net, key, config.server)
  File "/snap/nextcloud/8971/lib/python2.7/site-packages/acme/client.py", line 744, in __init__
    directory = messages.Directory.from_json(net.get(server).json())
  File "/snap/nextcloud/8971/lib/python2.7/site-packages/acme/client.py", line 1078, in get
    self._send_request('GET', url, **kwargs), content_type=content_type)
  File "/snap/nextcloud/8971/lib/python2.7/site-packages/acme/client.py", line 1027, in _send_request
    response = self.session.request(method, url, *args, **kwargs)
  File "/snap/nextcloud/8971/lib/python2.7/site-packages/requests/sessions.py", line 512, in request
    resp = self.send(prep, **send_kwargs)
  File "/snap/nextcloud/8971/lib/python2.7/site-packages/requests/sessions.py", line 622, in send
    r = adapter.send(request, **kwargs)
  File "/snap/nextcloud/8971/lib/python2.7/site-packages/requests/adapters.py", line 513, in send
    raise ConnectionError(e, request=request)
ConnectionError: HTTPSConnectionPool(host='acme-v02.api.letsencrypt.org', port=443): Max retries exceeded with url: /directory (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fc3c2512710>: Failed to establish a new connection: [Errno -2] Name or service not known',))
2018-09-29 11:56:38,703:ERROR:certbot.log:An unexpected error occurred:

Attempts to fix:

  • Changing dns server to 8.8.8.8.
  • Running curl https://acme-v02.api.letsencrypt.org/directory (produces expected output of some JSON).

Things to note:

  • I have a sucessfully generated cert for blog.oshawk.uk on another server.

Thanks for any help.


#2

Hello,
Same configuration : ubuntu 18.04, freshly installed and up to date
Nextcloud installed with snap (snap install nextcloud)
same command : nextcloud.enable-https lets-encrypt
same issue :

    Please enter your domain name(s) (space-separated): cloud.langues82.fr
    Attempting to obtain certificates... error running certbot:
    Saving debug log to /var/snap/nextcloud/current/certs/certbot/logs/letsencrypt.log
    Plugins selected: Authenticator nextcloud:webroot, Installer None
    An unexpected error occurred:
    ConnectionError: HTTPSConnectionPool(host='acme-v02.api.letsencrypt.org', port=443): Max retries exceeded with url: /directory (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xffff9b2fa850>: Failed to establish a new connection: [Errno -2] Name or service not known',))
    Please see the logfiles in /var/snap/nextcloud/current/certs/certbot/logs for more details.

Here are the logs :

2018-09-29 14:27:56,790:DEBUG:certbot.main:certbot version: 0.26.1
2018-09-29 14:27:56,794:DEBUG:certbot.main:Arguments: [’–text’, ‘–config-dir’, ‘/var/snap/nextcloud/current/certs/certbot/config’, ‘–work-dir’, ‘/var/snap/nextcloud/current/certs/certbot/work’, ‘–logs-dir’, ‘/var/snap/nextcloud/current/certs/certbot/logs’, ‘–authenticator’, ‘nextcloud:webroot’, ‘–nextcloud:webroot-path’, ‘/var/snap/nextcloud/current/certs/certbot’, ‘–rsa-key-size’, ‘4096’, ‘–email’, ‘guillaumedesgranges@autistici.org’, ‘–non-interactive’, ‘–agree-tos’, ‘–force-renewal’, ‘-d’, ‘cloud.langues82.fr’]
2018-09-29 14:27:56,794:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#manual,PluginEntryPoint#nextcloud:webroot,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot)
2018-09-29 14:27:56,910:DEBUG:certbot.log:Root logging level set at 20
2018-09-29 14:27:56,915:INFO:certbot.log:Saving debug log to /var/snap/nextcloud/current/certs/certbot/logs/letsencrypt.log
2018-09-29 14:27:56,919:DEBUG:certbot.plugins.selection:Requested authenticator nextcloud:webroot and installer None
2018-09-29 14:27:56,955:DEBUG:certbot.plugins.selection:Single candidate plugin: * nextcloud:webroot
Description: Place files in webroot directory without running chown
Interfaces: IAuthenticator, IPlugin
Entry point: webroot = certbot_nextcloud_plugin.webroot:Authenticator
Initialized: <certbot_nextcloud_plugin.webroot.Authenticator object at 0xffff9b301c90>
Prep: True
2018-09-29 14:27:56,960:DEBUG:certbot.plugins.selection:Selected authenticator <certbot_nextcloud_plugin.webroot.Authenticator object at 0xffff9b301c90> and installer None
2018-09-29 14:27:56,961:INFO:certbot.plugins.selection:Plugins selected: Authenticator nextcloud:webroot, Installer None
2018-09-29 14:28:07,592:DEBUG:acme.client:Sending GET request to https://acme-v02.api.letsencrypt.org/directory.
2018-09-29 14:28:07,609:DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org:443
2018-09-29 14:28:07,616:DEBUG:certbot.log:Exiting abnormally:
Traceback (most recent call last):
File “/snap/nextcloud/8972/bin/certbot”, line 11, in
sys.exit(main())
File “/snap/nextcloud/8972/lib/python2.7/site-packages/certbot/main.py”, line 1364, in main
return config.func(config, plugins)
File “/snap/nextcloud/8972/lib/python2.7/site-packages/certbot/main.py”, line 1238, in certonly
le_client = _init_le_client(config, auth, installer)
File “/snap/nextcloud/8972/lib/python2.7/site-packages/certbot/main.py”, line 641, in _init_le_client
acc, acme = _determine_account(config)
File “/snap/nextcloud/8972/lib/python2.7/site-packages/certbot/main.py”, line 520, in _determine_account
config, account_storage, tos_cb=_tos_cb)
File “/snap/nextcloud/8972/lib/python2.7/site-packages/certbot/client.py”, line 180, in register
acme = acme_from_config_key(config, key)
File “/snap/nextcloud/8972/lib/python2.7/site-packages/certbot/client.py”, line 50, in acme_from_config_key
return acme_client.BackwardsCompatibleClientV2(net, key, config.server)
File “/snap/nextcloud/8972/lib/python2.7/site-packages/acme/client.py”, line 744, in init
directory = messages.Directory.from_json(net.get(server).json())
File “/snap/nextcloud/8972/lib/python2.7/site-packages/acme/client.py”, line 1078, in get
self._send_request(‘GET’, url, **kwargs), content_type=content_type)
File “/snap/nextcloud/8972/lib/python2.7/site-packages/acme/client.py”, line 1027, in _send_request
response = self.session.request(method, url, *args, **kwargs)
File “/snap/nextcloud/8972/lib/python2.7/site-packages/requests/sessions.py”, line 512, in request
resp = self.send(prep, **send_kwargs)
File “/snap/nextcloud/8972/lib/python2.7/site-packages/requests/sessions.py”, line 622, in send
r = adapter.send(request, **kwargs)
File “/snap/nextcloud/8972/lib/python2.7/site-packages/requests/adapters.py”, line 513, in send
raise ConnectionError(e, request=request)
ConnectionError: HTTPSConnectionPool(host=‘acme-v02.api.letsencrypt.org’, port=443): Max retries exceeded with url: /directory (Caused by NewConnectionError(’<urllib3.connection.VerifiedHTTPSConnection object at 0xffff9b2fa850>: Failed to establish a new connection: [Errno -2] Name or service not known’,))
2018-09-29 14:28:07,621:ERROR:certbot.log:An unexpected error occurred:

curl is working :

root@cloud:~# curl https://acme-v02.api.letsencrypt.org/directory
{
“UmSSCSEb-eY”: “Adding random entries to the directory”,
“keyChange”: “https://acme-v02.api.letsencrypt.org/acme/key-change”,
“meta”: {
“caaIdentities”: [
letsencrypt.org
],
“termsOfService”: “https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf”,
“website”: “https://letsencrypt.org
},
“newAccount”: “https://acme-v02.api.letsencrypt.org/acme/new-acct”,
“newNonce”: “https://acme-v02.api.letsencrypt.org/acme/new-nonce”,
“newOrder”: “https://acme-v02.api.letsencrypt.org/acme/new-order”,
“revokeCert”: “https://acme-v02.api.letsencrypt.org/acme/revoke-cert

And no idea to fix it…
Many thanks if someone is inspired.
Guillaume


#3

Do you happen to be hosted with Scaleway?


#4

Ahhhhh yeah :cold_sweat:
I used to have a lot of issues of this type with scaleway… but the 50 GB SSD are cheap…
Anyway, I tried to instance an ubuntu 16.04, it worked perfectly : my cloud is working with https.
So this is solved for me.
Thanks for your question, that contains the answer…


#5

Yes… they certainly do a lot of weird things. It took me a while to get sudo working as the config is not the default for some reason. I will have a look at their 18.04 docker file and see what has happened this time to cause the issue. Thanks for your suggestion of using 16.04 though, I may have to resort to that.


#6

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