Files
rust-discovery/web/src/opnsense.tsx
T
2026-11-19 19:53:51 +01:00

25 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { RecordValue } from './api';
export function OPNsenseDetails({ device }: { device: RecordValue }) {
if (device.source_id !== 'opnsense.base') return null;
const inventory = device.inventory as RecordValue | null;
function list(key: string, title: string) {
const report = inventory?.[key] as RecordValue | undefined;
const available = report?.status === 'ok' || report?.status === 'partial';
const rows = Array.isArray(report?.entries) ? report.entries.filter((x): x is string => typeof x === 'string') : [];
return <div key={key}><h3>{title}</h3>{!available ? <p>Nicht ermittelbar</p> : <>
{report?.status === 'partial' && <p>Auszug – unvollständige Liste</p>}
{rows.length ? <ol>{rows.map((line, i) => <li key={i}><code>{line}</code></li>)}</ol> : <p>Keine Einträge gemeldet.</p>}
</>}</div>;
}
return <>
<section><h2>VPN-Verbindungen</h2>
{list('vpn_configured', 'Konfigurierte VPNs')}
{list('wireguard', 'WireGuard · letzter Handshake je Peer')}
{list('openvpn', 'OpenVPN · Laufzeitstatus')}
{list('ipsec', 'IPsec · aktive Sicherheitsassoziationen')}
</section>
<section><h2>Firewallregeln</h2>{list('firewall', 'Aktive PF-Filterregeln · Hauptregelsatz in Auswertungsreihenfolge')}</section>
</>;
}