Skip to content

LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.

System Information: Checks tab, part 1 (what lord-server sees itself): display server without root, Landlock ABI, lord-netperm with its kernel pieces, verified system code, remote desktop port closed when off (/proc/net), session cgroup tree owned by root, GPU composition and memory, each marked configured, effective or measured; facts from sysreport/facts.c with tests over fake trees

Federico Pereiradbf367b93240
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 83e936e..5f70797 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,7 +20,10 @@ of the matching [GitHub release](https://github.com/lordbasex/LordOS/releases),
render node, GPU context, composition, direct scanout) with the exact reason when the screen is
composed on the CPU, and a Compatibility panel says what works, what works with limits and what
wasn't checked. Its Report tab shows the exact text of a report (Markdown or JSON) before you copy
- it or save it to Documents; nothing is sent anywhere.
+ it or save it to Documents; nothing is sent anywhere. Its Checks tab checks LordOS's claims on this
+ computer (display server without root, Landlock, the per-app firewall, verified code, the remote
+ desktop closed when off, app scopes owned by the system) and says whether each was only found
+ configured or actually tried.
- **`lordos-sysreport report`** prints the hardware of this computer and what the system made of it,
as Markdown or `--json`, with no serial numbers, addresses or names: the base of System
Information.
diff --git a/apps/sysinfo/checks.js b/apps/sysinfo/checks.js
new file mode 100644
index 0000000..eb9d0a7
--- /dev/null
+++ b/apps/sysinfo/checks.js
@@ -0,0 +1,81 @@
+// checks.js — System Information's Checks tab (docs/BENCHMARK.md, "Checks: configured versus
+// effective"): each claim LordOS makes, checked on this machine, at one of two levels, never claiming
+// the stronger one without the test:
+// configured the mechanism is present (a kernel feature, a service running, an owner);
+// effective something was tried and gave the right answer;
+// measured a number, shown as it is (no pass or fail in this version).
+// Part 1 (0.8.5) has only what lord-server can see itself; the probe app that tries what must fail
+// (sandbox, firewall) is part 2. The thresholds are constants here: this file is bundled into the
+// theme, which is signed with the release key (code-manifest.json), so they are signed too.
+//
+// evaluate(ctx) → rows { id, paper, level, state, note, vars }, state 'pass' | 'warn' | 'fail' |
+// 'info' | 'unknown'. ctx: { report: lord.sysinfo.report(), facts: lord.sysinfo.facts(),
+// code: codeStatus(), remote: remote.status() or null, stats: lord.stats() or null }. Pure: tested
+// by server/tests/sysinfo_model_test.mjs.
+
+export const LIMITS = {
+ landlockAbi: 6, // scoping of abstract sockets and signals (docs/FIREWALL.md)
+ remotePort: 5673,
+};
+
+const row = (id, paper, level, state, note = null, vars = {}) => ({ id, paper, level, state, note, vars });
+
+export function evaluate(ctx) {
+ const c = ctx || {};
+ const r = c.report || {}, f = c.facts || {}, sw = r.software || {}, s = r.session || {};
+ const out = [];
+
+ // lord-server runs as the user, never as root (§2.2)
+ if (f.uid == null || f.uid < 0) out.push(row('serverUser', '§2.2', 'configured', 'unknown'));
+ else out.push(row('serverUser', '§2.2', 'configured', f.uid > 0 && f.euid > 0 ? 'pass' : 'fail', f.uid > 0 && f.euid > 0 ? 'serverUserOk' : 'serverUserRoot', { uid: f.uid }));
+
+ // Landlock (§6.4): the ABI the launcher needs for restricted apps
+ const ll = sw.landlockAbi;
+ if (ll == null) out.push(row('landlock', '§6.4', 'configured', 'unknown'));
+ else if (ll >= LIMITS.landlockAbi) out.push(row('landlock', '§6.4', 'configured', 'pass', 'landlockOk', { abi: ll }));
+ else if (ll > 0) out.push(row('landlock', '§6.4', 'configured', 'warn', 'landlockOld', { abi: ll, min: LIMITS.landlockAbi }));
+ else out.push(row('landlock', '§6.4', 'configured', 'fail', 'landlockNone'));
+
+ // the per-app firewall (§6.6): lord-netperm running, and the kernel pieces its programs need
+ const kc = sw.kernelConfig || {};
+ const services = sw.services || {};
+ if (services['lord-netperm'] == null) out.push(row('netperm', '§6.6', 'configured', 'unknown'));
+ else if (!services['lord-netperm']) out.push(row('netperm', '§6.6', 'configured', 'fail', 'netpermOff'));
+ else if (kc.CONFIG_CGROUP_BPF === 'n' || !sw.bpfLsm) out.push(row('netperm', '§6.6', 'configured', 'warn', !sw.bpfLsm ? 'netpermNoLsm' : 'netpermNoCgroupBpf'));
+ else out.push(row('netperm', '§6.6', 'configured', 'pass', 'netpermOk'));
+
+ // LordOS's own code (§6.9): every bundle loaded this session matched the signed manifest
+ const code = c.code || {};
+ if (code.refused && code.refused.length) out.push(row('code', '§6.9', 'effective', 'fail', 'codeRefused', { count: code.refused.length }));
+ else if (code.state === 'verified') out.push(row('code', '§6.9', 'effective', 'pass', 'codeVerified', { count: code.files || 0 }));
+ else if (code.state === 'development') out.push(row('code', '§6.9', 'effective', 'warn', 'codeDevelopment'));
+ else out.push(row('code', '§6.9', 'effective', 'unknown'));
+
+ // the remote desktop (§11.4): off means nothing listens on its port (read from /proc/net)
+ const listening = f.remoteListening;
+ const on = c.remote ? !!c.remote.enabled : null;
+ if (listening == null) out.push(row('remoteClosed', '§11.4', 'effective', 'unknown'));
+ else if (on === true) out.push(row('remoteClosed', '§11.4', 'effective', 'info', listening ? 'remoteOnListening' : 'remoteOnNotListening', { port: LIMITS.remotePort }));
+ else out.push(row('remoteClosed', '§11.4', 'effective', listening ? 'fail' : 'pass', listening ? 'remoteOffListening' : 'remoteOffClosed', { port: LIMITS.remotePort }));
+
+ // the session's cgroup tree belongs to root (§11.4): an app can't leave its scope
+ // (only LordOS's own tree counts: a lord-server started from a terminal sits in that terminal's cgroup)
+ if (f.leafRoot == null || f.parentRoot == null) out.push(row('cgroups', '§11.4', 'configured', 'unknown'));
+ else if (!/\/lordos-session-\d+\/server$/.test(f.cgroup || '')) out.push(row('cgroups', '§11.4', 'configured', 'info', 'cgroupsNotSession'));
+ else out.push(row('cgroups', '§11.4', 'configured', f.leafRoot && f.parentRoot ? 'pass' : 'fail',
+ f.leafRoot && f.parentRoot ? 'cgroupsOk' : 'cgroupsUser', { scopes: f.appScopes || 0 }));
+
+ // the GPU composes when there is one (§7.3)
+ if (s.composition === 'gpu') out.push(row('gpu', '§7.3', 'configured', 'pass', 'gpuOn', { renderer: s.renderer || '' }));
+ else if (['headless', 'no-display', 'capture'].includes(s.composition)) out.push(row('gpu', '§7.3', 'configured', 'info', `gpuNot.${s.composition}`));
+ else out.push(row('gpu', '§7.3', 'configured', 'warn', `gpuNot.${s.gpuInit || s.composition || 'unknown'}`));
+
+ // memory (§7.1): what this session uses now; the idle measurement belongs to LordBench (0.8.6)
+ const st = c.stats || {};
+ if (st.rssKB) out.push(row('memory', '§7.1', 'measured', 'info', 'memoryNow', { mb: Math.round(st.rssKB / 1024) }));
+
+ return out;
+}
+
+// The checks part 2 adds, shown as not checked yet.
+export const PENDING = ['appSandbox', 'helperSandbox', 'netpermEffective'];
diff --git a/apps/sysinfo/index.jsx b/apps/sysinfo/index.jsx
index 48ebd5e..42f5066 100644
--- a/apps/sysinfo/index.jsx
+++ b/apps/sysinfo/index.jsx
@@ -6,9 +6,10 @@
import {
View, Text, ScrollView, Button, useTheme, useLocale, LordOSLogo, systemReport, systemInfo, lordosVersion, formatBytes, formatNumber,
Toolbar, ToolbarSpacer, ToolbarButton, Segmented, SidebarItem, GroupBox, FormRow, EmptyState, Hairline, spacing, typeScale,
- fs, userDirs, clipboard, wm, admin,
+ fs, userDirs, clipboard, wm, admin, remote, codeStatus,
} from '@lordos/sdk';
import { useMemo, useState } from 'react';
+import { evaluate as evaluateChecks, PENDING as PENDING_CHECKS } from './checks.js';
import { cardLayers, sessionLayers, compatibility, hardwareSections, throttleFlags, machineName, compositionReason, reportFileName, reportJson, parseMemoryLines } from './model.js';
// The app's icon: a chip on the brand gradient.
@@ -346,6 +347,53 @@ function Compatibility({ r }) {
);
}
+// ---- Checks ----
+
+const CHECK_COLOR = { pass: '#30d158', warn: '#ff9f0a', fail: '#ff453a', info: '#0a84ff', unknown: '#8e8e93', pending: '#8e8e93' };
+
+function CheckRow({ c }) {
+ const t = useTheme();
+ const { t: tr } = useLocale();
+ const note = !c.note ? '' : c.note.startsWith('gpuNot.')
+ ? tr('sysinfo.compat.cpuBecause', { reason: tr(`sysinfo.reason.${camel(c.note.slice(7))}`) })
+ : tr(`sysinfo.checkNote.${c.note}`, c.vars);
+ return (
+ <View style={{ flexDirection: 'row', alignItems: 'center', gap: spacing.m, minHeight: 44, paddingVertical: 6 }}>
+ <View style={{ width: 10, height: 10, borderRadius: 5, backgroundColor: CHECK_COLOR[c.state] || '#8e8e93' }} />
+ <View style={{ width: 220, gap: 2 }}>
+ <Text style={{ fontSize: typeScale.body, color: t.text, textAlign: 'start' }}>{tr(`sysinfo.check.${c.id}`)}</Text>
+ <Text style={{ fontSize: typeScale.caption, color: t.textDim, textAlign: 'start' }}>
+ {[tr(`sysinfo.level.${c.level}`), c.paper ? tr('sysinfo.paperRef', { ref: c.paper }) : ''].filter(Boolean).join(' · ')}</Text>
+ </View>
+ <Text style={{ width: 120, fontSize: typeScale.callout, fontWeight: 600, color: CHECK_COLOR[c.state], textAlign: 'start' }}>{tr(`sysinfo.checkState.${c.state}`)}</Text>
+ <Text style={{ flex: 1, minWidth: 0, fontSize: typeScale.callout, color: t.textDim, textAlign: 'start', lineHeight: 1.35 }}>{note}</Text>
+ </View>
+ );
+}
+
+function Checks({ r }) {
+ const { t: tr } = useLocale();
+ const rows = useMemo(() => {
+ let facts = null, rem = null, stats = null;
+ try { facts = lord.sysinfo.facts(); } catch (e) { /* older server */ }
+ try { rem = remote.status(); } catch (e) { /* no remote desktop */ }
+ try { stats = lord.stats(); } catch (e) { /* no stats */ }
+ return evaluateChecks({ report: r, facts, code: codeStatus(), remote: rem, stats });
+ }, [r]);
+ return (
+ <ScrollView style={{ flex: 1 }}>
+ <View style={{ padding: spacing.xl, gap: spacing.xl }}>
+ <GroupBox footer={tr('sysinfo.checksFooter')}>
+ {rows.map((c) => <CheckRow key={c.id} c={c} />)}
+ </GroupBox>
+ <GroupBox title={tr('sysinfo.checksPendingTitle')} footer={tr('sysinfo.checksPendingFooter')}>
+ {PENDING_CHECKS.map((id) => <CheckRow key={id} c={{ id, level: 'effective', state: 'pending' }} />)}
+ </GroupBox>
+ </View>
+ </ScrollView>
+ );
+}
+
// ---- Report ----
// The exact text that would be saved, line by line (leading spaces kept as no-break spaces).
@@ -415,11 +463,11 @@ export default function SystemInformation() {
<Toolbar>
<ToolbarSpacer />
<Segmented appearance="neutral" value={tab} onChange={setTab}
- options={[['overview', tr('sysinfo.tab.overview')], ['hardware', tr('sysinfo.tab.hardware')], ['compat', tr('sysinfo.tab.compat')], ['report', tr('sysinfo.tab.report')]]} />
+ options={[['overview', tr('sysinfo.tab.overview')], ['hardware', tr('sysinfo.tab.hardware')], ['compat', tr('sysinfo.tab.compat')], ['checks', tr('sysinfo.tab.checks')], ['report', tr('sysinfo.tab.report')]]} />
<ToolbarSpacer />
<ToolbarButton icon="↻" title={tr('sysinfo.refresh')} onClick={() => setN(n + 1)} />
</Toolbar>
- {tab === 'overview' ? <Overview r={r} info={info} /> : tab === 'hardware' ? <Hardware r={r} /> : tab === 'compat' ? <Compatibility r={r} /> : <Report r={r} />}
+ {tab === 'overview' ? <Overview r={r} info={info} /> : tab === 'hardware' ? <Hardware r={r} /> : tab === 'compat' ? <Compatibility r={r} /> : tab === 'checks' ? <Checks r={r} /> : <Report r={r} />}
</View>
);
}
diff --git a/assets/locales/en/sysinfo.json b/assets/locales/en/sysinfo.json
index b1e633f..98d0c64 100644
--- a/assets/locales/en/sysinfo.json
+++ b/assets/locales/en/sysinfo.json
@@ -9,6 +9,56 @@
"bus.virtio": "Virtual disk",
"cardTitle": "{card} ({bus})",
"cgroup2": "cgroup v2",
+ "check.appSandbox": "An isolated app can't get out",
+ "check.cgroups": "App scopes belong to the system",
+ "check.code": "Verified system code",
+ "check.gpu": "Composition on the GPU",
+ "check.helperSandbox": "Decoders are locked in",
+ "check.landlock": "App file isolation (Landlock)",
+ "check.memory": "Display server memory",
+ "check.netperm": "Per-app firewall",
+ "check.netpermEffective": "A denied app can't connect",
+ "check.remoteClosed": "Remote desktop closed when off",
+ "check.serverUser": "Display server without root",
+ "checkNote.cgroupsNotSession": "This lord-server isn't in a LordOS session's tree (started from a terminal?)",
+ "checkNote.cgroupsOk": {
+ "one": "The session's tree is root's; {scopes} app scope now",
+ "other": "The session's tree is root's; {scopes} app scopes now"
+ },
+ "checkNote.cgroupsUser": "The session's tree belongs to the user: an app could leave its scope",
+ "checkNote.codeDevelopment": "A development build: the system code isn't signed",
+ "checkNote.codeRefused": {
+ "one": "{count} modified component was refused",
+ "other": "{count} modified components were refused"
+ },
+ "checkNote.codeVerified": {
+ "one": "{count} component matched its signature this session",
+ "other": "{count} components matched their signature this session"
+ },
+ "checkNote.gpuOn": "Composed on the GPU ({renderer})",
+ "checkNote.landlockNone": "The kernel has no Landlock",
+ "checkNote.landlockOk": "Landlock ABI {abi}",
+ "checkNote.landlockOld": "Landlock ABI {abi}: restricted Linux apps need {min} and won't start",
+ "checkNote.memoryNow": "lord-server uses {mb} MB now (the idle measurement comes with LordBench)",
+ "checkNote.netpermNoCgroupBpf": "Running, but the kernel has no cgroup BPF",
+ "checkNote.netpermNoLsm": "Running, but without the BPF security module: Bluetooth can't be denied per app",
+ "checkNote.netpermOff": "lord-netperm isn't running: per-app network rules aren't applied",
+ "checkNote.netpermOk": "lord-netperm is running with its kernel programs",
+ "checkNote.remoteOffClosed": "Off, and nothing listens on port {port}",
+ "checkNote.remoteOffListening": "Off, but something listens on port {port}",
+ "checkNote.remoteOnListening": "On by your choice: listening on port {port}",
+ "checkNote.remoteOnNotListening": "On, but nothing listens on port {port}",
+ "checkNote.serverUserOk": "lord-server runs as user {uid}",
+ "checkNote.serverUserRoot": "lord-server runs as root",
+ "checkState.fail": "Failed",
+ "checkState.info": "Information",
+ "checkState.pass": "Passed",
+ "checkState.pending": "Not checked yet",
+ "checkState.unknown": "Not known",
+ "checkState.warn": "Warning",
+ "checksFooter": "Configured: the mechanism is in place. Effective: it was tried and gave the right answer. Nothing here is sent anywhere.",
+ "checksPendingFooter": "These need a test app that tries what must fail; they come in a later step.",
+ "checksPendingTitle": "Coming next",
"compat.batteryHealth": "The battery holds {health} % of its design charge",
"compat.batteryWorn": "The battery holds {health} % of its design charge",
"compat.count.audio": {
@@ -130,6 +180,9 @@
"layer.scanout": "Direct scanout",
"layer.vulkan": "Vulkan",
"layout": "{sockets} × {cores} cores, {threads} threads",
+ "level.configured": "Configured",
+ "level.effective": "Effective",
+ "level.measured": "Measured",
"lordos": "LordOS {v}",
"lordosChannel": "LordOS {v} ({channel})",
"modules.empty": "Empty",
@@ -158,6 +211,7 @@
"note.softwareRefused": "only a software renderer was found",
"off": "Off",
"on": "On",
+ "paperRef": "paper {ref}",
"pi.powerOk": "No under-voltage since boot",
"pi.throttleOk": "Never slowed down since boot",
"pi.throttledNow": "Slowed down now (heat or power)",
@@ -217,6 +271,7 @@
"state.unchecked": "Not checked",
"state.works": "Works",
"state.yes": "Available",
+ "tab.checks": "Checks",
"tab.compat": "Compatibility",
"tab.hardware": "Hardware",
"tab.overview": "Overview",
diff --git a/assets/locales/es/sysinfo.json b/assets/locales/es/sysinfo.json
index 95f8fc7..fb1d114 100644
--- a/assets/locales/es/sysinfo.json
+++ b/assets/locales/es/sysinfo.json
@@ -9,6 +9,56 @@
"bus.virtio": "Disco virtual",
"cardTitle": "{card} ({bus})",
"cgroup2": "cgroup v2",
+ "check.appSandbox": "Una app aislada no puede salir",
+ "check.cgroups": "Los scopes de las apps son del sistema",
+ "check.code": "Código del sistema verificado",
+ "check.gpu": "Composición en la GPU",
+ "check.helperSandbox": "Los decodificadores quedan encerrados",
+ "check.landlock": "Aislamiento de archivos (Landlock)",
+ "check.memory": "Memoria del servidor gráfico",
+ "check.netperm": "Firewall por app",
+ "check.netpermEffective": "Una app bloqueada no puede conectarse",
+ "check.remoteClosed": "Escritorio remoto cerrado si está apagado",
+ "check.serverUser": "Servidor gráfico sin root",
+ "checkNote.cgroupsNotSession": "Este lord-server no está en el árbol de una sesión de LordOS (¿se abrió desde una terminal?)",
+ "checkNote.cgroupsOk": {
+ "one": "El árbol de la sesión es de root; {scopes} scope de app ahora",
+ "other": "El árbol de la sesión es de root; {scopes} scopes de apps ahora"
+ },
+ "checkNote.cgroupsUser": "El árbol de la sesión es del usuario: una app podría salir de su scope",
+ "checkNote.codeDevelopment": "Una compilación de desarrollo: el código del sistema no está firmado",
+ "checkNote.codeRefused": {
+ "one": "Se rechazó {count} componente modificado",
+ "other": "Se rechazaron {count} componentes modificados"
+ },
+ "checkNote.codeVerified": {
+ "one": "{count} componente coincidió con su firma en esta sesión",
+ "other": "{count} componentes coincidieron con su firma en esta sesión"
+ },
+ "checkNote.gpuOn": "Se compone en la GPU ({renderer})",
+ "checkNote.landlockNone": "El kernel no tiene Landlock",
+ "checkNote.landlockOk": "Landlock ABI {abi}",
+ "checkNote.landlockOld": "Landlock ABI {abi}: las apps de Linux restringidas necesitan {min} y no van a arrancar",
+ "checkNote.memoryNow": "lord-server usa {mb} MB ahora (la medición en reposo llega con LordBench)",
+ "checkNote.netpermNoCgroupBpf": "En marcha, pero el kernel no tiene cgroup BPF",
+ "checkNote.netpermNoLsm": "En marcha, pero sin el módulo de seguridad BPF: no se puede negar Bluetooth por app",
+ "checkNote.netpermOff": "lord-netperm no está en marcha: no se aplican las reglas de red por app",
+ "checkNote.netpermOk": "lord-netperm está en marcha con sus programas del kernel",
+ "checkNote.remoteOffClosed": "Apagado, y nada escucha en el puerto {port}",
+ "checkNote.remoteOffListening": "Apagado, pero algo escucha en el puerto {port}",
+ "checkNote.remoteOnListening": "Activado por vos: escucha en el puerto {port}",
+ "checkNote.remoteOnNotListening": "Activado, pero nada escucha en el puerto {port}",
+ "checkNote.serverUserOk": "lord-server corre como el usuario {uid}",
+ "checkNote.serverUserRoot": "lord-server corre como root",
+ "checkState.fail": "Falló",
+ "checkState.info": "Información",
+ "checkState.pass": "Correcto",
+ "checkState.pending": "Todavía sin verificar",
+ "checkState.unknown": "Desconocido",
+ "checkState.warn": "Advertencia",
+ "checksFooter": "Configurado: el mecanismo está puesto. Efectivo: se probó y respondió bien. Nada de esto se envía a ningún lado.",
+ "checksPendingFooter": "Necesitan una app de prueba que intente lo que tiene que fallar; llegan en un paso siguiente.",
+ "checksPendingTitle": "Lo que sigue",
"compat.batteryHealth": "La batería conserva el {health} % de su carga de diseño",
"compat.batteryWorn": "La batería conserva el {health} % de su carga de diseño",
"compat.count.audio": {
@@ -130,6 +180,9 @@
"layer.scanout": "Scanout directo",
"layer.vulkan": "Vulkan",
"layout": "{sockets} × {cores} núcleos, {threads} hilos",
+ "level.configured": "Configurado",
+ "level.effective": "Efectivo",
+ "level.measured": "Medido",
"lordos": "LordOS {v}",
"lordosChannel": "LordOS {v} ({channel})",
"modules.empty": "Vacío",
@@ -158,6 +211,7 @@
"note.softwareRefused": "solo se encontró un renderer por software",
"off": "Desactivado",
"on": "Activado",
+ "paperRef": "documento {ref}",
"pi.powerOk": "Sin bajo voltaje desde el arranque",
"pi.throttleOk": "Nunca se limitó desde el arranque",
"pi.throttledNow": "Limitada ahora (calor o alimentación)",
@@ -217,6 +271,7 @@
"state.unchecked": "Sin verificar",
"state.works": "Funciona",
"state.yes": "Disponible",
+ "tab.checks": "Verificaciones",
"tab.compat": "Compatibilidad",
"tab.hardware": "Hardware",
"tab.overview": "Resumen",
diff --git a/assets/locales/pt/sysinfo.json b/assets/locales/pt/sysinfo.json
index 8e3e081..9dc1c42 100644
--- a/assets/locales/pt/sysinfo.json
+++ b/assets/locales/pt/sysinfo.json
@@ -9,6 +9,56 @@
"bus.virtio": "Disco virtual",
"cardTitle": "{card} ({bus})",
"cgroup2": "cgroup v2",
+ "check.appSandbox": "Um app isolado não consegue sair",
+ "check.cgroups": "Os escopos dos apps pertencem ao sistema",
+ "check.code": "Código do sistema verificado",
+ "check.gpu": "Composição na GPU",
+ "check.helperSandbox": "Os decodificadores ficam presos",
+ "check.landlock": "Isolamento de arquivos (Landlock)",
+ "check.memory": "Memória do servidor gráfico",
+ "check.netperm": "Firewall por app",
+ "check.netpermEffective": "Um app bloqueado não consegue se conectar",
+ "check.remoteClosed": "Área de trabalho remota fechada quando desligada",
+ "check.serverUser": "Servidor gráfico sem root",
+ "checkNote.cgroupsNotSession": "Este lord-server não está na árvore de uma sessão do LordOS (aberto por um terminal?)",
+ "checkNote.cgroupsOk": {
+ "one": "A árvore da sessão é do root; {scopes} escopo de app agora",
+ "other": "A árvore da sessão é do root; {scopes} escopos de apps agora"
+ },
+ "checkNote.cgroupsUser": "A árvore da sessão pertence ao usuário: um app poderia sair do seu escopo",
+ "checkNote.codeDevelopment": "Uma compilação de desenvolvimento: o código do sistema não está assinado",
+ "checkNote.codeRefused": {
+ "one": "{count} componente modificado foi recusado",
+ "other": "{count} componentes modificados foram recusados"
+ },
+ "checkNote.codeVerified": {
+ "one": "{count} componente conferiu com a assinatura nesta sessão",
+ "other": "{count} componentes conferiram com a assinatura nesta sessão"
+ },
+ "checkNote.gpuOn": "Composta na GPU ({renderer})",
+ "checkNote.landlockNone": "O kernel não tem Landlock",
+ "checkNote.landlockOk": "Landlock ABI {abi}",
+ "checkNote.landlockOld": "Landlock ABI {abi}: apps Linux restritos precisam de {min} e não vão iniciar",
+ "checkNote.memoryNow": "lord-server usa {mb} MB agora (a medição em repouso chega com o LordBench)",
+ "checkNote.netpermNoCgroupBpf": "Rodando, mas o kernel não tem cgroup BPF",
+ "checkNote.netpermNoLsm": "Rodando, mas sem o módulo de segurança BPF: não é possível negar Bluetooth por app",
+ "checkNote.netpermOff": "lord-netperm não está rodando: as regras de rede por app não são aplicadas",
+ "checkNote.netpermOk": "lord-netperm está rodando com seus programas do kernel",
+ "checkNote.remoteOffClosed": "Desligado, e nada escuta na porta {port}",
+ "checkNote.remoteOffListening": "Desligado, mas algo escuta na porta {port}",
+ "checkNote.remoteOnListening": "Ativado por você: escutando na porta {port}",
+ "checkNote.remoteOnNotListening": "Ativado, mas nada escuta na porta {port}",
+ "checkNote.serverUserOk": "lord-server roda como o usuário {uid}",
+ "checkNote.serverUserRoot": "lord-server roda como root",
+ "checkState.fail": "Falhou",
+ "checkState.info": "Informação",
+ "checkState.pass": "Correto",
+ "checkState.pending": "Ainda não verificado",
+ "checkState.unknown": "Desconhecido",
+ "checkState.warn": "Aviso",
+ "checksFooter": "Configurado: o mecanismo está ativo. Efetivo: foi testado e respondeu certo. Nada disso é enviado.",
+ "checksPendingFooter": "Precisam de um app de teste que tente o que deve falhar; chegam numa próxima etapa.",
+ "checksPendingTitle": "O que vem a seguir",
"compat.batteryHealth": "A bateria mantém {health} % da carga original",
"compat.batteryWorn": "A bateria mantém {health} % da carga original",
"compat.count.audio": {
@@ -130,6 +180,9 @@
"layer.scanout": "Scanout direto",
"layer.vulkan": "Vulkan",
"layout": "{sockets} × {cores} núcleos, {threads} threads",
+ "level.configured": "Configurado",
+ "level.effective": "Efetivo",
+ "level.measured": "Medido",
"lordos": "LordOS {v}",
"lordosChannel": "LordOS {v} ({channel})",
"modules.empty": "Vazio",
@@ -158,6 +211,7 @@
"note.softwareRefused": "só foi encontrado um renderizador por software",
"off": "Desativado",
"on": "Ativado",
+ "paperRef": "documento {ref}",
"pi.powerOk": "Sem subtensão desde a inicialização",
"pi.throttleOk": "Nunca foi limitada desde a inicialização",
"pi.throttledNow": "Limitada agora (calor ou alimentação)",
@@ -217,6 +271,7 @@
"state.unchecked": "Não verificado",
"state.works": "Funciona",
"state.yes": "Disponível",
+ "tab.checks": "Verificações",
"tab.compat": "Compatibilidade",
"tab.hardware": "Hardware",
"tab.overview": "Resumo",
diff --git a/docs/BENCHMARK.md b/docs/BENCHMARK.md
index ff713f9..7c6ab91 100644
--- a/docs/BENCHMARK.md
+++ b/docs/BENCHMARK.md
@@ -277,7 +277,23 @@ so it shows disabled):
![Hardware → Memory](sysinfo-memory.png)
-Not yet: video decode and encode and Vulkan (shown as *Not checked*), the Checks tab.
+**Checks, part 1 (2026-10-26):** what `lord-server` can see itself, evaluated in `apps/sysinfo/checks.js`
+(the thresholds are constants there, so they are signed with the theme bundle instead of a separate
+`checks.json`), from `lord.sysinfo.facts()` (`sysreport/facts.c`: lord-server's uid/euid from
+`/proc/self/status`, its cgroup and who owns it, the app scopes beside it, and whether anything
+listens on port 5673 in `/proc/net/tcp{,6}`): display server without root (§2.2), Landlock ABI ≥ 6
+(§6.4), `lord-netperm` running with cgroup BPF and the BPF LSM (§6.6), verified system code
+(effective: every bundle loaded this session matched; §6.9), remote desktop closed when off
+(effective: nothing listens on its port; §11.4), the session's cgroup tree owned by root (only inside
+`…/lordos-session-<uid>/server`; §11.4), composition on the GPU (§7.3) and lord-server's memory now
+(measured, no pass or fail; §7.1). On VM 116 it found two real things: `lord-netperm` isn't installed
+there (the unit doesn't exist), and the first run refused a stale `app-host.bundle.js` in the test
+tree. Part 2, the probe app that tries what must fail (sandbox, helper sandbox, a denied connection),
+waits for the maintainer's approval.
+
+![Checks, part 1](sysinfo-checks.png)
+
+Not yet: video decode and encode and Vulkan (shown as *Not checked*), Checks part 2.
1. `server/src/sysreport/`: collector, GPU layers, `pci.ids`/EDID readers, fake-sysfs fixtures
(AMD desktop, Intel laptop, Nvidia desktop, Raspberry Pi 5, VM), the anonymization test,
diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md
index a778a1a..1298659 100644
--- a/docs/ROADMAP.md
+++ b/docs/ROADMAP.md
@@ -595,7 +595,8 @@ Details in `MAIL.md`. Tested on VM 123 against local Dovecot, Postfix and Radica
- [x] the GPU's live layers (EGL, composition, scanout) through `lord.sysinfo` (2026-10-26);
- [x] the read-only `hw-memory-modules` admin action (2026-10-26);
- [x] Overview, Hardware and Compatibility tabs (en, es, pt; 2026-10-26; right to left not yet checked on screen);
- - [ ] Checks, configured and effective, with the probe app and a signed `checks.json`;
+ - [x] Checks part 1: what lord-server sees itself, configured and effective (2026-10-26);
+ - [ ] Checks part 2: the probe app that tries what must fail (needs approval);
- [x] reports: the Report tab with the exact text, Copy and Save to Documents (2026-10-26);
- [ ] first real reports from the Pi 5 with a monitor and the RX 580 PC.
- [ ] from the live USB without installing: a *Check this computer* boot entry, reports marked
diff --git a/docs/sysinfo-checks.png b/docs/sysinfo-checks.png
new file mode 100644
index 0000000..aebf40c
Binary files /dev/null and b/docs/sysinfo-checks.png differ
diff --git a/server/mk/settings.mk b/server/mk/settings.mk
index c9acda3..9e47cd0 100644
--- a/server/mk/settings.mk
+++ b/server/mk/settings.mk
@@ -3,7 +3,7 @@
# Objects are added to lord-server as extra prerequisites ($^ in its link rule takes them).
HW_SRC := src/hw/edid.c src/hw/modes.c src/hw/night.c src/hw/mimeapps.c src/hw/power.c src/hw/jbuf.c src/hw/display.c \
src/hw/uevent.c src/hw/sysbus.c src/hw/bt.c src/hw/ppd.c src/hw/hw.c src/hw/hw_admin.c src/hw/defaults.c src/hw/notifyd.c src/hw/hwscan.c src/hw/brframe.c src/ui/js_hw.c \
- src/sysreport/sysreport.c src/sysreport/sysreport_out.c src/sysreport/ids.c src/sysreport/smbios.c \
+ src/sysreport/sysreport.c src/sysreport/sysreport_out.c src/sysreport/ids.c src/sysreport/smbios.c src/sysreport/facts.c \
src/ui/js_fan.c src/fan/fancurve.c
HW_HDR := $(wildcard src/hw/*.h) $(wildcard src/sysreport/*.h) $(wildcard src/fan/*.h) src/ui/js_hw.h src/ui/js_fan.h src/kms.h src/vault/dbus.h
HW_OBJ := $(HW_SRC:src/%.c=build/obj/%.o)
diff --git a/server/mk/sysreport.mk b/server/mk/sysreport.mk
index b3d0a7d..1d9ef05 100644
--- a/server/mk/sysreport.mk
+++ b/server/mk/sysreport.mk
@@ -1,7 +1,7 @@
# System Information (0.8.5, src/sysreport, docs/BENCHMARK.md): the collector, shared by the
# `lordos-sysreport` and `lordos-fetch` commands (one binary; build/lordos-fetch is a link) and
# (later) lord.sysinfo. Read-only, no root, libc only.
-SYSREPORT_SRC := src/sysreport/sysreport.c src/sysreport/fetch.c src/sysreport/smbios.c src/sysreport/sysreport_out.c src/sysreport/ids.c src/hw/edid.c src/hw/jbuf.c src/sec/json.c
+SYSREPORT_SRC := src/sysreport/sysreport.c src/sysreport/fetch.c src/sysreport/smbios.c src/sysreport/facts.c src/sysreport/sysreport_out.c src/sysreport/ids.c src/hw/edid.c src/hw/jbuf.c src/sec/json.c
SYSREPORT_HDR := $(wildcard src/sysreport/*.h) src/hw/edid.h src/hw/jbuf.h src/sec/json.h
all: build/lordos-sysreport build/lordos-fetch
build/lordos-fetch: build/lordos-sysreport
diff --git a/server/src/sysreport/facts.c b/server/src/sysreport/facts.c
new file mode 100644
index 0000000..5bc4a0a
--- /dev/null
+++ b/server/src/sysreport/facts.c
@@ -0,0 +1,107 @@
+/* facts.c — the running session's facts for the Checks tab (see facts.h). */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include "facts.h"
+
+#include <dirent.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+static char *slurp(const char *root, const char *path, size_t max) {
+ char p[1024];
+ snprintf(p, sizeof p, "%s%s", root, path);
+ int fd = open(p, O_RDONLY | O_CLOEXEC);
+ if (fd < 0) return NULL;
+ char *b = malloc(max + 1);
+ size_t got = 0;
+ while (b && got < max) {
+ ssize_t n = read(fd, b + got, max - got);
+ if (n <= 0) break;
+ got += (size_t)n;
+ }
+ close(fd);
+ if (b) b[got] = 0;
+ return b;
+}
+
+/* 1 root-owned, 0 not, -1 missing */
+static int root_owned(const char *root, const char *path) {
+ char p[1024];
+ struct stat st;
+ snprintf(p, sizeof p, "%s/sys/fs/cgroup%s", root, path);
+ if (lstat(p, &st) || !S_ISDIR(st.st_mode)) return -1;
+ return st.st_uid == 0;
+}
+
+void sr_facts(SrFacts *f, const char *root) {
+ if (!root) root = "";
+ memset(f, 0, sizeof *f);
+ f->uid = f->euid = -1;
+ f->leaf_root = f->parent_root = -1;
+ char *st = slurp(root, "/proc/self/status", 16384);
+ const char *u = st ? strstr(st, "\nUid:") : NULL;
+ if (u) {
+ int a, b;
+ if (sscanf(u + 5, "%d %d", &a, &b) == 2) { f->uid = a; f->euid = b; }
+ }
+ free(st);
+
+ /* "0::/system.slice/lordos.service/lordos-session-1000/server" (cgroup v2) */
+ char *cg = slurp(root, "/proc/self/cgroup", 4096);
+ const char *z = cg ? strstr(cg, "0::") : NULL;
+ if (z && (z == cg || z[-1] == '\n')) {
+ z += 3;
+ size_t n = strcspn(z, "\n");
+ if (n && n < sizeof f->cgroup && z[0] == '/' && !memmem(z, n, "..", 2)) {
+ memcpy(f->cgroup, z, n);
+ f->cgroup[n] = 0;
+ }
+ }
+ free(cg);
+ if (f->cgroup[0]) {
+ f->leaf_root = root_owned(root, f->cgroup);
+ char parent[256];
+ snprintf(parent, sizeof parent, "%s", f->cgroup);
+ char *sl = strrchr(parent, '/');
+ if (sl && sl != parent) {
+ *sl = 0;
+ f->parent_root = root_owned(root, parent);
+ char p[1024];
+ snprintf(p, sizeof p, "%s/sys/fs/cgroup%s", root, parent);
+ DIR *d = opendir(p);
+ struct dirent *e;
+ while (d && (e = readdir(d))) {
+ size_t l = strlen(e->d_name);
+ if (!strncmp(e->d_name, "app-", 4) && l > 10 && !strcmp(e->d_name + l - 6, ".scope")) f->app_scopes++;
+ }
+ if (d) closedir(d);
+ }
+ }
+}
+
+/* /proc/net/tcp{,6}: " sl local_address rem_address st …", local "HEX:PORT", st 0A = LISTEN */
+static int scan(const char *root, const char *path, unsigned port) {
+ char *t = slurp(root, path, 4u << 20);
+ if (!t) return -1;
+ int found = 0;
+ for (char *l = strchr(t, '\n'); l && !found; l = strchr(l + 1, '\n')) {
+ char local[64], remote[64], state[8];
+ if (sscanf(l + 1, "%*s %63s %63s %7s", local, remote, state) != 3) continue;
+ const char *c = strrchr(local, ':');
+ if (c && strtoul(c + 1, NULL, 16) == port && !strcmp(state, "0A")) found = 1;
+ }
+ free(t);
+ return found;
+}
+
+int sr_tcp_listening(const char *root, unsigned port) {
+ if (!root) root = "";
+ int a = scan(root, "/proc/net/tcp", port), b = scan(root, "/proc/net/tcp6", port);
+ if (a < 0 && b < 0) return -1;
+ return a > 0 || b > 0;
+}
diff --git a/server/src/sysreport/facts.h b/server/src/sysreport/facts.h
new file mode 100644
index 0000000..ab634a5
--- /dev/null
+++ b/server/src/sysreport/facts.h
@@ -0,0 +1,21 @@
+/* facts.h — what System Information's Checks tab reads about the running session (docs/BENCHMARK.md,
+ * "Checks: configured versus effective"), without root: lord-server's own ids from /proc/self/status,
+ * its cgroup and who owns it, the app scopes beside it, and whether anything listens on a TCP port
+ * (/proc/net/tcp and tcp6, which list every socket of the network namespace). `root` prefixes every
+ * path ("" for this machine), as in sysreport.h. */
+#ifndef LORD_SYSREPORT_FACTS_H
+#define LORD_SYSREPORT_FACTS_H
+
+typedef struct {
+ int uid, euid; /* -1 unknown */
+ char cgroup[256]; /* the unified hierarchy path, "" unknown */
+ int leaf_root, parent_root; /* the cgroup and its parent are root-owned (-1 unknown) */
+ int app_scopes; /* app-*.scope folders beside the leaf */
+} SrFacts;
+
+void sr_facts(SrFacts *f, const char *root);
+
+/* 1 if a socket listens on the TCP port (IPv4 or IPv6), 0 if none, -1 if /proc/net can't be read. */
+int sr_tcp_listening(const char *root, unsigned port);
+
+#endif
diff --git a/server/src/ui/js_hw.c b/server/src/ui/js_hw.c
index 625a3b6..5c94adc 100644
--- a/server/src/ui/js_hw.c
+++ b/server/src/ui/js_hw.c
@@ -25,6 +25,9 @@
* lordos-sysreport, no serials, addresses or names) plus
* session: how this session composes the screen and its
* GPU context (gpu/gpu.h gpu_info, lord_composition)
+ * lord.sysinfo.facts() the Checks tab's facts (sysreport/facts.c): lord-server's
+ * uid/euid, its cgroup and who owns it, app scopes, and
+ * whether anything listens on the remote desktop's port
* lord.sysinfo.markdown() the same report as Markdown, as lordos-sysreport prints it,
* with a "This session" section (System Information's Report tab)
* lord.fan.status() / setProfile(p) / setCurve(pts) / force(v) / caseConfig() (js_fan.c, lord-fand)
@@ -46,6 +49,7 @@
#include "../hw/hwscan.h"
#include "../gpu/gpu.h"
#include "../sysreport/sysreport.h"
+#include "../sysreport/facts.h"
#include "lord_version.h" /* build/gen: the version for the report */
#include "../hw/mimeapps.h"
#include "../hw/notifyd.h"
@@ -435,8 +439,27 @@ static JSValue f_sysinfo_markdown(JSContext *c, JSValueConst t, int argc, JSValu
return v;
}
+static JSValue f_sysinfo_facts(JSContext *c, JSValueConst t, int argc, JSValueConst *argv) {
+ (void)t; (void)argc; (void)argv;
+ const char *root = hwscan_root();
+ SrFacts f;
+ sr_facts(&f, root);
+ JSValue o = JS_NewObject(c);
+ JS_SetPropertyStr(c, o, "uid", JS_NewInt32(c, f.uid));
+ JS_SetPropertyStr(c, o, "euid", JS_NewInt32(c, f.euid));
+ JS_SetPropertyStr(c, o, "cgroup", JS_NewString(c, f.cgroup));
+ JS_SetPropertyStr(c, o, "leafRoot", f.leaf_root < 0 ? JS_NULL : JS_NewBool(c, f.leaf_root));
+ JS_SetPropertyStr(c, o, "parentRoot", f.parent_root < 0 ? JS_NULL : JS_NewBool(c, f.parent_root));
+ JS_SetPropertyStr(c, o, "appScopes", JS_NewInt32(c, f.app_scopes));
+ int l = sr_tcp_listening(root, 5673); /* the remote desktop's port (docs/REMOTE.md) */
+ JS_SetPropertyStr(c, o, "remoteListening", l < 0 ? JS_NULL : JS_NewBool(c, l));
+ JS_SetPropertyStr(c, o, "fixture", JS_NewBool(c, root[0] != 0));
+ return o;
+}
+
static const JSCFunctionListEntry sysinfo_funcs[] = {
JS_CFUNC_DEF("report", 0, f_sysinfo_report),
+ JS_CFUNC_DEF("facts", 0, f_sysinfo_facts),
JS_CFUNC_DEF("markdown", 0, f_sysinfo_markdown),
};
diff --git a/server/tests/sysinfo_model_test.mjs b/server/tests/sysinfo_model_test.mjs
index 1d20bf8..ed8a8f7 100644
--- a/server/tests/sysinfo_model_test.mjs
+++ b/server/tests/sysinfo_model_test.mjs
@@ -1,6 +1,7 @@
// sysinfo_model_test.mjs — System Information's model (apps/sysinfo/model.js, 0.8.5): the GPU layers,
// the reasons for CPU composition, the Compatibility panel and the Hardware sections. Run by
// tests/run_suites.sh (needs node).
+import { evaluate, LIMITS } from '../../apps/sysinfo/checks.js';
import { compositionReason, cardLayers, sessionLayers, compatibility, hardwareSections, throttleFlags, machineName, reportFileName, reportJson, parseMemoryLines } from '../../apps/sysinfo/model.js';
let n = 0, bad = 0;
@@ -97,5 +98,31 @@ eq('module lines', parseMemoryLines(['mem 16384|DDR4|3200|2666|DIMM_A1|BANK 0|Ki
eq('bad lines dropped', parseMemoryLines(['fw x y', 'mem 1|DDR4|1|1|a|b', 'mem x|DDR4|1|1|a|b|c', 'mem 1|DDR4|1|1|a|b|c|d', `mem 1|DDR4|1|1|${'a'.repeat(40)}|b|c`, null]), []);
eq('not a list', parseMemoryLines(undefined), []);
+// ---- checks (part 1) ----
+const st = (rows) => Object.fromEntries(rows.map((r) => [r.id, r.state]));
+const good = {
+ report: { software: { landlockAbi: 6, bpfLsm: true, kernelConfig: { CONFIG_CGROUP_BPF: 'y' }, services: { 'lord-netperm': true } },
+ session: { composition: 'gpu', renderer: 'AMD Radeon RX 580' } },
+ facts: { uid: 1000, euid: 1000, cgroup: '/system.slice/lordos.service/lordos-session-1000/server', leafRoot: true, parentRoot: true, appScopes: 3, remoteListening: false },
+ code: { state: 'verified', files: 9, refused: [] }, remote: { enabled: false }, stats: { rssKB: 71680 },
+};
+eq('a healthy system', st(evaluate(good)), { serverUser: 'pass', landlock: 'pass', netperm: 'pass', code: 'pass', remoteClosed: 'pass', cgroups: 'pass', gpu: 'pass', memory: 'info' });
+eq('levels', evaluate(good).map((r) => r.level), ['configured', 'configured', 'configured', 'effective', 'effective', 'configured', 'configured', 'measured']);
+const broken = {
+ report: { software: { landlockAbi: 3, bpfLsm: false, kernelConfig: {}, services: { 'lord-netperm': false } }, session: { composition: 'gpu-off', gpuInit: 'no-3d' } },
+ facts: { uid: 0, euid: 0, cgroup: '/system.slice/lordos.service/lordos-session-0/server', leafRoot: false, parentRoot: true, appScopes: 0, remoteListening: true },
+ code: { state: 'verified', files: 9, refused: [{ path: 'x' }] }, remote: { enabled: false },
+};
+eq('a broken system', st(evaluate(broken)), { serverUser: 'fail', landlock: 'warn', netperm: 'fail', code: 'fail', remoteClosed: 'fail', cgroups: 'fail', gpu: 'warn' });
+eq('broken notes', evaluate(broken).map((r) => r.note), ['serverUserRoot', 'landlockOld', 'netpermOff', 'codeRefused', 'remoteOffListening', 'cgroupsUser', 'gpuNot.no-3d']);
+eq('remote on by choice is information', evaluate({ ...good, remote: { enabled: true }, facts: { ...good.facts, remoteListening: true } }).find((r) => r.id === 'remoteClosed'),
+ { id: 'remoteClosed', paper: '§11.4', level: 'effective', state: 'info', note: 'remoteOnListening', vars: { port: LIMITS.remotePort } });
+eq('no BPF LSM is a warning', evaluate({ ...good, report: { ...good.report, software: { ...good.report.software, bpfLsm: false } } }).find((r) => r.id === 'netperm').note, 'netpermNoLsm');
+eq('headless is information', evaluate({ ...good, report: { ...good.report, session: { composition: 'headless' } } }).find((r) => r.id === 'gpu').state, 'info');
+eq('development code is a warning', evaluate({ ...good, code: { state: 'development' } }).find((r) => r.id === 'code').state, 'warn');
+eq('outside LordOS\'s session tree it is only information', evaluate({ ...good, facts: { ...good.facts, cgroup: '/user.slice/user-1000.slice/session-3.scope' } }).find((r) => r.id === 'cgroups'),
+ { id: 'cgroups', paper: '§11.4', level: 'configured', state: 'info', note: 'cgroupsNotSession', vars: {} });
+eq('nothing known', st(evaluate({})), { serverUser: 'unknown', landlock: 'unknown', netperm: 'unknown', code: 'unknown', remoteClosed: 'unknown', cgroups: 'unknown', gpu: 'warn' });
+
console.log(`sysinfo-model-test: ${n - bad} ok, ${bad} failed`);
process.exit(bad ? 1 : 0);
diff --git a/server/tests/sysreport_test.c b/server/tests/sysreport_test.c
index 5a19253..918b72a 100644
--- a/server/tests/sysreport_test.c
+++ b/server/tests/sysreport_test.c
@@ -16,6 +16,7 @@
#include "sysreport/ids.h"
#include "sysreport/fetch.h"
#include "sysreport/smbios.h"
+#include "sysreport/facts.h"
#include "sec/json.h"
#include <errno.h>
@@ -577,6 +578,38 @@ static void test_smbios(void) {
CHECK(smbios_memory_parse(NULL, 100, &m) == -1, "smbios: NULL");
}
+static void test_facts(void) {
+ char root[] = "/tmp/sysreport-facts-XXXXXX";
+ if (!mkdtemp(root)) { printf("mkdtemp\n"); exit(2); }
+ put(root, "proc/self/status", "Name:\tlord-server\nUmask:\t0022\nState:\tS\nUid:\t1000\t1000\t1000\t1000\nGid:\t1000\n");
+ put(root, "proc/self/cgroup", "0::/system.slice/lordos.service/lordos-session-1000/server\n");
+ char p[1024];
+ snprintf(p, sizeof p, "%s/sys/fs/cgroup/system.slice/lordos.service/lordos-session-1000/server", root); mkdirs(p);
+ snprintf(p, sizeof p, "%s/sys/fs/cgroup/system.slice/lordos.service/lordos-session-1000/app-lordos-media.scope", root); mkdirs(p);
+ snprintf(p, sizeof p, "%s/sys/fs/cgroup/system.slice/lordos.service/lordos-session-1000/app-lordos-chromium.scope", root); mkdirs(p);
+ put(root, "sys/fs/cgroup/system.slice/lordos.service/lordos-session-1000/cgroup.procs", "");
+ put(root, "proc/net/tcp", " sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode\n"
+ " 0: 0100007F:0277 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0 0 1 1\n"
+ " 1: 3400A8C0:1629 0500A8C0:C350 01 00000000:00000000 00:00000000 00000000 0 0 2 1\n");
+ put(root, "proc/net/tcp6", " sl local_address remote_address st\n"
+ " 0: 00000000000000000000000000000000:0016 00000000000000000000000000000000:0000 0A 0 0\n");
+ SrFacts f;
+ sr_facts(&f, root);
+ int me_root = getuid() == 0;
+ CHECK(f.uid == 1000 && f.euid == 1000, "facts: uid %d/%d", f.uid, f.euid);
+ CHECK(!strcmp(f.cgroup, "/system.slice/lordos.service/lordos-session-1000/server"), "facts: cgroup %s", f.cgroup);
+ CHECK(f.leaf_root == me_root && f.parent_root == me_root && f.app_scopes == 2, "facts: owners %d %d scopes %d", f.leaf_root, f.parent_root, f.app_scopes);
+ CHECK(sr_tcp_listening(root, 5673) == 0, "facts: 5673 only connected, not listening");
+ CHECK(sr_tcp_listening(root, 631) == 1 && sr_tcp_listening(root, 22) == 1, "facts: listening v4 and v6");
+ put(root, "proc/net/tcp6", " sl local_address remote_address st\n 0: 00000000000000000000000000000000:1629 00000000000000000000000000000000:0000 0A 0 0\n");
+ CHECK(sr_tcp_listening(root, 5673) == 1, "facts: 5673 listening (v6)");
+ put(root, "proc/self/cgroup", "0::/../../etc\n");
+ sr_facts(&f, root);
+ CHECK(!f.cgroup[0] && f.leaf_root == -1, "facts: a path with .. is refused");
+ rmtree(root);
+ CHECK(sr_tcp_listening("/nonexistent", 5673) == -1, "facts: no /proc/net");
+}
+
static void test_empty(void) {
char root[] = "/tmp/sysreport-empty-XXXXXX";
if (!mkdtemp(root)) { printf("mkdtemp\n"); exit(2); }
@@ -611,6 +644,7 @@ int main(int argc, char **argv) {
}
test_ids();
test_smbios();
+ test_facts();
const char *kinds[] = { "amd", "intel", "nvidia", "rpi5", "vm" };
for (size_t i = 0; i < sizeof kinds / sizeof kinds[0]; i++) { test_kind(kinds[i]); test_fetch(kinds[i]); }
setenv("NO_COLOR", "1", 1);