certificate_complete_chain: do not stop execution on unsupported algorithm (#457)
* Do not stop execution on unsupported algorithm. * Fix typo.pull/459/head
parent
40cf8ba2ce
commit
c49102d688
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- "certificate_complete_chain - do not stop execution if an unsupported signature algorithm is encountered; warn instead (https://github.com/ansible-collections/community.crypto/pull/457)."
|
|
@ -133,6 +133,7 @@ from ansible_collections.community.crypto.plugins.module_utils.crypto.pem import
|
||||||
CRYPTOGRAPHY_IMP_ERR = None
|
CRYPTOGRAPHY_IMP_ERR = None
|
||||||
try:
|
try:
|
||||||
import cryptography
|
import cryptography
|
||||||
|
import cryptography.exceptions
|
||||||
import cryptography.hazmat.backends
|
import cryptography.hazmat.backends
|
||||||
import cryptography.hazmat.primitives.serialization
|
import cryptography.hazmat.primitives.serialization
|
||||||
import cryptography.hazmat.primitives.asymmetric.rsa
|
import cryptography.hazmat.primitives.asymmetric.rsa
|
||||||
|
@ -190,6 +191,9 @@ def is_parent(module, cert, potential_parent):
|
||||||
return True
|
return True
|
||||||
except cryptography.exceptions.InvalidSignature as dummy:
|
except cryptography.exceptions.InvalidSignature as dummy:
|
||||||
return False
|
return False
|
||||||
|
except cryptography.exceptions.UnsupportedAlgorithm as dummy:
|
||||||
|
module.warn('Unsupported algorithm "{0}"'.format(cert.cert.signature_hash_algorithm))
|
||||||
|
return False
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg='Unknown error on signature validation: {0}'.format(e))
|
module.fail_json(msg='Unknown error on signature validation: {0}'.format(e))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue