Certificates & PKI
Athena runs its own internal certificate authority. On first start the server generates a self-signed Root CA and stores it on disk; from then on every agent that enrolls is issued a per-machine X.509 client certificate signed by that CA, and the server's own gRPC TLS certificate is signed by it too. There is nothing to buy, no public CA to reach, and no internet dependency — the whole trust chain lives inside your network, which is exactly what an air-gapped deployment needs.
This page covers the certificate authority and the certificate lifecycle. For how a host first joins the fleet — installer one-liners and the token handshake — see Agent Enrollment and Registration Tokens.
The Root CA#
When the PKI subsystem initializes, the server looks for a CA certificate and private key on disk. If they are missing it creates a new self-signed Root CA; if they exist it loads them. The generated CA is a standard certificate authority:
| Property | Default |
|---|---|
| Subject | CN=Athena Root CA, O=Athena Deploy Center |
| Key | RSA 4096-bit, signed with SHA-256 |
| Validity | 10 years from creation |
| Basic constraints | CA = true, path length 1 |
| Key usage | Certificate Sign, CRL Sign, Digital Signature |
The CA is stored under the server's PKI directory (see the CertificatesPath setting
below). The CA private key is generated and kept on the server with restricted permissions and
never leaves it — only the public CA certificate is ever handed out to agents.
Agents and browsers need the public CA certificate to trust Athena. Download it from
GET api/pki/ca/download in PEM (.crt, for
Linux/macOS and manual import) or CER/DER (.cer, for Windows Group
Policy deployment), or with the Save-AthenaCACertificate cmdlet. Push the
.cer to the Trusted Root store via GPO for a whole domain at once.
Per-agent certificates#
During enrollment (after the registration token is validated) the server generates a fresh RSA key pair for the agent and issues it a client certificate signed by the Root CA. The certificate has:
- Subject
CN=<hostname>, O=Athena Agent, with the hostname also set as a DNS Subject Alternative Name. - Enhanced Key Usage = Client Authentication (OID
1.3.6.1.5.5.7.3.2) — these certificates authenticate the agent to the server, not the other way around. - An RSA key of the configured leaf key size (default 2048-bit), SHA-256 signature, and a validity of the configured agent certificate lifetime (default 30 days).
The issuance response contains the certificate, its private key, and the CA
certificate. The private key is returned to the agent only once at issuance — the
server stores just the public certificate (PEM), thumbprint, serial number, and validity dates in
its database. Issuing a certificate also stamps the agent's
CertificateThumbprint and CertificateExpires fields.
The agent's private key is delivered in the issuance/renewal response and is never stored on the server. If it is lost, the agent must obtain a new certificate (renew, or re-register).
How a certificate is validated#
On every authenticated agent connection the server validates the presented certificate. A certificate is accepted only when all of these hold:
- It chains to — and was issued by — this server's Root CA (issuer matches the CA subject).
- The current time is within its
ValidFrom…ValidUntilwindow. - It is present in the server database and not revoked.
Otherwise validation fails with a specific reason — no certificate provided, invalid format, not signed by the CA, expired, not yet valid, revoked, agent not found, or certificate not found. Revocation is checked against the database (the server tracks revoked certificates itself), so a revoked certificate stops working immediately.
Renewal & auto-renewal#
Because agent certificates are short-lived (30 days by default), they are renewed continuously.
An agent renews by presenting its current certificate to
POST api/pki/renew (certificate authentication, not a JWT). The server verifies the
current certificate belongs to that agent, issues a brand-new certificate, and then
revokes the old one with the reason "Renewed".
Automatic renewal is enabled by default (EnableAutoRenewal), driven by two settings:
certificates are renewed once they are within 7 days of expiry
(AutoRenewBeforeDays), and the check runs every 6 hours
(AutoRenewalCheckIntervalHours). In normal operation you never renew agent
certificates by hand.
Revoking certificates#
An administrator can revoke all certificates for an agent with
POST api/pki/agents/{agentId}/revoke and a reason. Revocation:
- Marks every non-revoked certificate for that agent as revoked, recording the reason, who revoked it, and when.
- Sets the agent's status to Revoked.
- Disconnects the agent if it is currently connected, and writes an audit entry.
A revoked agent can no longer authenticate and must re-register to rejoin the fleet. Revoked
certificates remain queryable via GET api/pki/revoked for the audit trail.
Extending vs. regenerating the CA#
The Root CA has a long life, but it will eventually approach expiry. There are two very different operations for renewing it — choose carefully:
| Extend | Regenerate | |
|---|---|---|
| Endpoint | POST api/pki/ca/extend | POST api/pki/ca/regenerate |
| Private key | Keeps the same CA key | Creates a new CA key |
| Existing agent certs | Stay valid — no disruption | All revoked — every agent must re-register |
| Effect | Issues a new CA certificate for the same key with fresh validity (default: the configured CA validity, 10 years; or pass additionalYears) | Full key rotation for emergencies (key compromise / breach) |
| Old files | Old CA certificate backed up alongside it (.bak) | Old CA certificate and key backed up (.bak) |
| When to use | Routine renewal as the CA nears expiry | Last resort only |
Regenerating the CA revokes every agent certificate and forces the whole
fleet to re-enroll. Prefer Extend for normal renewals and reserve regenerate
for a confirmed key compromise. Both operations are written to the audit log
(CAExtended / CARegenerated; the initial CA logs
CACreated).
Monitoring expiry#
To stay ahead of renewals, list certificates expiring soon with
GET api/pki/expiring?withinDays=7 (default 7 days). The CA's own metadata —
subject, thumbprint, serial, key size, and validity dates — is available from
GET api/pki/ca/info, which also flags the CA as expiring soon when it is
within one year of expiry. In the console, the Root CA card lives under
Settings → Security → Certificate.
Configuration#
PKI behavior is controlled by the Pki configuration section. The defaults are sensible
for most deployments:
| Setting | Default | Meaning |
|---|---|---|
CertificatesPath | ./pki | Root directory for PKI files (CA under ca/, server cert under server/). |
CaSubject | CN=Athena Root CA, O=Athena Deploy Center | Distinguished name for the Root CA. |
CaValidityYears | 10 | Root CA validity in years. |
RootCaKeySize | 4096 | RSA key size for the Root CA. |
KeySize | 2048 | RSA key size for leaf certificates (agent client certs and the server gRPC TLS cert). Use 4096 for higher security. |
AgentCertValidityDays | 30 | Agent certificate lifetime in days. |
AutoRenewBeforeDays | 7 | Renew a certificate once it is within this many days of expiry. |
EnableAutoRenewal | true | Enable the automatic renewal background check. |
AutoRenewalCheckIntervalHours | 6 | How often the renewal check runs. |
ServerCertValidityDays | 365 | Validity of the server's gRPC TLS certificate. |
ServerCertPassword | (random) | Password for the server certificate PFX. If empty, a random one is generated and stored. |
See Configuration for how to set these values.
Roles#
CA download and info (api/pki/ca, ca/download, ca/info) are
anonymous — agents need them before they hold a certificate. Agent registration
(api/pki/register) is gated by a valid registration token. Renewal
(api/pki/renew) and my-certificates require the agent's own
certificate authentication. Everything else — listing an agent's certificates,
revoking, viewing expiring/revoked certificates, and extending or regenerating the CA — requires
the Admin role. Callers without Admin receive 403; unauthenticated
callers receive 401. See Roles & Permissions.
REST API#
| Method & path | Auth | Purpose |
|---|---|---|
GET api/pki/ca | Anonymous | Root CA certificate (PEM text). |
GET api/pki/ca/download?format=pem|cer | Anonymous | Download the CA as a .crt (PEM) or .cer (DER) file. |
GET api/pki/ca/info | Anonymous | CA metadata (subject, thumbprint, serial, key size, validity). |
POST api/pki/register | Token | Register an agent and issue its certificate. |
POST api/pki/renew | Agent cert | Renew the calling agent's certificate. |
GET api/pki/my-certificates | Agent cert | List the calling agent's certificates. |
GET api/pki/agents/{agentId}/certificates | Admin | List an agent's certificates (includeRevoked default true). |
POST api/pki/agents/{agentId}/revoke | Admin | Revoke all of an agent's certificates. |
GET api/pki/expiring?withinDays=7 | Admin | Certificates expiring within N days. |
GET api/pki/revoked | Admin | All revoked certificates. |
POST api/pki/ca/extend | Admin | Extend the CA validity, same key (additionalYears optional). |
POST api/pki/ca/regenerate | Admin | Regenerate the CA with a new key (revokes all agent certs). |
PowerShell#
The Athena module ships cmdlets for the CA and certificate operations:
| Cmdlet | Purpose |
|---|---|
Get-AthenaCACertificate | Retrieve the Root CA certificate (PEM). -Server, -Port (default 8443). |
Get-AthenaCACertificateInfo | Show CA metadata and validity. |
Save-AthenaCACertificate | Save the CA to a file. -Path (required), -Format pem|cer, -Force. |
Get-AthenaExpiringCertificates | List certificates expiring soon. -Days (default 7). |
Get-AthenaRevokedCertificates | List revoked certificates. -Page, -PageSize (default 50). |
Revoke-AthenaAgentCertificate | Revoke all certificates for an agent. -AgentId, -Reason (both required), -Force. |
Invoke-AthenaCACertificateExtend | Extend the CA validity. -AdditionalYears; prompts for confirmation. |
Invoke-AthenaCACertificateRegenerate | Regenerate the CA with a new key. High-impact; prompts for confirmation, -Force to skip. |
# Export the CA and push it to a domain via GPO (Windows .cer)
Save-AthenaCACertificate -Path "C:\pki\athena-root-ca.cer" -Format cer
# See what's expiring in the next two weeks
Get-AthenaExpiringCertificates -Days 14
# Revoke a decommissioned host's certificates
Revoke-AthenaAgentCertificate -AgentId $id -Reason "Decommissioned" -Force
See the PowerShell Module reference for full cmdlet details.
Athena's CA is generated and stored entirely on your server — there is no external CA, no OCSP responder to reach, and no internet dependency. Revocation is tracked in the server's own database, so certificate trust works fully offline. See Air-Gapped Operation.