Authentik: know when the front door is about to shut

New Authentik integration (read-only, every 5 minutes): version, workers,
outposts and their health, certificates and API tokens that expire, failed
sign-ins and configuration errors. Monitoring -> Authentik page.

Alerts: an outpost that serves apps has gone quiet (critical), certificate or
token about to run out (critical close to it), no worker, failed sign-ins,
configuration errors. Held by maintenance, held when unreadable, in /metrics.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-24 22:09:38 +02:00
1 parent 0146eb8bca
commit aebe98bf15
33 files changed
+8050 -7

No files matched your search

+170
View File
@@ -0,0 +1,170 @@
import { useEffect, useState } from "react";
import { Link } from "react-router-dom";
import { api, type AuthentikInfo } from "../api/client";
import EmptyState from "../components/EmptyState";
import TimeAgo from "../components/TimeAgo";
import { BlockSkeleton } from "../components/Skeleton";
import { ErrorNotice } from "../components/Notice";
import { readableError } from "../utils/errors";
function Badge({ a }: { a: AuthentikInfo }) {
if (!a.enabled) return <span className="badge bg-secondary-lt text-secondary">Off</span>;
if (!a.state) return <span className="badge bg-secondary-lt text-secondary">Not read yet</span>;
if (!a.fresh) return <span className="badge bg-yellow-lt text-yellow">Can&rsquo;t be read</span>;
if (a.problems.some((p) => p.severity === "critical")) return <span className="badge bg-red-lt text-red">Needs a look</span>;
if (a.problems.length > 0) return <span className="badge bg-yellow-lt text-yellow">Needs a look</span>;
return <span className="badge bg-green-lt text-green">In order</span>;
}
/** "in 12 days", "today", "3 days ago": how long until something runs out, in words, coloured by how close it is. */
function Left({ days, warn, critical }: { days: number; warn: number; critical: number }) {
const text = days < 0 ? `ran out ${-days} day${days === -1 ? "" : "s"} ago` : days === 0 ? "runs out today" : `${days} day${days === 1 ? "" : "s"} left`;
return <span className={days <= critical ? "text-red" : days <= warn ? "text-yellow" : "text-secondary"}>{text}</span>;
}
function Card({ a }: { a: AuthentikInfo }) {
const s = a.state;
return (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">
{a.name} <Badge a={a} />
</h3>
<div className="card-actions text-secondary small">{a.status ? <>read <TimeAgo value={a.status.at} /></> : "not read yet"}</div>
</div>
<div className="card-body">
{a.status && !a.status.ok && <div className="text-yellow mb-2">The last attempt to read it failed: {a.status.error ?? "no answer"}.</div>}
{a.problems.length > 0 && (
<ul className="mb-3">
{a.problems.map((p) => (
<li key={p.key} className={p.severity === "critical" ? "text-red" : ""}>
{p.message}
</li>
))}
</ul>
)}
{s && (
<>
<div className="text-secondary small mb-3">
{[s.version ? `version ${s.version}` : null, s.outdated && s.latestVersion ? `${s.latestVersion} is out` : null, s.workers === null ? null : `${s.workers} worker${s.workers === 1 ? "" : "s"} connected`, s.failedLogins24h === null ? null : `${s.failedLogins24h >= 100 ? "100+" : s.failedLogins24h} failed sign-in${s.failedLogins24h === 1 ? "" : "s"} in the last day`, s.configErrors24h ? `${s.configErrors24h} configuration error${s.configErrors24h === 1 ? "" : "s"}` : null]
.filter(Boolean)
.join(" · ")}
</div>
<h4>Outposts</h4>
{s.outposts.length === 0 ? (
<div className="text-secondary mb-3">None.</div>
) : (
<div className="table-responsive mb-3">
<table className="table table-vcenter table-sm">
<thead>
<tr>
<th>Outpost</th>
<th>Type</th>
<th className="text-end">Serves</th>
<th>Reporting</th>
<th>Last heard</th>
</tr>
</thead>
<tbody>
{s.outposts.map((o) => (
<tr key={o.name}>
<td>{o.name}</td>
<td className="text-secondary">{o.type}</td>
<td className="text-end">{o.providers} app{o.providers === 1 ? "" : "s"}</td>
<td>
{o.healthy > 0 ? (
<span className="badge bg-green-lt text-green">
{o.healthy} instance{o.healthy === 1 ? "" : "s"}
</span>
) : o.providers === 0 ? (
<span className="badge bg-secondary-lt text-secondary">nothing to serve</span>
) : (
<span className="badge bg-red-lt text-red">silent</span>
)}
{o.outdated && <span className="badge bg-yellow-lt text-yellow ms-1">other version</span>}
</td>
<td className="text-secondary">{o.lastSeen ? <TimeAgo value={o.lastSeen} /> : "never"}</td>
</tr>
))}
</tbody>
</table>
</div>
)}
<h4>Certificates</h4>
{s.certificates.length === 0 ? (
<div className="text-secondary mb-3">None that Authentik doesn&rsquo;t renew itself.</div>
) : (
<ul className="mb-3">
{s.certificates.map((c) => (
<li key={c.name}>
{c.name} — <Left days={c.days} warn={14} critical={3} />
</li>
))}
</ul>
)}
<h4>API tokens and app passwords that expire</h4>
{s.tokens.length === 0 ? (
<div className="text-secondary mb-3">None.</div>
) : (
<ul className="mb-3">
{s.tokens.map((t) => (
<li key={t.identifier}>
{t.identifier}
<span className="text-secondary">
{" "}
({t.intent === "app_password" ? "app password" : "API token"}
{t.user ? `, ${t.user}` : ""})
</span>{" "}
— <Left days={t.days} warn={7} critical={2} />
</li>
))}
</ul>
)}
{s.lastConfigError && <div className="text-secondary small">Latest configuration error: {s.lastConfigError}</div>}
</>
)}
</div>
</div>
);
}
/** Authentik, the front door: whether its outposts are reporting, what is about to run out, whether a worker is connected, and who is failing to sign in. */
export default function Authentik() {
const [data, setData] = useState<AuthentikInfo[] | null>(null);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
const load = () =>
api.authentik
.list()
.then((r) => {
setData(r.authentiks);
setError(null);
})
.catch((err) => setError(readableError(err)));
void load();
const t = setInterval(load, 60_000);
return () => clearInterval(t);
}, []);
return (
<>
<h2 className="page-title">Authentik</h2>
<p className="text-secondary">
The sign-in in front of everything else. It is read every few minutes with an API token (see <Link to="/integrations">Integrations</Link>). An <strong>outpost that goes quiet</strong> (the apps it guards stop letting anyone in), a <strong>certificate</strong> or an{" "}
<strong>API token</strong> that is about to run out, <strong>no worker</strong> and a burst of <strong>failed sign-ins</strong> are alerts — see <Link to="/alerts">Alerts</Link>.
</p>
<ErrorNotice error={error} />
{!data && !error && <BlockSkeleton lines={4} />}
{data && data.length === 0 && (
<div className="card">
<div className="card-body">
<EmptyState title="No Authentik connected" hint="Add one under Integrations with its address and an API token (Authentik → Directory → Tokens and App passwords → Create, intent API Token)." />
</div>
</div>
)}
{data?.map((a) => <Card key={a.id} a={a} />)}
</>
);
}
+2
View File
@@ -30,6 +30,7 @@ const TYPE_LABELS: Record<IntegrationType, string> = {
homeassistant: "Home Assistant",
ups: "UPS",
jellyfin: "Jellyfin",
authentik: "Authentik",
};
/** The page each kind of integration gets once it is connected. */
@@ -49,6 +50,7 @@ const TYPE_PAGES: Record<IntegrationType, string> = {
homeassistant: "/home-assistant",
ups: "/ups",
jellyfin: "/jellyfin",
authentik: "/authentik",
};
/** "pve.example.lan" out of "https://pve.example.lan:8006/", or the text itself when it isn't an address. */
+1
View File
@@ -28,6 +28,7 @@ const INTEGRATION_NAMES: Record<string, string> = {
homeassistant: "Home Assistant",
ups: "UPS",
jellyfin: "Jellyfin",
authentik: "Authentik",
};
function ColorList({