🤖 Services

Services (e.g. daemons requiring an mTLS / TLS certificate) can request their initial certificate from CertBob.

An admin approves the request in the web interface, and from then on the service renews its certificate itself – via CertBob or directly against the CA, without an admin. Services only need openssl & curl (no step CLI, no JSON).

Hint

To enable service certificates, set the following variables:

How it works

  1. The service creates its own key & a CSR (CN = service name, also in the SANs).

  2. It submits the CSR with the shared secret, and gets a URL to poll.

  3. While pending, polling returns a verification code, which the service logs.

  4. An admin approves the request in Services, only if the code matches.

  5. Once approved, polling returns the certificate.

  6. It renews the certificate itself, via CertBob or directly at the CA.

Important

  • Renewing via the CA requires a valid certificate, renewing via CertBob only the approved key.

  • Renew after about two thirds of the certificate lifetime.

  • Renewals via the CA aren’t visible in CertBob.

Hint

  • Admins can revoke an approved service.

  • CertBob then no longer renews its certificate, and revokes its last known certificate (passively) at the CA, so it can’t be renewed there either.

  • The certificate stays valid until it expires.

  • If the service renewed via the CA in the meantime, CertBob doesn’t know its newest certificate, so revoke that one at the CA manually.

Note

  • Stale requests are removed after SERVICES_RETENTION_DAYS, i.e. pending requests nobody approved, and rejected or revoked services.

  • Approved services are never removed, since they’re required for renewals.

API

Plain HTTP, no JSON: CSRs & certificates are sent as PEM body, everything else as plain text. All endpoints require the shared services secret as Authorization: Bearer ${SERVICES_SECRET} (401 otherwise).

POST /api/services

Submit a CSR (its common name is the service name). Responds with 201 and the URL to poll (body & Location, plus the verification code as X-Verification-Code), 303 when the same CSR was already submitted, 400 for an invalid CSR, 409 when another key is pending for the name, and 429 when there are too many pending requests.

GET /api/services/<id>

Poll a request. Responds with 202 while pending (with the verification code, and Retry-After: 60), 200 and the PEM certificate chain once approved, 403 when rejected, and 410 when revoked.

POST /api/services/renew

Renew with a CSR of the approved key (same name & SANs). Responds with 200 and the renewed certificate, or 403 when there’s no approved (i.e. not revoked) service with this name, key & SANs.

Hint

The Services page of the web interface shows ready-to-copy openssl & curl commands to request & renew certificates (incl. CertBob’s URL).

Provisioner

The certificate is signed via the same provisioner CertBob uses for client certificates (see PROVISIONER_NAME). Make sure renewals aren’t disabled (disableRenewal) on this provisioner, and that its maximum certificate duration suits your services.