Infomaniak / certbot-dns-infomaniak

Infomaniak DNS Authenticator plugin for certbot
Apache License 2.0
34 stars 13 forks source link

certbot.errors.PluginError: cannot authenticate #35

Closed julpec closed 7 months ago

julpec commented 7 months ago

Hello,

I'm having problems setting up my certificate for a wildcard. After creating an application token, I ran the following command:

certbot certonly --authenticator dns-infomaniak --dns-infomaniak-credentials certbot_infomaniak_api.ini --server https://acme-v02.api.letsencrypt.org/directory -d domain.org

here's the return:

Encountered exception during recovery: certbot.errors.PluginError: cannot authenticate
cannot authenticate

and what's in the logs:

2024-04-20 17:06:19,202:DEBUG:certbot._internal.error_handler:Calling registered functions
2024-04-20 17:06:19,202:INFO:certbot._internal.auth_handler:Cleaning up challenges
2024-04-20 17:06:19,203:DEBUG:certbot_dns_infomaniak.dns_infomaniak:del_txt_record domain.org _acme-challenge.domain.org
AW3EokeIlgWCrKzuChN6-lf6HhraBzenfNRNviFHpy0
2024-04-20 17:06:19,204:DEBUG:certbot_dns_infomaniak.dns_infomaniak:GET https://api.infomaniak.com/1/product?service_name=domain&customer_name=domain.org
2024-04-20 17:06:19,206:DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.infomaniak.com:443
2024-04-20 17:06:19,480:DEBUG:urllib3.connectionpool:https://api.infomaniak.com:443 "GET /1/product?service_name=domain&customer_name=domain.org HTTP/1.1" 401 84
2024-04-20 17:06:19,482:ERROR:certbot._internal.error_handler:Encountered exception during recovery: certbot.errors.PluginError: cannot authenticate
2024-04-20 17:06:19,485:DEBUG:certbot._internal.log:Exiting abnormally:
Traceback (most recent call last):
  File "/root/.local/bin/certbot", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/root/.local/pipx/venvs/certbot-dns-infomaniak/lib/python3.11/site-packages/certbot/main.py", line 19, in main
    return internal_main.main(cli_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/certbot-dns-infomaniak/lib/python3.11/site-packages/certbot/_internal/main.py", line 1894, in main
    return config.func(config, plugins)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/certbot-dns-infomaniak/lib/python3.11/site-packages/certbot/_internal/main.py", line 1600, in certonly
    lineage = _get_and_save_cert(le_client, config, domains, certname, lineage)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/certbot-dns-infomaniak/lib/python3.11/site-packages/certbot/_internal/main.py", line 143, in _get_and_save_cert
    lineage = le_client.obtain_and_enroll_certificate(domains, certname)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/certbot-dns-infomaniak/lib/python3.11/site-packages/certbot/_internal/client.py", line 517, in obtain_and_enroll_certificate
    cert, chain, key, _ = self.obtain_certificate(domains)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/certbot-dns-infomaniak/lib/python3.11/site-packages/certbot/_internal/client.py", line 428, in obtain_certificate
    orderr = self._get_order_and_authorizations(csr.data, self.config.allow_subset_of_names)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/certbot-dns-infomaniak/lib/python3.11/site-packages/certbot/_internal/client.py", line 496, in _get_order_and_authorizations
    authzr = self.auth_handler.handle_authorizations(orderr, self.config, best_effort)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/certbot-dns-infomaniak/lib/python3.11/site-packages/certbot/_internal/auth_handler.py", line 88, in handle_authorizations
    resps = self.auth.perform(achalls)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/certbot-dns-infomaniak/lib/python3.11/site-packages/certbot/plugins/dns_common.py", line 76, in perform
    self._perform(domain, validation_domain_name, validation)
  File "/root/.local/pipx/venvs/certbot-dns-infomaniak/lib/python3.11/site-packages/certbot_dns_infomaniak/dns_infomaniak.py", line 64, in _perform
    self._api_client().add_txt_record(decoded_domain, validation_name, validation)
  File "/root/.local/pipx/venvs/certbot-dns-infomaniak/lib/python3.11/site-packages/certbot_dns_infomaniak/dns_infomaniak.py", line 213, in add_txt_record
    (domain_id, domain_name) = self._find_zone(domain)
                               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/certbot-dns-infomaniak/lib/python3.11/site-packages/certbot_dns_infomaniak/dns_infomaniak.py", line 193, in _find_zone
    result = self._get_request(
             ^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/certbot-dns-infomaniak/lib/python3.11/site-packages/certbot_dns_infomaniak/dns_infomaniak.py", line 108, in _get_request
    raise errors.PluginError("cannot authenticate")
certbot.errors.PluginError: cannot authenticate
2024-04-20 17:06:19,492:ERROR:certbot._internal.log:cannot authenticate
reneluria commented 7 months ago

This has been resolved in version 0.2.0 two years ago

https://github.com/Infomaniak/certbot-dns-infomaniak/commit/36fa777c02def1c88b2e77ba8eadc0f8c38889ab

julpec commented 7 months ago

I'm on version 0.2.2 with certbot 2.10.0

julpec commented 7 months ago

can you reopen the issue as the problem is not solved ? tks