SaltDns. Certificates. Runner
(Salt v1.0.0)
The work on one certificate: decide whether a new version is due, and carry
an order through its steps. Run by SaltDns.Certificates.Worker, which is
unique per certificate, so replicas never run two orders for one
certificate.
Every step is written to Postgres before the next one starts (the order's state and address), so a restarted job continues the same order:
new -> created -> published -> propagated -> validating -> ready -> issuednew: the order is asked of the provider (replacesnames the certificate being renewed);created: the DNS-01 values the provider wants are published at_acme-challenge.<host>(both at once for the host and its wildcard, next to the values other orders have there);published: wait until every authoritative server has them;propagated: the provider is told to validate;validating: poll until the provider accepts; the records are removed;ready: a new ECDSA P-256 key is made and put in the store before the signing request is sent, the order is finished, the chain fetched and the version stored (key and chain encrypted), then the database is updated.
A failure removes the challenge records, ends the order (except when the certificate may already have been issued), counts against the certificate and sets the next try (1, 10, 100 minutes, then daily); repeated failures at one provider move on to the next provider of the list.
An external certificate (one host in no zone of Salt, SaltDns.Certificates.Http01) runs
the same steps without DNS records: before the order the group and the host are
checked (before_order/2, also before each renewal), the order asks for the HTTP-01
challenge, created goes straight to propagated, and there Salt asks for the
challenge itself (self_check/1) before the provider is told to validate. Failures
have the kinds http01, precheck and self_check.
A disabled certificate never starts or continues an order: the certificate
is read again before every step, and a failure or a success that arrives
after it was disabled leaves it disabled (abandon/2). The delegation of the
zone is checked before an order is started at the provider.
Never raises: a crash is a failure like any other.
Summary
Functions
Takes the challenge records of orders that are over (cancelled, failed, issued) out of the zone. Safe to repeat. Used when a certificate is disabled.
Does what is due for the certificate. Always returns :ok.
Functions
@spec cleanup(SaltDns.Certificates.Certificate.t()) :: :ok
Takes the challenge records of orders that are over (cancelled, failed, issued) out of the zone. Safe to repeat. Used when a certificate is disabled.
@spec run(integer()) :: :ok
Does what is due for the certificate. Always returns :ok.