Documentation
¶
Overview ¶
Package clamdb keeps this machine's copy of the ClamAV signature bundle the decode step checks every input against. agentry-dockerimages' clamav-db workflow publishes the bundle daily to GHCR as an OCI artifact of three CVDs, signed keyless as that workflow. Ensure refreshes the copy under the runner home when it is over a day since it last asked, verifies the signature before a byte of it is used, refuses a bundle older than the one it holds, and answers the directory a decode mounts read-only. A refresh that fails never fails a run: the copy it has is used, and past 7 days old its receipt says the signatures are stale; with no copy at all, nothing is checked, and the receipt says that.
Index ¶
Constants ¶
const ( // RefreshAfter: the registry is asked again once a day has passed. RefreshAfter = 24 * time.Hour // RetryAfter: a refresh that failed (the registry down, a bundle // refused) is not tried again for an hour, so every run does not pay // for the same failure. RetryAfter = time.Hour // StaleAfter: signatures older than this are named stale in the receipt. StaleAfter = 7 * 24 * time.Hour )
The plan's two ages, and how often a refresh that failed is tried again while a bundle is held.
const ( ProblemNone = "no ClamAV signatures could be fetched" ProblemRefresh = "the last refresh of the signatures failed" )
The words Problem holds, the host's own, for the receipt.
const ( SignerIdentity = "https://github.com/blaktron/agentry-dockerimages/.github/workflows/clamav-db.yaml@refs/heads/main" SignerIssuer = "https://token.actions.githubusercontent.com" )
The identity the bundle must be signed by: agentry-dockerimages' clamav-db workflow on main, keyless through GitHub's OIDC issuer. A bundle signed by anything else, the files workflow included, is refused.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// Dir holds the three CVDs; empty when this machine has none.
Dir string
// Ref is the tag it was refreshed from, Digest the signed manifest's.
Ref string
Digest string
// Daily dates the signatures: daily.cvd changes every day, main.cvd a
// few times a year.
Daily, Main Version
// Checked is when the registry last answered.
Checked time.Time
// Stale says the signatures were older than StaleAfter when Ensure
// answered.
Stale bool
// Problem says why there is no bundle, or that the last refresh
// failed; the error itself went to the log.
Problem string
}
DB is the bundle a decode mounts: where it is and what it is.
func Ensure ¶
Ensure answers the bundle for a decode, refreshing it first when the registry was last asked over RefreshAfter ago (or never, or about another ref). It never fails: a refresh's error is logged and named in Problem, and the copy this machine has is answered.