ctrlaltcoop / certbot-dns-hetzner

Certbot plugin enabling dns-01 challenge on the Hetzner DNS API
Other
155 stars 24 forks source link

Malformed authorization or invalid API token #5

Closed Arkshine closed 4 years ago

Arkshine commented 4 years ago

Hi,

Ubuntu 20, new installation.

This is what I got with this command:

certbot certonly --authenticator certbot-dns-hetzner:dns-hetzner --certbot-dns-hetzner:dns-hetzner-credentials /root/.secret/certbot/credential.ini --agree-tos --email contact@domain.com -n --expand -d domain.com -d *.domain.com

root@domain~# certbot certonly --authenticator certbot-dns-hetzner:dns-hetzner --certbot-dns-hetzner:dns-hetzner-credentials /root/.secret/certbot/credential.ini --agree-tos --email contact@domain.com -n --expand -d domain.com -d *.domain.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator certbot-dns-hetzner:dns-hetzner, Installer None
Obtaining a new certificate
Performing the following challenges:
dns-01 challenge for zuzu.tools
dns-01 challenge for zuzu.tools
Cleaning up challenges
Encountered exception during recovery:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/certbot_dns_hetzner/dns_hetzner.py", line 51, in _perform
    self._get_hetzner_client().add_record(
  File "/usr/local/lib/python3.8/dist-packages/certbot_dns_hetzner/hetzner_client.py", line 72, in add_record
    zone_id = self._get_zone_id_by_domain(domain)
  File "/usr/local/lib/python3.8/dist-packages/certbot_dns_hetzner/hetzner_client.py", line 169, in _get_zone_id_by_domain
    raise _NotAuthorizedException()
certbot_dns_hetzner.hetzner_client._NotAuthorizedException: Malformed authorization or invalid API token

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/certbot/_internal/auth_handler.py", line 70, in handle_authorizations
    resps = self.auth.perform(achalls)
  File "/usr/local/lib/python3.8/dist-packages/certbot/plugins/dns_common.py", line 57, in perform
    self._perform(domain, validation_domain_name, validation)
  File "/usr/local/lib/python3.8/dist-packages/certbot_dns_hetzner/dns_hetzner.py", line 64, in _perform
    raise errors.PluginError(exception)
certbot.errors.PluginError: Malformed authorization or invalid API token

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/certbot_dns_hetzner/dns_hetzner.py", line 68, in _cleanup
    self._get_hetzner_client().delete_record_by_name(domain, self._fqdn_format(validation_name))
  File "/usr/local/lib/python3.8/dist-packages/certbot_dns_hetzner/hetzner_client.py", line 103, in delete_record_by_name
    zone_id = self._get_zone_id_by_domain(domain)
  File "/usr/local/lib/python3.8/dist-packages/certbot_dns_hetzner/hetzner_client.py", line 169, in _get_zone_id_by_domain
    raise _NotAuthorizedException()
certbot_dns_hetzner.hetzner_client._NotAuthorizedException: Malformed authorization or invalid API token

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/certbot/_internal/error_handler.py", line 125, in _call_registered
    self.funcs[-1]()
  File "/usr/local/lib/python3.8/dist-packages/certbot/_internal/auth_handler.py", line 243, in _cleanup_challenges
    self.auth.cleanup(achalls)
  File "/usr/local/lib/python3.8/dist-packages/certbot/plugins/dns_common.py", line 76, in cleanup
    self._cleanup(domain, validation_domain_name, validation)
  File "/usr/local/lib/python3.8/dist-packages/certbot_dns_hetzner/dns_hetzner.py", line 70, in _cleanup
    raise errors.PluginError(exception)
certbot.errors.PluginError: Malformed authorization or invalid API token
Malformed authorization or invalid API token

IMPORTANT NOTES:
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.

Config file is something like (old & removed key):

certbot_dns_hetzner:dns_hetzner_api_token = oC0T9iQpWLkmHIsrxowM29xWNdH44q3Ow46wOBof6qHULz4X16XYmK9XD15Lwllo

I've tried to generate another API key, but same result.

Any idea what would the issue?

Arkshine commented 4 years ago

Nevermind, I've confused the Server API and DNS API. Sorry!