Docker-letsencrypt-nginx-proxy-companion: Key Error: 'new Account' when adding container for certificate requtest

Created on 10 Dec 2019  路  4Comments  路  Source: nginx-proxy/docker-letsencrypt-nginx-proxy-companion

Hi,

I'm facing a situation where no certificate is being issued but the vhost.d of the nginx-proxy is seems to be updated properly when a new container
I'm using the following compose yaml to setup proxy and companion. And all of the containers are starting up fine with no complains in the logs.

version: '3.7'
networks:
  ext:
volumes:
  certs:
  vhosts:
  html:
services:
  nginxproxy:
    image: jwilder/nginx-proxy
    container_name: nginxproxy
    hostname: nginxproxy
    restart:
      unless-stopped
    networks:
      - ext
    volumes:
      - certs:/etc/nginx/certs:ro
      - vhosts:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
      - ${DIR_NGINX_CONF}:/etc/nginx/conf.d
      - ${DIR_DHPARAM}:/etc/nginx/dhparam
      - /var/run/docker.sock:/tmp/docker.sock:ro
    ports:
      - 80:80
      - 443:443
    labels:
      - com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy
  nginxproxy_comp:
    image: jrcs/letsencrypt-nginx-proxy-companion
    container_name: nginxproxy_comp
    hostname: nginxproxy_comp
    restart:
      unless-stopped
    depends_on:
      - nginxproxy
    networks:
      - ext
    volumes:
      - certs:/etc/nginx/certs:rw
      - vhosts:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
      - ${DIR_NGINX_CONF}:/etc/nginx/conf.d
      - ${DIR_DHPARAM}:/etc/nginx/dhparam
      - /var/run/docker.sock:/var/run/docker.sock:ro
    environment:
      - ACME_CA_URI=https://acme-staging.api.letsencrypt.org/directory
  watchtower:
    image: v2tec/watchtower
    volumes: 
      - /var/run/docker.sock:/var/run/docker.sock
    command: --interval 3600

but for example an nginx webserver is added with:

docker run -d --name webtest --network=le_ext -e LETSENCRYPT_HOST=static.test.mytestdomain.com -e LETSENCRYPT_EMAIL=mytestdomain.com -e VIRTUAL_HOST=static.mytestdomain.com -e VIRTUAL_PORT=80 nginx

I see the following trace information in the companion log:

2019-12-10 08:02:23,794:INFO:simp_le:1353: By using simp_le, you implicitly agree to the CA's terms of service: https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/acme/messages.py", line 249, in __getitem__
    return self._jobj[self._canon_key(name)]
KeyError: 'newAccount'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/simp_le.py", line 1565, in main
    return main_with_exceptions(cli_args)
  File "/usr/lib/python3.7/site-packages/simp_le.py", line 1549, in main_with_exceptions
    persist_new_data(args, existing_data)
  File "/usr/lib/python3.7/site-packages/simp_le.py", line 1408, in persist_new_data
    args, existing_data.account_key, existing_data.account_reg)
  File "/usr/lib/python3.7/site-packages/simp_le.py", line 1357, in registered_client
    client.new_account(new_reg)
  File "/usr/lib/python3.7/site-packages/acme/client.py", line 604, in new_account
    response = self._post(self.directory['newAccount'], new_account)
  File "/usr/lib/python3.7/site-packages/acme/messages.py", line 251, in __getitem__
    raise KeyError('Directory field not found')
KeyError: 'Directory field not found'

Unhandled error has happened, traceback is above

As a result it seems to me the nginx proxy can't answer a request via SSL because the companion did not provde a key for the key exchange. Because Google did not help either I'm a bit lost here. Any ideas folks?

Documentation Update

Most helpful comment

    environment:
      - ACME_CA_URI=https://acme-staging.api.letsencrypt.org/directory

JrCs/docker-letsencrypt-nginx-proxy-companion is no longer compatible with ACME v1 endpoints, as ACME v1 is being deprecated.

Please update your container image and config accordingly.

All 4 comments

    environment:
      - ACME_CA_URI=https://acme-staging.api.letsencrypt.org/directory

JrCs/docker-letsencrypt-nginx-proxy-companion is no longer compatible with ACME v1 endpoints, as ACME v1 is being deprecated.

Please update your container image and config accordingly.

Hi,
Thank you very much!
In this case I propose to update the example in Wiki accordingly. ACME_CA_URI still points out to v1. It should rather have the value of v2 _https://acme-staging-v02.api.letsencrypt.org/directory_

Thanks for pointing that out, I'll update the wiki ASAP.

Fixed.

Was this page helpful?
0 / 5 - 0 ratings