Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup only removes the 1st TXT dns entry if more than 1 domain is given #2

Closed
robertoschwald opened this issue Apr 17, 2020 · 5 comments · Fixed by #3
Closed

Cleanup only removes the 1st TXT dns entry if more than 1 domain is given #2

robertoschwald opened this issue Apr 17, 2020 · 5 comments · Fixed by #3
Labels
bug Something isn't working

Comments

@robertoschwald
Copy link

robertoschwald commented Apr 17, 2020

If more than one domain name is given on issue, only the first entry is removed on cleanup.

e.g.

sudo certbot --installer apache \
  --authenticator certbot-dns-hetzner:dns-hetzner \
  --certbot-dns-hetzner:dns-hetzner-credentials /etc/sysconfig/mycred.ini \
  -d host1.xx.yyy \
  -d host2.xx.yyy

This generates 2 challenge TXT dns entries, but at the end leads to:

Waiting for verification...
Cleaning up challenges
Starting new HTTPS connection (1): dns.hetzner.com
Encountered exception during recovery:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/certbot/_internal/error_handler.py", line 125, in _call_registered
    self.funcs[-1]()
  File "/usr/lib/python2.7/site-packages/certbot/_internal/auth_handler.py", line 243, in _cleanup_challenges
    self.auth.cleanup(achalls)
  File "/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.py", line 76, in cleanup
    self._cleanup(domain, validation_domain_name, validation)
  File "/usr/lib/python2.7/site-packages/certbot_dns_hetzner/dns_hetzner.py", line 71, in _cleanup
    self._get_hetzner_client().delete_record(record_id=self.record_id)
  File "/usr/lib/python2.7/site-packages/certbot_dns_hetzner/hetzner_client.py", line 106, in delete_record
    raise _MalformedResponseException('Status code not 200')
_MalformedResponseException: Received an unexpected response from Hetzner API:
Status code not 200
Created an SSL vhost at /etc/httpd/conf.d/vhost-le-ssl.conf

Then I need to cleanup the challenge manually from the DNS table.

OS is CentOS7.

@matze19999
Copy link

Can confirm on Debian for Docker

@l0rn
Copy link

l0rn commented Apr 20, 2020

Will investigate this

@l0rn l0rn added the bug Something isn't working label Apr 20, 2020
l0rn pushed a commit that referenced this issue Apr 20, 2020
Turns out a stateful authenticator can lead to problems. In this case
having multiple domains to challenge would overwrite record_id,
meaning that during cleanup only one id will actually be deleting.

We are now resorting to a stateless call with only domain name and record name.
We resolve the correct record id by iterating hetzners responses.
@l0rn l0rn closed this as completed in #3 Apr 21, 2020
l0rn pushed a commit that referenced this issue Apr 21, 2020
Fix bug not properly deleting entries during cleanup #2
@l0rn
Copy link

l0rn commented Apr 21, 2020

I had a bad fight with github action filters, but you should have a proper version with 1.0.3 now containing this fix

@robertoschwald
Copy link
Author

1.0.2 with the fix was already available to pip ;-)

@l0rn
Copy link

l0rn commented Apr 21, 2020

Yeah that was a GitHub action mess up ;) from now versioning should continue in an orderly fashion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants