SaltDns.Certificates.Issuer.ACME.Client (Salt v1.0.0)

The one place that talks to the ex_acme library. Everything else in the certificate module speaks to SaltDns.Certificates.Issuer, and SaltDns.Certificates.Issuer.ACME speaks to this module, so a change in the library (or its fork) is a change here only.

What is done here rather than by the library today:

  • new_order/3 builds the order map itself (identifiers, profile, replaces), which the library sends as is.

Each call starts a short-lived client process for the provider's directory, linked to the caller, and stops it afterwards. Errors are returned as {:error, {kind, message}} (see SaltDns.Certificates.Issuer).

Summary

Functions

Downloads the chain as PEM.

The RFC 9773 certificate id of a PEM certificate, or nil.

Fetches and returns a directory document.

The TXT value of a DNS-01 challenge: base64url of the SHA-256 of the key authorisation.

Reads an order again. type is the challenge type the order was made for.

Finishes the order with a DER signing request.

Submits an order for names. Options: :profile, :replaces, :challenge ("dns-01", the default, or "http-01"). Returns the order's address, its status and the proofs of that challenge type that are still needed.

Registers an account for the provider with a new ES256 key (and its external account binding, if the provider has one). Agreeing to the provider's terms of service is part of registering.

Asks for renewal information (RFC 9773). :unsupported when the directory has no renewalInfo address.

Tells the provider to validate the pending challenges of the order.

Functions

certificate(provider, url)

@spec certificate(SaltDns.Certificates.Provider.t(), String.t()) ::
  {:ok, String.t()} | {:error, {atom(), String.t()}}

Downloads the chain as PEM.

certificate_id(pem)

@spec certificate_id(String.t()) :: String.t() | nil

The RFC 9773 certificate id of a PEM certificate, or nil.

directory(url)

@spec directory(String.t()) :: {:ok, map()} | {:error, {atom(), String.t()}}

Fetches and returns a directory document.

dns_value(token, account_key)

@spec dns_value(String.t(), ExAcme.AccountKey.t()) :: String.t()

The TXT value of a DNS-01 challenge: base64url of the SHA-256 of the key authorisation.

fetch_order(provider, url, type \\ "dns-01")

@spec fetch_order(SaltDns.Certificates.Provider.t(), String.t(), String.t()) ::
  {:ok, map()} | {:error, {atom(), String.t()}}

Reads an order again. type is the challenge type the order was made for.

finish(provider, url, finalize_url, csr_der)

@spec finish(SaltDns.Certificates.Provider.t(), String.t(), String.t(), binary()) ::
  {:ok, map()} | {:error, {atom(), String.t()}}

Finishes the order with a DER signing request.

new_order(provider, names, opts)

@spec new_order(SaltDns.Certificates.Provider.t(), [String.t()], keyword()) ::
  {:ok, map()} | {:error, {atom(), String.t()}}

Submits an order for names. Options: :profile, :replaces, :challenge ("dns-01", the default, or "http-01"). Returns the order's address, its status and the proofs of that challenge type that are still needed.

register(provider)

@spec register(SaltDns.Certificates.Provider.t()) ::
  {:ok, %{account_url: String.t(), account_key: binary()}}
  | {:error, {atom(), String.t()}}

Registers an account for the provider with a new ES256 key (and its external account binding, if the provider has one). Agreeing to the provider's terms of service is part of registering.

renewal_info(provider, leaf_pem)

@spec renewal_info(SaltDns.Certificates.Provider.t(), String.t()) ::
  {:ok, map()} | :unsupported | {:error, {atom(), String.t()}}

Asks for renewal information (RFC 9773). :unsupported when the directory has no renewalInfo address.

respond(provider, challenge_urls)

@spec respond(SaltDns.Certificates.Provider.t(), [String.t()]) ::
  :ok | {:error, {atom(), String.t()}}

Tells the provider to validate the pending challenges of the order.