community.crypto.openssl_privatekey_info module – Provide information for OpenSSL private keys
Note
This module is part of the community.crypto collection (version 2.16.1).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.crypto
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.crypto.openssl_privatekey_info
.
Synopsis
This module allows one to query information on OpenSSL private keys.
In case the key consistency checks fail, the module will fail as this indicates a faked private key. In this case, all return variables are still returned. Note that key consistency checks are not available all key types; if none is available,
none
is returned forkey_is_consistent
.It uses the cryptography python library to interact with OpenSSL.
Requirements
The below requirements are needed on the host that executes this module.
cryptography >= 1.2.3
Parameters
Parameter |
Comments |
---|---|
Whether to check consistency of the private key. In community.crypto < 2.0.0, consistency was always checked. Since community.crypto 2.0.0, the consistency check has been disabled by default to avoid private key material to be transported around and computed with, and only do so when requested explicitly. This can potentially prevent side-channel attacks. Choices:
|
|
The passphrase for the private key. |
|
Remote absolute path where the private key file is loaded from. |
|
Whether to return private key data. Only set this to WARNING: you have to make sure that private key data is not accidentally logged! Choices:
|
|
Determines which crypto backend to use. The default choice is If set to Choices:
|
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full This action does not modify state. |
Can run in |
|
Support: N/A This action does not modify state. |
Will return details on what has changed (or possibly needs changing in |
See Also
See also
- community.crypto.openssl_privatekey
Generate OpenSSL private keys.
- community.crypto.openssl_privatekey_pipe
Generate OpenSSL private keys without disk access.
- community.crypto.openssl_privatekey_info filter plugin
A filter variant of this module.
Examples
- name: Generate an OpenSSL private key with the default values (4096 bits, RSA)
community.crypto.openssl_privatekey:
path: /etc/ssl/private/ansible.com.pem
- name: Get information on generated key
community.crypto.openssl_privatekey_info:
path: /etc/ssl/private/ansible.com.pem
register: result
- name: Dump information
ansible.builtin.debug:
var: result
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Whether the module was able to load the private key from disk. Returned: always |
|
Whether the module was able to parse the private key. Returned: always |
|
Whether the key is consistent. Can also return In case the check returns Returned: when |
|
Private key data. Depends on key type. Returned: success and when |
|
Public key data. Depends on key type. Returned: success |
|
The curve’s name for ECC. Returned: When |
|
The RSA key’s public exponent. Returned: When |
|
The maximum number of bits of a private key. This is basically the bit size of the subgroup used. Returned: When |
|
The This is the element spanning the subgroup of the multiplicative group of the prime field used. Returned: When |
|
The RSA key’s modulus. Returned: When |
|
The This is the prime modulus upon which arithmetic takes place. Returned: When |
|
The This is a prime that divides Returned: When |
|
The Returned: When |
|
Private key’s public key in PEM format. Returned: success Sample: |
|
Fingerprints of private key’s public key. For every hash algorithm available, the fingerprint is computed. Returned: success Sample: |
|
The key’s type. One of Will start with Returned: success Sample: |