# Too Many Certificates

This health check monitors the total number of stored certificates in your vHSM cluster. An excessive number of certificates can lead to performance degradation, storage issues, and inefficient certificate management.

**Health Check Name:**`too_many_certs`

**Accessed APIs**

| Method | Endpoint       | Description                          |
| ------ | -------------- | ------------------------------------ |
| READ   | `/tidy-status` | Checks last tidy operation status    |
| LIST   | `/certs`       | Retrieves a list of all stored certs |

**Configuration Parameters**

| Parameter        | Type | Description                                                  |
| ---------------- | ---- | ------------------------------------------------------------ |
| `count_warning`  | int  | Warning threshold for certificate count (Default: `50000`)   |
| `count_critical` | int  | Critical threshold for certificate count (Default: `250000`) |

**Health Check Behavior**

| Condition                                                  | Status Level |
| ---------------------------------------------------------- | ------------ |
| Certificate count > `count_warning` but < `count_critical` | **Warning**  |
| Certificate count ≥ `count_critical`                       | **Critical** |

If `tidy` has not run, vHSM falls back to using a `LIST /certs` operation to assess certificate count.

#### **Recommended Actions**

1. Verify tidy status:

   ```bash
   vhsm read <mount>/tidy-status
   ```
2. Run a manual tidy operation to clean up stale/expired certs:

   ```bash
   vhsm write <mount>/tidy \
       tidy_cert_store=true \
       tidy_revoked_certs=true \
       tidy_acme=true \
       tidy_revocation_queue=true \
       tidy_cross_cluster_revoked_certs=true \
       tidy_revoked_cert_issuer_associations=true
   ```
3. Enable auto-tidy for continuous cleanup and long-term maintenance.
4. Avoid premature certificate renewals:
   * Adjust certificate TTL to reflect realistic usage patterns.
   * vHSM automatically renews certificates at \~2/3 of their lifespan, so setting TTLs appropriately can help reduce cert volume.
5. Set `no_store=true` for all non-ACME roles where storage isn’t needed:
   * Use Bring Your Own Certificate (BYOC) revocation workflows to manage cert lifecycle and avoid unnecessary certificate storage.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.enclaive.cloud/virtual-hsm/troubleshooting/too-many-certificates.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
