Commit Graph
5 Commits
Author SHA1 Message Date
bobbanandClaude Sonnet 5.5 540ab704b7 Export CSV on every table, edit recurring maintenance, runs-on nothing, and run package checks outside the agent sandbox
- Export CSV for the small tables that had none (reads the table as shown)
- Servers page shows a skeleton while loading instead of "No servers registered yet"
- Recurring maintenance schedules can be edited (PUT /schedules/:id)
- A server can be set to run on nothing (servers.no_parent, migration 0028)
- Linux agent v3: package-manager question runs in ExecStartPre=-+ outside the sandbox,
  with --prepare-updates and --check-updates modes
- Docs: README, DATABASE, AGENT_UPDATE

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 22:25:18 +02:00
bobbanandClaude Sonnet 5.5 5c70956f78 Linux agent unit: keep only the root powers it uses; make unit files readable
The systemd unit now bounds the agent's capabilities to the three jobs it does as root --
reading every user's crontab (DAC_OVERRIDE, DAC_READ_SEARCH), running "crontab -l -u"
(SETUID, SETGID) and naming the program behind each socket (SYS_PTRACE) -- and adds
ProtectClock, ProtectHostname, MemoryDenyWriteExecute and DevicePolicy=closed. It does not
use PrivateDevices, which would hide /dev/log (crontab logs each read there), nor anything
that hides other processes or users, since the agent needs both.

The installer's umask 077 (for the token file) also left the unit files readable by root only;
they now get chmod 644, so "systemctl cat" works for any user.

The test renders the unit through the installer's own heredoc, so a stray backtick or $ would
show up, and pins the capability list: tightening it silently drops tasks or process names.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-06 22:48:50 +02:00
bobbanandClaude Sonnet 5.5 047fcb403e Harden the agents: keep the token off the command line, lock down their files
Linux: the token went to curl as an argument, readable by any local user in the process
list, and the reply was written to a fixed /tmp file that another user could replace with
a symlink (the agent runs as root). The token now goes to curl on stdin, and the payload
and reply live in a private mktemp directory that is removed afterwards. This also lifts
the limit on a report's size that a command-line argument imposed. The systemd unit now
runs with NoNewPrivileges, ProtectSystem=strict, PrivateTmp and similar restrictions
(it still sees every process, which is how it names the program behind a port).

Windows: the SYSTEM task's folder was left to inherit ProgramData's permissions. It now
gets explicit ones: SYSTEM and Administrators only.

Installed agents keep their own copy of the script, so each server needs the install
one-liner re-run to pick this up.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-06 22:05:17 +02:00
bobbanandClaude Sonnet 5 130212baec Add an opt-in insecure-TLS mode for the agent, for self-signed certs
Installing the agent against a Homelab Manager instance with a
self-signed cert failed: curl verifies TLS by default on the install
download, the report-tasks.sh fetch inside install.sh, and every
periodic check-in — not just the outer one-liner, so passing -k to only
that first curl wasn't enough. Mirrors the existing Proxmox/Synology
"insecure" toggle pattern already in this app.

- install.sh and report-tasks.sh accept API_INSECURE=true, adding -k to
  their own curl calls; install.sh persists it into the agent's env
  file so the periodic systemd timer picks it up too.
- The Servers & Tasks page has a new checkbox next to the generated
  install/uninstall commands that adds -k and API_INSECURE=true for
  you, so the outer one-liner (which install.sh's own logic can't
  touch) also skips verification.

Off by default — only for a trusted LAN.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-15 18:26:19 +02:00
bobbanandClaude Sonnet 5 9712d611a6 Add Servers & Tasks module ported from Schedule Task Manager
Ports cron/systemd task tracking across Debian/Raspbian servers, including
the Linux push agent (install/report/uninstall scripts, rebranded from
"schedule-task-manager-agent" to "homelab-manager-agent") and the
manual-task-entry flow for things an agent can't see (Docker jobs, backups).
The schema (servers/scheduled_tasks tables) was already in place from the
foundation pass, so this is mostly a straight port of the original's
services/routes.

Deliberate change from the original: server/token management (which mints
agent credentials) is now admin-only rather than open to any logged-in user,
and manual task CRUD is gated to operator+ — consistent with how Secrets,
IPAM, and DNS already split "configure credentials" from "everyday edits"
across roles. All mutations are audit-logged.

- server/src/services/tokens.ts, taskSync.ts: ported near-verbatim (agent
  token hashing, the agent-sync-marks-missing-as-stale-not-deleted logic).
- server/src/routes/servers.ts, tasks.ts, agentReport.ts: same contract as
  the original (agent auth is a per-server bearer token, independent of the
  session-based requireAuth used everywhere else).
- web: a single Servers & Tasks page (filter bar, task table grouped by
  server/schedule type, manual task form, and an admin-only server
  management panel with token reveal + copyable install/uninstall commands),
  replacing the original's two separate pages/apps.

Verified: full build passes; a scripted HTTP test against a running server
covers unauthenticated access, role gating at each tier (admin-only server
mgmt, operator+ task mgmt), agent bearer-token auth (valid/invalid/rotated),
manual-vs-agent task edit protection, stale-marking on re-sync, and cascade
delete — 22/22 checks passing. Real agent installation on an actual
Debian/Raspbian host still needs to be tried on the user's network.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-14 23:16:58 +02:00