You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are getting invalid responses from ZeroSSL challenge requests, but can't tell why they are invalid. Instead, the crypto module is crashing with the below exception when trying to handle the challenge response. It looks like there just needs to be a check on type attribute here to make sure it actually exists. Maybe just print out the response body if there's not a better way to decode the error here?
Please note, this set of tasks has worked previously. This request is renewing an existing certificate, which might be related to the error. However, we can't even see the error to be sure because of this exception.
"module_stderr": "Traceback (most recent call last):
File "", line 100, in
File "", line 92, in _ansiballz_main
File "", line 41, in invoke_module
File "/usr/lib64/python3.6/runpy.py", line 205, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/tmp/ansible_community.crypto.acme_certificate_payload_2zt5rlrh/ansible_community.crypto.acme_certificate_payload.zip/ansible_collections/community/crypto/plugins/modules/acme_certificate.py", line 950, in
File "/tmp/ansible_community.crypto.acme_certificate_payload_2zt5rlrh/ansible_community.crypto.acme_certificate_payload.zip/ansible_collections/community/crypto/plugins/modules/acme_certificate.py", line 920, in main
File "/tmp/ansible_community.crypto.acme_certificate_payload_2zt5rlrh/ansible_community.crypto.acme_certificate_payload.zip/ansible_collections/community/crypto/plugins/modules/acme_certificate.py", line 766, in finish_challenges
File "/tmp/ansible_community.crypto.acme_certificate_payload_2zt5rlrh/ansible_community.crypto.acme_certificate_payload.zip/ansible_collections/community/crypto/plugins/module_utils/acme/challenges.py", line 316, in wait_for_validation
File "/tmp/ansible_community.crypto.acme_certificate_payload_2zt5rlrh/ansible_community.crypto.acme_certificate_payload.zip/ansible_collections/community/crypto/plugins/module_utils/acme/challenges.py", line 234, in raise_error
File "/tmp/ansible_community.crypto.acme_certificate_payload_2zt5rlrh/ansible_community.crypto.acme_certificate_payload.zip/ansible_collections/community/crypto/plugins/module_utils/acme/errors.py", line 30, in format_error_problem
KeyError: 'type'
Execution Environment based on quay.io/ansible/ansible-runner:latest
STEPS TO REPRODUCE
- name: "Generate the private key file for the SSL certificate."community.crypto.openssl_privatekey:
path: "{{ zerossl_key }}"mode: 0644
- name: "Generate a Certificate Signing Request for {{ zerossl_common_name }}."community.crypto.openssl_csr:
path: "{{ zerossl_csr }}"privatekey_path: "{{ zerossl_key }}"common_name: "{{ zerossl_common_name }}"organization_name: <REDACTED>
- name: "Make sure the account key is setup on the Vargo account."community.crypto.acme_account:
account_key_src: "{{ zerossl_account_key }}"external_account_binding:
<REDACTED>contact:
<REDACTED>terms_agreed: trueacme_directory: https://acme.zerossl.com/v2/DV90acme_version: 2request_timeout: 60state: present
- name: "Generate the ACME challenge for {{ zerossl_common_name }}, using DNS method."community.crypto.acme_certificate:
account_key_src: "{{ zerossl_account_key }}"account_email: "{{ zerossl_account_email }}"csr: "{{ zerossl_csr }}"cert: "{{ zerossl_crt }}"chain: "{{ zerossl_intermediate }}"fullchain: "{{ zerossl_fullchain }}"challenge: dns-01acme_directory: https://acme.zerossl.com/v2/DV90acme_version: 2request_timeout: 60register: zerossl_challenge
- name: Set record facts.set_fact:
the_record_name: "{{ zerossl_challenge.challenge_data[zerossl_common_name]['dns-01'].record }}."the_record_data: "{{ zerossl_challenge.challenge_data[zerossl_common_name]['dns-01'].resource_value | regex_replace('^(.*)$', '\"\\1\"') }}"
- name: "Fulfill the DNS challenge via GoDaddy API."include_role:
name: djungle_io.godaddy_ansible_rolevars:
godaddy_domain_name: "{{ zerossl_domain }}"godaddy_record_name: "{{ the_record_name }}"record_data: "{{ the_record_data }}"type: TXTttl: 600when: zerossl_challenge is changed and zerossl_common_name in zerossl_challenge.challenge_data
- name: Make sure DNS is resolving before completing the challenge.debug:
msg: "Waiting for {{ the_record_name }} to resolve in DNS."until: lookup('community.general.dig', the_record_name, qtype='TXT') == the_record_dataretries: 30delay: 10# EXCEPTION HAPPENS ON THIS TASK
- name: "Let the challenge be validated and retrieve the certificate."community.crypto.acme_certificate:
data: "{{ zerossl_challenge }}"account_key_src: "{{ zerossl_account_key }}"account_email: "{{ zerossl_account_email }}"csr: "{{ zerossl_csr }}"cert: "{{ zerossl_crt }}"chain: "{{ zerossl_intermediate }}"fullchain: "{{ zerossl_fullchain }}"challenge: dns-01acme_directory: https://acme.zerossl.com/v2/DV90acme_version: 2request_timeout: 60when: zerossl_challenge is changed
EXPECTED RESULTS
We should get some information about the error response here, not a traceback from the module crashing.
ACTUAL RESULTS
Module crashed with this traceback.
"module_stderr": "Traceback (most recent call last):
File \"<stdin>\", line 100, in <module>
File \"<stdin>\", line 92, in _ansiballz_main
File \"<stdin>\", line 41, in invoke_module
File \"/usr/lib64/python3.6/runpy.py\", line 205, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File \"/usr/lib64/python3.6/runpy.py\", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code
exec(code, run_globals)
File \"/tmp/ansible_community.crypto.acme_certificate_payload_2zt5rlrh/ansible_community.crypto.acme_certificate_payload.zip/ansible_collections/community/crypto/plugins/modules/acme_certificate.py\", line 950, in <module>
File \"/tmp/ansible_community.crypto.acme_certificate_payload_2zt5rlrh/ansible_community.crypto.acme_certificate_payload.zip/ansible_collections/community/crypto/plugins/modules/acme_certificate.py\", line 920, in main
File \"/tmp/ansible_community.crypto.acme_certificate_payload_2zt5rlrh/ansible_community.crypto.acme_certificate_payload.zip/ansible_collections/community/crypto/plugins/modules/acme_certificate.py\", line 766, in finish_challenges
File \"/tmp/ansible_community.crypto.acme_certificate_payload_2zt5rlrh/ansible_community.crypto.acme_certificate_payload.zip/ansible_collections/community/crypto/plugins/module_utils/acme/challenges.py\", line 316, in wait_for_validation
File \"/tmp/ansible_community.crypto.acme_certificate_payload_2zt5rlrh/ansible_community.crypto.acme_certificate_payload.zip/ansible_collections/community/crypto/plugins/module_utils/acme/challenges.py\", line 234, in raise_error
File \"/tmp/ansible_community.crypto.acme_certificate_payload_2zt5rlrh/ansible_community.crypto.acme_certificate_payload.zip/ansible_collections/community/crypto/plugins/module_utils/acme/errors.py\", line 30, in format_error_problem
KeyError: 'type'
The text was updated successfully, but these errors were encountered:
There seems to be a bug in the error handling code, so you only see a crash of the error handling code instead of the actual error returned by the CA. I'll take a look at this later today...
SUMMARY
We are getting invalid responses from ZeroSSL challenge requests, but can't tell why they are invalid. Instead, the crypto module is crashing with the below exception when trying to handle the challenge response. It looks like there just needs to be a check on type attribute here to make sure it actually exists. Maybe just print out the response body if there's not a better way to decode the error here?
Please note, this set of tasks has worked previously. This request is renewing an existing certificate, which might be related to the error. However, we can't even see the error to be sure because of this exception.
"module_stderr": "Traceback (most recent call last):
File "", line 100, in
File "", line 92, in _ansiballz_main
File "", line 41, in invoke_module
File "/usr/lib64/python3.6/runpy.py", line 205, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/tmp/ansible_community.crypto.acme_certificate_payload_2zt5rlrh/ansible_community.crypto.acme_certificate_payload.zip/ansible_collections/community/crypto/plugins/modules/acme_certificate.py", line 950, in
File "/tmp/ansible_community.crypto.acme_certificate_payload_2zt5rlrh/ansible_community.crypto.acme_certificate_payload.zip/ansible_collections/community/crypto/plugins/modules/acme_certificate.py", line 920, in main
File "/tmp/ansible_community.crypto.acme_certificate_payload_2zt5rlrh/ansible_community.crypto.acme_certificate_payload.zip/ansible_collections/community/crypto/plugins/modules/acme_certificate.py", line 766, in finish_challenges
File "/tmp/ansible_community.crypto.acme_certificate_payload_2zt5rlrh/ansible_community.crypto.acme_certificate_payload.zip/ansible_collections/community/crypto/plugins/module_utils/acme/challenges.py", line 316, in wait_for_validation
File "/tmp/ansible_community.crypto.acme_certificate_payload_2zt5rlrh/ansible_community.crypto.acme_certificate_payload.zip/ansible_collections/community/crypto/plugins/module_utils/acme/challenges.py", line 234, in raise_error
File "/tmp/ansible_community.crypto.acme_certificate_payload_2zt5rlrh/ansible_community.crypto.acme_certificate_payload.zip/ansible_collections/community/crypto/plugins/module_utils/acme/errors.py", line 30, in format_error_problem
KeyError: 'type'
ISSUE TYPE
COMPONENT NAME
community.crypto.acme_certificate
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Execution Environment based on quay.io/ansible/ansible-runner:latest
STEPS TO REPRODUCE
EXPECTED RESULTS
We should get some information about the error response here, not a traceback from the module crashing.
ACTUAL RESULTS
Module crashed with this traceback.
The text was updated successfully, but these errors were encountered: