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:
1 parent
0146eb8bca
commit
aebe98bf15
33 files changed
+8050
-7
No files matched your search
@@ -12,6 +12,7 @@ import AlertRules from "./pages/AlertRules";
|
||||
import HomeAssistant from "./pages/HomeAssistant";
|
||||
import Ups from "./pages/Ups";
|
||||
import Jellyfin from "./pages/Jellyfin";
|
||||
import Authentik from "./pages/Authentik";
|
||||
import ServiceLevels from "./pages/ServiceLevels";
|
||||
import Duplicati from "./pages/Duplicati";
|
||||
import MyWorkPage from "./pages/MyWork";
|
||||
@@ -160,6 +161,7 @@ function Shelled({ user }: { user: CurrentUser }) {
|
||||
<Route path="/home-assistant" element={<HomeAssistant user={user} />} />
|
||||
<Route path="/ups" element={<Ups user={user} />} />
|
||||
<Route path="/jellyfin" element={<Jellyfin />} />
|
||||
<Route path="/authentik" element={<Authentik />} />
|
||||
<Route path="/service-levels" element={<ServiceLevels user={user} />} />
|
||||
<Route path="/duplicati" element={<Duplicati user={user} />} />
|
||||
<Route path="/ports" element={<Ports user={user} />} />
|
||||
|
||||
+27
-1
@@ -1228,6 +1228,29 @@ export interface JellyfinInfo {
|
||||
problems: { key: string; message: string; severity: "warning" | "critical" }[];
|
||||
}
|
||||
|
||||
/** One Authentik, as its page shows it. */
|
||||
export interface AuthentikInfo {
|
||||
id: number;
|
||||
name: string;
|
||||
enabled: boolean;
|
||||
status: { at: string; ok: boolean; error: string | null } | null;
|
||||
fresh: boolean;
|
||||
state: {
|
||||
version: string | null;
|
||||
latestVersion: string | null;
|
||||
outdated: boolean;
|
||||
workers: number | null;
|
||||
outposts: { name: string; type: string; providers: number; healthy: number; instances: number; outdated: boolean; lastSeen: string | null }[];
|
||||
certificates: { name: string; expires: string; days: number }[];
|
||||
tokens: { identifier: string; intent: string; user: string | null; expires: string; days: number }[];
|
||||
failedLogins24h: number | null;
|
||||
configErrors24h: number | null;
|
||||
lastConfigError: string | null;
|
||||
updatedAt: string;
|
||||
} | null;
|
||||
problems: { key: string; message: string; severity: "warning" | "critical" }[];
|
||||
}
|
||||
|
||||
export interface JellyfinHistory {
|
||||
jellyfin: { id: number; name: string };
|
||||
days: number;
|
||||
@@ -2148,7 +2171,7 @@ export interface ManualTaskInput {
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
export type IntegrationType = "proxmox" | "synology" | "semaphore" | "tailscale" | "gitea" | "dockhand" | "uptimekuma" | "phpipam" | "pbs" | "osticket" | "unifi" | "npm" | "homeassistant" | "ups" | "jellyfin";
|
||||
export type IntegrationType = "proxmox" | "synology" | "semaphore" | "tailscale" | "gitea" | "dockhand" | "uptimekuma" | "phpipam" | "pbs" | "osticket" | "unifi" | "npm" | "homeassistant" | "ups" | "jellyfin" | "authentik";
|
||||
|
||||
export interface IntegrationField {
|
||||
key: string;
|
||||
@@ -2695,6 +2718,9 @@ export const api = {
|
||||
update: (id: number, data: ServiceLevelInput) => request<{ ok: boolean }>(`/api/service-levels/${id}`, { method: "PUT", body: JSON.stringify(data) }),
|
||||
remove: (id: number) => request<void>(`/api/service-levels/${id}`, { method: "DELETE" }),
|
||||
},
|
||||
authentik: {
|
||||
list: () => request<{ authentiks: AuthentikInfo[] }>("/api/authentik"),
|
||||
},
|
||||
jellyfin: {
|
||||
list: () => request<{ jellyfins: JellyfinInfo[] }>("/api/jellyfin"),
|
||||
history: (id: number, days: number) => request<JellyfinHistory>(`/api/jellyfin/${id}/history?days=${days}`),
|
||||
|
||||
@@ -48,6 +48,7 @@ const INTEGRATION_TYPE_LABELS: Record<IntegrationType, string> = {
|
||||
homeassistant: "Home Assistant",
|
||||
ups: "UPS",
|
||||
jellyfin: "Jellyfin",
|
||||
authentik: "Authentik",
|
||||
};
|
||||
|
||||
const DNS_PROVIDER_LABELS: Record<DnsProviderType, string> = {
|
||||
|
||||
@@ -19,6 +19,7 @@ const TYPE_LABELS: Record<IntegrationType, string> = {
|
||||
homeassistant: "Home Assistant",
|
||||
ups: "UPS",
|
||||
jellyfin: "Jellyfin",
|
||||
authentik: "Authentik",
|
||||
};
|
||||
|
||||
export default function IntegrationEditForm({
|
||||
|
||||
@@ -18,6 +18,7 @@ const TYPE_LABELS: Record<IntegrationType, string> = {
|
||||
homeassistant: "Home Assistant",
|
||||
ups: "UPS",
|
||||
jellyfin: "Jellyfin",
|
||||
authentik: "Authentik",
|
||||
};
|
||||
|
||||
export default function IntegrationForm({ onCreated, onCancel }: { onCreated: () => void; onCancel: () => void }) {
|
||||
|
||||
@@ -20,6 +20,7 @@ const TYPE_LABELS: Record<string, string> = {
|
||||
homeassistant: "Home Assistant",
|
||||
ups: "UPS",
|
||||
jellyfin: "Jellyfin",
|
||||
authentik: "Authentik",
|
||||
};
|
||||
|
||||
export type WallLevel = "critical" | "warning" | "ok" | "unsure";
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
IconPlugConnected,
|
||||
IconBrandDocker,
|
||||
IconAffiliate,
|
||||
IconLock,
|
||||
IconMovie,
|
||||
IconPlayerPlay,
|
||||
IconBrandGit,
|
||||
@@ -123,6 +124,7 @@ export const NAV: NavEntry[] = [
|
||||
{ to: "/home-assistant", label: "Home Assistant", icon: <IconHome2 size={20} /> },
|
||||
{ to: "/ups", label: "UPS", icon: <IconBatteryCharging size={20} /> },
|
||||
{ to: "/jellyfin", label: "Jellyfin", icon: <IconMovie size={20} /> },
|
||||
{ to: "/authentik", label: "Authentik", icon: <IconLock size={20} /> },
|
||||
{ to: "/service-levels", label: "Service levels", icon: <IconTargetArrow size={20} /> },
|
||||
],
|
||||
},
|
||||
|
||||
@@ -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’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’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} />)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -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. */
|
||||
|
||||
@@ -28,6 +28,7 @@ const INTEGRATION_NAMES: Record<string, string> = {
|
||||
homeassistant: "Home Assistant",
|
||||
ups: "UPS",
|
||||
jellyfin: "Jellyfin",
|
||||
authentik: "Authentik",
|
||||
};
|
||||
|
||||
function ColorList({
|
||||
|
||||
Reference in new issue
Block a user