Skip to content

CertCache: bound the minted-leaf cache and re-mint expired leaves #850

Description

@piscisaureus

Follow-up from #802.

CertCache.mint (cmd/clawpatrol/ca.go) caches one P-256 key + leaf
per SNI with no eviction and no case normalisation: handle() passes
the raw SNI while HostEndpoint lowercases, so EXAMPLE.COM and
example.com mint two entries. Wildcard endpoints already had an
agent-influenced name space; with unknown_host = "inspect" the whole
name space is agent-chosen. At roughly 1 to 1.5 KB per entry a million
distinct names is about 1 GB.

Separately, cached leaves have NotAfter = +30d and are never
re-minted, so a gateway up for more than 30 days serves expired leaves
for hosts it cached early.

Fix: lowercase the key, add an LRU bound (a few thousand entries is
plenty), and re-mint when the cached leaf is within a day of expiry.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions