community.crypto.acme_account_facts (0.1.0) — module

Retrieves information on ACME accounts

Authors: Felix Fontein (@felixfontein)

preview | supported by community

Install collection

Install with ansible-galaxy collection install community.crypto:==0.1.0


Add to requirements.yml

  collections:
    - name: community.crypto
      version: 0.1.0

Description

Allows to retrieve information on accounts a CA supporting the L(ACME protocol,https://tools.ietf.org/html/rfc8555), such as L(Let's Encrypt,https://letsencrypt.org/).

This module only works with the ACME v2 protocol.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Check whether an account with the given account key exists
  acme_account_info:
    account_key_src: /etc/pki/cert/private/account.key
    register: account_data
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Verify that account exists
  assert:
    that:
      - account_data.exists
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Print account URI
  debug: var=account_data.account_uri
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Print account contacts
  debug: var=account_data.account.contact
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Check whether the account exists and is accessible with the given account key
  acme_account_info:
    account_key_content: "{{ acme_account_key }}"
    account_uri: "{{ acme_account_uri }}"
    register: account_data
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Verify that account exists
  assert:
    that:
      - account_data.exists
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Print account contacts
  debug: var=account_data.account.contact

Inputs

    
account_uri:
    description:
    - If specified, assumes that the account URI is as given. If the account key does
      not match this account, or an account with this URI does not exist, the module fails.
    type: str

acme_version:
    choices:
    - 1
    - 2
    description:
    - The ACME version of the endpoint.
    - Must be 1 for the classic Let's Encrypt and Buypass ACME endpoints, or 2 for standardized
      ACME v2 endpoints.
    - The default value is 1. Note that in Ansible 2.14, this option *will be required*
      and will no longer have a default.
    - Please also note that we will deprecate ACME v1 support eventually.
    type: int

acme_directory:
    description:
    - The ACME directory to use. This is the entry point URL to access CA server API.
    - For safety reasons the default is set to the Let's Encrypt staging server (for the
      ACME v1 protocol). This will create technically correct, but untrusted certificates.
    - The default value is U(https://acme-staging.api.letsencrypt.org/directory). Note
      that in Ansible 2.14, this option *will be required* and will no longer have a default.
    - 'For Let''s Encrypt, all staging endpoints can be found here: U(https://letsencrypt.org/docs/staging-environment/).
      For Buypass, all endpoints can be found here: U(https://community.buypass.com/t/63d4ay/buypass-go-ssl-endpoints)'
    - For Let's Encrypt, the production directory URL for ACME v1 is U(https://acme-v01.api.letsencrypt.org/directory),
      and the production directory URL for ACME v2 is U(https://acme-v02.api.letsencrypt.org/directory).
    - For Buypass, the production directory URL for ACME v2 and v1 is U(https://api.buypass.com/acme/directory).
    - '*Warning:* So far, the module has only been tested against Let''s Encrypt (staging
      and production), Buypass (staging and production), and L(Pebble testing server,https://github.com/letsencrypt/Pebble).'
    type: str

validate_certs:
    default: true
    description:
    - Whether calls to the ACME directory will validate TLS certificates.
    - '*Warning:* Should *only ever* be set to C(no) for testing purposes, for example
      when testing against a local Pebble server.'
    type: bool

account_key_src:
    aliases:
    - account_key
    description:
    - Path to a file containing the ACME account RSA or Elliptic Curve key.
    - RSA keys can be created with C(openssl genrsa ...). Elliptic curve keys can be created
      with C(openssl ecparam -genkey ...). Any other tool creating private keys in PEM
      format can be used as well.
    - Mutually exclusive with C(account_key_content).
    - Required if C(account_key_content) is not used.
    type: path

retrieve_orders:
    choices:
    - ignore
    - url_list
    - object_list
    default: ignore
    description:
    - Whether to retrieve the list of order URLs or order objects, if provided by the
      ACME server.
    - A value of C(ignore) will not fetch the list of orders.
    - Currently, Let's Encrypt does not return orders, so the C(orders) result will always
      be empty.
    type: str

account_key_content:
    description:
    - Content of the ACME account RSA or Elliptic Curve key.
    - Mutually exclusive with C(account_key_src).
    - Required if C(account_key_src) is not used.
    - "*Warning:* the content will be written into a temporary file, which will be deleted\
      \ by Ansible when the module completes. Since this is an important private key \u2014\
      \ it can be used to change the account key, or to revoke your certificates without\
      \ knowing their private keys \u2014, this might not be acceptable."
    - In case C(cryptography) is used, the content is not written into a temporary file.
      It can still happen that it is written to disk by Ansible in the process of moving
      the module with its argument to the node where it is executed.
    type: str

select_crypto_backend:
    choices:
    - auto
    - cryptography
    - openssl
    default: auto
    description:
    - Determines which crypto backend to use.
    - The default choice is C(auto), which tries to use C(cryptography) if available,
      and falls back to C(openssl).
    - If set to C(openssl), will try to use the C(openssl) binary.
    - If set to C(cryptography), will try to use the L(cryptography,https://cryptography.io/)
      library.
    type: str

Outputs

account:
  contains:
    contact:
      description: the challenge resource that must be created for validation
      elements: str
      returned: always
      sample: '[''mailto:me@example.com'', ''tel:00123456789'']'
      type: list
    orders:
      description:
      - A URL where a list of orders can be retrieved for this account.
      - Use the I(retrieve_orders) option to query this URL and retrieve the complete
        list of orders.
      returned: always
      sample: https://example.ca/account/1/orders
      type: str
    public_account_key:
      description: the public account key as a L(JSON Web Key,https://tools.ietf.org/html/rfc7517).
      returned: always
      sample: '{"kty":"EC","crv":"P-256","x":"MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4","y":"4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM"}'
      type: str
    status:
      choices:
      - valid
      - deactivated
      - revoked
      description: the account's status
      returned: always
      sample: valid
      type: str
  description: The account information, as retrieved from the ACME server.
  returned: if account exists
  type: dict
account_uri:
  description: ACME account URI, or None if account does not exist.
  returned: always
  type: str
exists:
  description: Whether the account exists.
  returned: always
  type: bool
orders:
  contains:
    authorizations:
      description:
      - A list of URLs for authorizations for this order.
      elements: str
      type: list
    certificate:
      description:
      - The URL for retrieving the certificate.
      returned: when certificate was issued
      type: str
    error:
      description:
      - In case an error occurred during processing, this contains information about
        the error.
      - The field is structured as a problem document (RFC7807).
      returned: when an error occurred
      type: dict
    expires:
      description:
      - When the order expires.
      - Timestamp should be formatted as described in RFC3339.
      - Only required to be included in result when I(status) is C(pending) or C(valid).
      returned: when server gives expiry date
      type: str
    finalize:
      description:
      - A URL used for finalizing an ACME order.
      type: str
    identifiers:
      contains:
        type:
          description: Type of identifier. C(dns) or C(ip).
          type: str
        value:
          description: Name of identifier. Hostname or IP address.
          type: str
        wildcard:
          description: Whether I(value) is actually a wildcard. The wildcard prefix
            C(*.) is not included in I(value) if this is C(true).
          returned: required to be included if the identifier is wildcarded
          type: bool
      description:
      - List of identifiers this order is for.
      elements: dict
      type: list
    notAfter:
      description:
      - The requested value of the C(notAfter) field in the certificate.
      - Date should be formatted as described in RFC3339.
      - Server is not required to return this.
      returned: when server returns this
      type: str
    notBefore:
      description:
      - The requested value of the C(notBefore) field in the certificate.
      - Date should be formatted as described in RFC3339.
      - Server is not required to return this.
      returned: when server returns this
      type: str
    status:
      choices:
      - pending
      - ready
      - processing
      - valid
      - invalid
      description: The order's status.
      type: str
  description:
  - The list of orders.
  - If I(retrieve_orders) is C(url_list), this will be a list of URLs.
  - If I(retrieve_orders) is C(object_list), this will be a list of objects.
  returned: if account exists, I(retrieve_orders) is not C(ignore), and server supports
    order listing
  type: list

See also