Authentik: a tick box to switch off the certificate alerts
For an Authentik that is not in use at the moment: "Do not alert about certificates" on the integration stops the certificate alerts (and clears the ones raised) while the page still lists the certificates and /metrics still carries their expiry. Outposts, tokens, failed sign-ins and configuration errors are unaffected. Same pattern as Fragnet's mute boxes. Tests and docs added. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
313ef81faf
commit
0f5476b542
8 files changed
+50
-9
No files matched your search
@@ -206,6 +206,25 @@ describe("what is wrong, and how close is close", () => {
|
||||
assert.match(ak.authentikProblems(1, "SSO", row({ certificates: certs(-2) }), NOW)[0].message, /ran out 2 days ago/);
|
||||
});
|
||||
|
||||
test("certificate alerts can be switched off for one Authentik, and only they", () => {
|
||||
const certs = JSON.stringify([{ name: "web", expires: inDays(-5) }]);
|
||||
const tokens = JSON.stringify([{ identifier: "monitoring", intent: "api", user: null, expires: inDays(1) }]);
|
||||
const judge = (config: Record<string, unknown> | null) => ak.authentikProblems(1, "SSO", row({ certificates: certs, tokens, failedLogins24h: 50 }), NOW, ak.optionsOf(config)).map((p) => p.key);
|
||||
assert.deepEqual(judge(null), ["authentik-cert:1:web", "authentik-token:1:monitoring", "authentik-logins:1"], "everything is on until it is switched off");
|
||||
assert.deepEqual(judge({ muteCertificates: false }), ["authentik-cert:1:web", "authentik-token:1:monitoring", "authentik-logins:1"]);
|
||||
for (const on of [true, "true"]) assert.deepEqual(judge({ muteCertificates: on }), ["authentik-token:1:monitoring", "authentik-logins:1"], String(on));
|
||||
assert.deepEqual(judge({ muteCertificates: "false" }), ["authentik-cert:1:web", "authentik-token:1:monitoring", "authentik-logins:1"]);
|
||||
assert.deepEqual(ak.optionsOf(undefined).alerts, { certificates: true });
|
||||
});
|
||||
|
||||
test("the setting is a tick box on the Authentik integration, and the page and /metrics still carry the certificates", async () => {
|
||||
const { INTEGRATION_FIELDS } = await import("../src/integrations/fieldSchemas.js");
|
||||
const field = INTEGRATION_FIELDS.authentik?.find((f) => f.key === "muteCertificates");
|
||||
assert.deepEqual([field?.type, field?.optional, field?.secret], ["checkbox", true, false]);
|
||||
const { readFileSync } = await import("node:fs");
|
||||
assert.match(readFileSync(new URL("../src/services/metrics.ts", import.meta.url), "utf8"), /homelab_authentik_certificate_expiry_days/);
|
||||
});
|
||||
|
||||
test("a token: a warning within 7 days, critical within 2", () => {
|
||||
const tokens = (d: number) => JSON.stringify([{ identifier: "monitoring", intent: "api", user: "svc", expires: inDays(d) }]);
|
||||
assert.deepEqual(keys(row({ tokens: tokens(8) })), []);
|
||||
|
||||
Reference in new issue
Block a user