community.crypto.x509_certificate_info filter – Retrieve information from X.509 certificates in PEM format
Note
This filter plugin is part of the community.crypto collection (version 2.22.0).
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 filter plugin,
see Requirements for details.
To use it in a playbook, specify: community.crypto.x509_certificate_info
.
New in community.crypto 2.10.0
Synopsis
Provided a X.509 certificate in PEM format, retrieve information.
This is a filter version of the community.crypto.x509_certificate_info module.
Requirements
The below requirements are needed on the local controller node that executes this filter.
If
name_encoding
is set to another value thanignore
, the idna Python library needs to be installed.
Input
This describes the input of the filter, the value before | community.crypto.x509_certificate_info
.
Parameter |
Comments |
---|---|
The content of the X.509 certificate in PEM format. |
Keyword parameters
This describes keyword parameters of the filter. These are the values key1=value1
, key2=value2
and so on in the following
example: input | community.crypto.x509_certificate_info(key1=value1, key2=value2, ...)
Parameter |
Comments |
---|---|
How to encode names (DNS names, URIs, email addresses) in return values.
Note that Choices:
|
See Also
See also
- community.crypto.x509_certificate_info
Provide information of OpenSSL X.509 certificates.
- community.crypto.to_serial filter plugin
Convert an integer to a colon-separated list of hex numbers.
Examples
- name: Show the Subject Alt Names of the certificate
ansible.builtin.debug:
msg: >-
{{
(
lookup('ansible.builtin.file', '/path/to/cert.pem')
| community.crypto.x509_certificate_info
).subject_alt_name | join(', ')
}}
Return Value
Key |
Description |
---|---|
Information on the certificate. Returned: success |
|
The certificate’s authority cert issuer as a list of general names. Is See Returned: success Sample: |
|
The certificate’s authority cert serial number. Is This return value is an integer. If you need the serial numbers as a colon-separated hex string, such as Returned: success Sample: |
|
The certificate’s authority key identifier. The identifier is returned in hexadecimal, with Is Returned: success Sample: |
|
Entries in the Returned: success Sample: |
|
Whether the Returned: success |
|
Whether the certificate is expired (in other words, Returned: success |
|
Entries in the Returned: success Sample: |
|
Whether the Returned: success |
|
Returns a dictionary for every extension OID. Returned: success Sample: |
|
Whether the extension is critical. Returned: success |
|
The Base64 encoded value (in DER format) of the extension. Note that depending on the Returned: success Sample: |
|
Fingerprints of the DER-encoded form of the whole certificate. For every hash algorithm available, the fingerprint is computed. Returned: success Sample: |
|
The certificate’s issuer. Note that for repeated values, only the last one will be returned. Returned: success Sample: |
|
The certificate’s issuer as an ordered list of tuples. Returned: success Sample: |
|
The Issuer URI, if included in the certificate. Will be Returned: success |
|
Entries in the Returned: success Sample: |
|
Whether the Returned: success |
|
Returned: success Sample: |
|
Returned: success Sample: |
|
Returned: success |
|
Whether the Returned: success |
|
The OCSP responder URI, if included in the certificate. Will be Returned: success |
|
Certificate’s public key in PEM format. Returned: success Sample: |
|
Public key data. Depends on the public key’s 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 |
|
Bit size of modulus (RSA) or prime number (DSA). Returned: When |
|
The Returned: When |
|
For For Returned: When |
|
Fingerprints of certificate’s public key. For every hash algorithm available, the fingerprint is computed. Returned: success Sample: |
|
The certificate’s public key’s type. One of Will start with Returned: success Sample: |
|
The certificate’s serial number. This return value is an integer. If you need the serial numbers as a colon-separated hex string, such as Returned: success Sample: |
|
The signature algorithm used to sign the certificate. Returned: success Sample: |
|
The certificate’s subject as a dictionary. Note that for repeated values, only the last one will be returned. Returned: success Sample: |
|
Entries in the See Returned: success Sample: |
|
Whether the Returned: success |
|
The certificate’s subject key identifier. The identifier is returned in hexadecimal, with Is Returned: success Sample: |
|
The certificate’s subject as an ordered list of tuples. Returned: success Sample: |
|
The certificate version. Returned: success Sample: |