mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 07:01:22 -07:00
letsencrypt: fix account key detection for keys created by openssl_privatekey (#35534)
* Fixing key detection if key was generated with openssl_privatekey. * Fixing error formatting.
This commit is contained in:
parent
311918828f
commit
2c482847ce
1 changed files with 7 additions and 1 deletions
|
@ -566,8 +566,14 @@ class ACMEAccount(object):
|
||||||
if m is not None:
|
if m is not None:
|
||||||
account_key_type = m.group(1).lower()
|
account_key_type = m.group(1).lower()
|
||||||
break
|
break
|
||||||
|
if account_key_type is None:
|
||||||
|
# This happens for example if openssl_privatekey created this key
|
||||||
|
# (as opposed to the OpenSSL binary). For now, we assume this is
|
||||||
|
# an RSA key.
|
||||||
|
# FIXME: add some kind of auto-detection
|
||||||
|
account_key_type = "rsa"
|
||||||
if account_key_type not in ("rsa", "ec"):
|
if account_key_type not in ("rsa", "ec"):
|
||||||
return 'unknown key type "%s" % account_key_type', {}
|
return 'unknown key type "%s"' % account_key_type, {}
|
||||||
|
|
||||||
openssl_keydump_cmd = [self._openssl_bin, account_key_type, "-in", key, "-noout", "-text"]
|
openssl_keydump_cmd = [self._openssl_bin, account_key_type, "-in", key, "-noout", "-text"]
|
||||||
dummy, out, dummy = self.module.run_command(openssl_keydump_cmd, check_rc=True)
|
dummy, out, dummy = self.module.run_command(openssl_keydump_cmd, check_rc=True)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue