Port presets: name ports automatically, scan many hosts for a preset, apply names in bulk

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-30 22:39:52 +01:00
1 parent 93aaf5476d
commit fca2dc0338
24 files changed
+9764 -40

No files matched your search

+9 -3
View File
@@ -17,6 +17,7 @@ import Pagination from "../components/Pagination";
import { downloadCsv } from "../utils/csv";
import { formatAgo } from "../utils/duration";
import { ErrorNotice } from "../components/Notice";
import PortPresets from "../components/PortPresets";
import { EmptyRow, LoadingRow } from "../components/EmptyState";
const emptyForm: PortForwardInput = {
@@ -90,12 +91,13 @@ export default function Ports({ user }: { user: CurrentUser }) {
function exportAgentCsv() {
downloadCsv(
"agent-reported-ports.csv",
["Server", "Hostname", "Protocol", "Port", "Addresses", "Process", "Local only"],
["Server", "Hostname", "Protocol", "Port", "Service", "Addresses", "Process", "Local only"],
(sortedAgentPorts ?? []).map((p) => [
p.serverName,
p.serverHostname ?? "",
p.protocol,
p.port,
p.service ?? "",
p.addresses.join(", "),
p.process ?? "",
p.localOnly ? "yes" : "no",
@@ -184,6 +186,8 @@ export default function Ports({ user }: { user: CurrentUser }) {
<>
<h2 className="page-title mb-3">Ports</h2>
<PortPresets canEdit={canEdit} />
<div className="row g-3 mb-3">
<div className="col-12">
<div className="card">
@@ -209,6 +213,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
<SortableTh<AgentPortRow> label="Server" sortKeyName="serverName" activeKey={agentSortKey} direction={agentSortDir} onSort={requestAgentSort} />
<SortableTh<AgentPortRow> label="Protocol" sortKeyName="protocol" activeKey={agentSortKey} direction={agentSortDir} onSort={requestAgentSort} />
<SortableTh<AgentPortRow> label="Port" sortKeyName="port" activeKey={agentSortKey} direction={agentSortDir} onSort={requestAgentSort} />
<th>Service</th>
<th>Address</th>
<th>Process</th>
<SortableTh<AgentPortRow> label="Last report" sortKeyName="lastSeenAt" activeKey={agentSortKey} direction={agentSortDir} onSort={requestAgentSort} />
@@ -223,6 +228,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
</td>
<td className="text-uppercase text-secondary">{p.protocol}</td>
<td>{p.port}</td>
<td className="text-secondary" title={p.service ? "Named by a port preset" : undefined}>{p.service ?? "—"}</td>
<td className="text-secondary">
{p.addresses.join(", ")}
{p.localOnly && <span className="badge bg-secondary-lt text-secondary ms-2">local only</span>}
@@ -231,9 +237,9 @@ export default function Ports({ user }: { user: CurrentUser }) {
<td className="text-secondary"><TimeAgo value={p.lastSeenAt} /></td>
</tr>
))}
{agentPorts === null && <LoadingRow colSpan={6} />}
{agentPorts === null && <LoadingRow colSpan={7} />}
{agentPorts !== null && agentPorts.length === 0 && (
<EmptyRow colSpan={6} title="No listening ports reported yet" hint="Each server's agent lists what is listening with its next report. Install or update the agent to see ports here." action={{ label: "Go to Servers", to: "/servers" }} />
<EmptyRow colSpan={7} title="No listening ports reported yet" hint="Each server's agent lists what is listening with its next report. Install or update the agent to see ports here." action={{ label: "Go to Servers", to: "/servers" }} />
)}
</tbody>
</table>