On Unraid upgrades, install.sh previously stopped the running pulse-agent watchdog and binary before calling write_unraid_go_entry. When /boot/config/go contained a custom or unrecognized Pulse Agent line (such as a hand-edited setsid launch), a prior staging directory, or a missing trailing newline, write_unraid_go_entry returned 1 silently, left an empty go.pulse-setup.* staging directory behind, and exited with the live agent stopped.
Add a read-only preflight mode to write_unraid_go_entry and invoke it before stopping existing agents:
- Validates /boot/config/go in a temporary directory without mutating /boot/config or leaving a blocking go.pulse-setup.* staging directory on pure validation refusal.
- Sets a fixed, non-secret UNRAID_GO_FAILURE_REASON describing why the boot file was rejected (for example, a custom or unrecognized Pulse Agent entry with the expected line, a prior recovery directory, or a missing trailing newline) and includes it in the error message.
- Keeps the existing agent running if /boot/config/go cannot be updated cleanly, while retaining all existing write-mode staging, verification, and recovery-preservation guarantees.
Contract-Neutral: Add read-only preflight check before stopping Unraid agents and report non-secret refusal reasons from write_unraid_go_entry without changing Unraid boot replacement admission or recovery boundaries
Download the Go toolchain during install.sh --source to an explicit path inside an owner-only temp directory via create_temp_archive_path and wget -O instead of unpacking a fixed name in shared /tmp.
Run all inline python3 invocations in install.sh, scripts/install.sh, and scripts/uninstall-sensor-proxy.sh in isolated mode (-I) so root never imports attacker-planted modules from a shared working directory or PYTHONPATH.
Declare PULSE_RELEASE_ASSET in install.sh and scripts/pulse-auto-update.sh and validate both in scripts/validate-release.sh. Strictly enforce the install.sh asset declaration in scripts/pulse-auto-update.sh and reject mismatched asset declarations in install.sh while allowing pre-rollout unstamped releases until a stamped stable release publishes as releases/latest.
Contract-Neutral: Security hardening of installer verification and privilege boundaries without public contract delta
Keep the installed agent binary root-owned (0755) in both least-privilege profiles and gate Upgrade Detection's --version probe on trusted_lifecycle_regular_file so root never executes a collector-writable binary. Update docs/AGENT_SECURITY.md, its public mirror, and the deployment-installability subsystem doc to match.
Prepare the typed-helper update quarantine with collector authority via runuser unless its parent is a non-symlink root-owned directory closed to group and world writes, and refuse a symlinked quarantine path.
Verify process identity in collect_running_agent_pids (real and effective UID 0, executable basename, and host root directory or jail ID) so unprivileged local users or container processes named pulse-agent cannot inject settings into --update, --retarget, or --uninstall.
Harden safe-profile rollback by refusing symlinked state roots before quiescence, taking ownership and write access of the state root away from the collector before restoring entries, replacing destinations with rm -rf and propagating all entry errors, and discarding non-restored-owner state left inside the state directory when returning to a different service account.
Contract-Neutral: Security hardening of installer verification and privilege boundaries without public contract delta
scripts/render_installers.go used strings.ReplaceAll on the signing key placeholder, which also rewrote the unpinned-key sentinel in install.sh and install.ps1 and caused rendered installers to skip ssh-keygen signature verification. Pin only the key assignment and refuse changed templates.
Update scripts/install.ps1 to invoke ssh-keygen directly and stream raw binary bytes into stdin instead of calling cmd.exe /d /s /c (whose outer-quote stripping breaks quoted paths) or Start-Process -RedirectStandardInput (which re-encodes binary payloads).
In scripts/install.sh, derive curl's sha256// public-key pin from the certificate verified by --server-fingerprint and pass --pinnedpubkey on all six curl request lists so subsequent requests remain bound to the verified peer even with -k.
Contract-Neutral: Security hardening of installer verification and privilege boundaries without public contract delta
Read the installed startup choice independently of saved connection recovery. Bind an inherited opt-in and platform type to the selected state directory, keep an unmarked update off, and retain explicit overrides and fresh detection. Exercise the real lifecycle ordering through service rendering.
Contract-Neutral: Restore the existing installer flags and local setup choice across manual replacement; no new registration, privilege, identity, remote profile or backup coverage contract.
Change-source: pulse-maintainer
Prepare both 0755 boot entries before stopping the agent. Keep the prior entries in private same-filesystem staging so a failed publication, executable move, or token write cannot leave the new startup flags paired with the previous credential when recovery succeeds.
Exercise the shipped installer and the next-start command with different old and new settings. Preserve pre-stop refusal, plain FreeBSD behavior, and the existing runtime token path and mode.
Contract-Neutral: Restores the documented pfSense boot and in-place update behavior at the existing service and private token paths. No supported platform, lifecycle interface or access boundary changes.
Change-source: pulse-maintainer
If the staged agent cannot start during URL admission, tell the operator
whether to inspect the temporary download mount or the agent installation
filesystem. The location of the installer script itself is not its scratch
directory. Keep the actual path, URL and child output out of the diagnostic.
Cover both directory choices in text and JSON, the signed SCALE scratch
fallback, and the second check for a direct-runtime install. Keep failed
admission ahead of any stop or replacement.
Refs #4748.
Contract-Neutral: Clarify the existing CLI execution-error message; signature checks, URL admission, exit and event shape, staging paths and service ordering are unchanged.
Change-source: pulse-maintainer
Keep verified downloads on scratch storage. If a Linux TrueNAS install uses the fixed protected default destination and scratch is not executable, stage the verified collector there before running URL admission or changing an existing installation. Recheck the transferred bytes and publish the same file only after admission.
Contract-Neutral: Uses the already supported SCALE installation and runtime path; leaves signature and URL policy, saved state, service interfaces, and the existing storage relocation path unchanged.
Change-source: pulse-maintainer
Keep pre-token preflight metadata-only and state what it cannot check. A verified collector can now report a definite URL rejection; unclassified and older exits still stop safely without guessing why or exposing the child output.
Refs #4748
Contract-Neutral: Deployment-installability and security-privacy are unchanged: preflight sequence, installer exits and event identities, TLS and URL admission, signature verification, credentials and redaction keep their existing contracts. Agent-lifecycle records the validator exit classification.
Change-source: pulse-maintainer
Separate the local HTTP admission rule from the installer's TLS setting. Tell operators when preflight checked metadata only, and distinguish a staged binary that cannot start from an unclassified validator exit. Keep verification, URL admission, output confidentiality and exit behavior unchanged.
Refs #4748
Contract-Neutral: Deployment-installability and security-privacy have no contract delta: HTTP/TLS admission, checksum and signature checks, state mutation order and exit/event identifiers are unchanged. Agent-lifecycle documents the diagnostic with executable verification; the shared deployment contract is unchanged.
Change-source: pulse-maintainer
Apply destination execution admission only where the prepared file is the service runtime. TrueNAS intentionally persists on a filesystem that may be noexec and chooses a separate execution path later. Exercise that unchanged handoff for both installation and update alongside direct-runtime refusal controls.
Contract-Neutral: Preserves the existing TrueNAS persistence and runtime-selection contract while tightening only ordinary direct-runtime preparation.
Change-source: pulse-maintainer
Run the existing read-only URL admission command on the destination-staged collector before ordinary service stop or publication. Keep initial signed-download validation and the separate privilege-migration transaction unchanged. Extend registered real-file staging controls for child refusal, actual execute-permission denial, unchanged state and cleanup.
Contract-Neutral: Strengthens existing pre-disruption preparation without changing installer profiles, transport or signature policy, credential and service interfaces, or migration semantics.
Change-source: pulse-maintainer
Stage the verified optional helper on its destination filesystem and establish root ownership and executable mode before ordinary collector stop or publication. Keep privilege migration on its existing snapshot and rollback path. Exercise preparation failures, both final renames, retained state, helper-disabled installs and owned cleanup through the shipped shell statements.
Contract-Neutral: Internal staging preserves installer profiles, signatures, credential and service interfaces, and the separate privilege-migration transaction.
Change-source: pulse-maintainer
Move the verified payload into destination-local staging before disruption, avoiding an extra binary copy when temporary and install storage share a filesystem. Retain the pre-stop transfer/mode refusal and check source-inode preservation plus complete staging at the stop boundary in the registered tests.
Contract-Neutral: Same internal collector preparation invariant and interfaces; avoid an unnecessary same-filesystem payload copy without changing admission, authority or service policy.
Change-source: pulse-maintainer
Prepare the verified collector and its executable mode on the installation filesystem before the existing upgrade stop/kill path. Refuse staging failures without disrupting the installed binary or saved state; retain safe-profile migration's separate transaction. Exercise fresh/upgrade success, partial writes, mode/allocation failures, directory conflicts and publication failure through the shipped statements with confined service doubles.
Contract-Neutral: Internal collector preparation ordering preserves the existing install, trust, privilege, saved-state and completion contracts; no API, profile or authority changes.
Change-source: pulse-maintainer
The agent can report a failed container's last log lines since #4342,
but only through a flag or an environment variable on the agent itself.
Nobody installing from the copied command would find it, and the
installer rejected the flag as an unknown argument.
The shell installer now takes --enable-failure-logs and
--disable-failure-logs, and the PowerShell installer takes
-EnableFailureLogs or PULSE_ENABLE_FAILURE_LOGS. Each writes the flag
into the service arguments. An update or reinstall that names neither
keeps what the installed service has, so the choice survives agent
updates, and the disable flag is the way off: without it the recovered
service argument would turn the option back on.
The install screen gains "Send the last log lines of a failed
container" beside the copied commands, outside the advanced options and
unticked by default. Command access sat behind the advanced fold until
#1728 because people missed it there. Ticking it adds the flag, or the
PowerShell environment assignment, to every copied install command. It
mints no token and changes no scope, and it cannot reach an agent that
is already installed. The text says what leaves the host, that masking
can miss a secret, and how to turn it off.
It is still a local choice. Nothing here gives the server a way to turn
it on.
The generated bootstrap includes apply_freebsd_agent_enablement but calls an installer-only wrapper, exiting 127 before starting the agent. Call its rendered helper, preserve enable/stop/start failures and require bounded running-state readback before reporting success. Exercise the actual writer and generated scripts with confined CORE/SCALE manager fixtures, persistent-state comparisons, alternate runtime paths and failed phases.
Contract-Neutral: Restores the existing self-contained TrueNAS agent boot and truthful startup contract; no new profile, grants, credential handling, monitoring readiness claim or frontend behavior.
Change-source: pulse-maintainer
Use first-option -q for every Unix agent installer curl invocation, including the preflight arrays. curl versions before 7.50.0 do not recognize --disable. Keep explicit private config, CA/TLS/proxy settings, URLs, bounds, checksum/signature admission and saved-state behavior unchanged; require the compatible first option in the exact-call and private-token assertions.
Contract-Neutral: Compatibility spelling only within the existing installer transport policy; no profile, runtime protocol, service behavior or admission interface changes.
Change-source: pulse-maintainer
Finish the existing transport isolation across version lookup, signed artifact downloads and local runtime probes. Keep explicit CA, TLS, proxy environment, deadlines, redirect and signature behavior unchanged. Exercise actual transfer statements with real isolated curl and bind the new controls into rootful source qualification.
Contract-Neutral: Installer implementation hardening only; CLI, API, persisted profiles, signed-artifact admission and explicit transport/environment options remain unchanged.
Change-source: pulse-maintainer
Default curlrc files can bypass the existing explicit trust, no-retry and request-inventory guarantees of the non-mutating agent availability probes. Start both preflight curl arrays with --disable; keep installer-selected CA/insecure choices, environment proxies, deadlines, existing results and saved state.
Exercise the complete CLI with real curl and local TLS under conflicting configuration, including health and metadata refusals, extra configured URL, explicit trust/proxy choices and all three artifact probes. Leave the human E2E claim and its contract files unchanged.
Contract-Neutral: Enforce the existing preflight trust, deadline and non-mutating lifecycle guarantees without adding CLI options, changing JSON or exit contracts, or changing install/removal authority.
Change-source: pulse-maintainer
A connection timeout does not cover a server that accepts the health request but stalls on headers or its response body. Keep that exchange within ten seconds, including redirects, so the existing nonzero preflight result prevents installation.
Exercise complete preflight with real curl and local TLS for successful, refused and stalled responses. Preserve saved files, trust, metadata checks, no retry and existing JSON/exit outcomes.
Contract-Neutral: Bound one existing preflight request without changing CLI options, messages, result codes, trust, install ordering or supported lifecycle contracts.
Change-source: pulse-maintainer
Profile rollback ignored failed stop commands before replacing binaries, credentials and saved identity. Reuse the existing bounded systemd teardown admission for the collector and helper, including its final batch readback, before any restoration. Preserve the saved snapshot on refusal and leave the independent runner alone. Add stateful refusal, reactivation, cleanup and successful recovery controls.
Contract-Neutral: Enforces the existing fail-closed collector/helper rollback and saved-state preservation contract; no lifecycle interface, privilege grant, platform or rendered UI changes.
Change-source: pulse-maintainer
Read each collector/helper unit through the existing bounded complete-state parser before creating a migration snapshot or reducing credentials. Preserve confirmed running and enablement intent, accept a genuinely absent helper, and refuse ambiguous or unrepresentable states rather than recording failed reads as disabled services. Cover refusal before file/service changes and the existing rollback path with real fixture filesystem operations.
Contract-Neutral: Restores the existing safe-profile snapshot and state-preserving rollback invariants. No manifest schema, privilege grant, command-authority reduction, transport policy or rendered-interface contract changes.
Change-source: pulse-maintainer
Missing paths currently abort in Bash without the structured argument error. Empty paths disappear during parsing and can select an inline or saved credential instead of the requested file. Refuse both before downstream validation or lifecycle work, using the existing missing-argument exit and text/JSON diagnostics. Preserve literal non-empty paths, downstream private-file validation, omitted-option fallback and intentionally empty health addresses. Registered listener-free controls exercise real CLI refusals and the exact installer prefix through parsing.
Contract-Neutral: enforce existing required credential-file paths without changing authentication, trust, profile or lifecycle contracts
Change-source: pulse-maintainer
Distinguish pre-stop missing-URL refusal from server confirmation failure after applicable quiescence. Retain credentials and service files without implying monitoring remains active, and require trusted same-instance/service-state reconciliation before retry. Preserve transport checks, ordering and the no-automatic-restart behaviour.
Change-source: pulse-maintainer
Use the verified staged agent's production primary URL policy before changing services, installed binaries, saved credentials or safe-profile authority. The URL-only mode performs no credential reads, enrollment, logging or state writes. Unsupported or unexecutable validation fails closed, and TLS bypass never becomes plaintext consent.
Contract-Neutral: No deployment-installability or security-privacy contract delta: this enforces the existing agent URL/HTTPS policy before Unix replacement, without new transport permissions, service profiles or installation routes. The owning agent lifecycle contract and real-CLI installer regressions are included; the shared deployment contract remains untouched while human PR3756 holds it.
Change-source: pulse-maintainer
Return the existing service-start failure code for failed fresh and upgrade verification, including structured output. Keep read-only log guidance and saved state rather than announcing completion or suggesting uninstall. Cover stopped, unready, disabled-health, ready and credential-rejected observations through the ordinary installer tests.
Change-source: pulse-maintainer
Replace only exact top-level generated launches, retaining ambiguous boot content and recovery on failure. Stage and validate replacement before rename, preserve unrelated jobs and existing modes without assuming FAT supports chmod, and stop installation before claiming unconfirmed boot persistence. Cover compound commands, launch-like data, write faults, FAT permission limits and caller failure in the normal installer inventory.
Change-source: pulse-maintainer
Replace substring and unterminated-range boot deletion with exact owned-entry admission and staged same-filesystem replacement. Preserve ambiguous content and failed staging for recovery, and check append plus flash unmount before claiming persistence. Exercise production writer/caller failures and keep the existing NAS removal fixtures composed. Native QNAP acceptance remains separate.
Change-source: pulse-maintainer
Fix the manual-recovery failure reported in Pulse #3331. Compare directory identity without entering the protected saved lifecycle directory, so a freshly authenticated temporary installer can finish preflight as the invoking user. Keep the saved installer's ownership, mode and checksum enforcement, including parent-directory aliases.
Contract-Neutral: Restores the existing non-root preflight and saved-installer integrity contracts; no privilege, credential, update-authorisation or rendered-interface contract changes.
Change-source: pulse-maintainer
The returned candidate failed the existing branch-tip documentation guard in script smoke shard 0. Keep that guard intact, bind help to the inspected immutable guide, and test the real emitted URL as well as the private-file commands.
Contract-Neutral: CLI guidance and its regression only; installer flags, authentication, TLS, service lifecycle and runtime behaviour are unchanged.
Change-source: pulse-maintainer
Recommend the existing inspected HTTPS/private-file route in shipped help and the source header. Exercise copied commands, saved-state updates and side-effect-free help with synthetic credentials.
Contract-Neutral: CLI guidance only; installer flags, authentication, TLS, service lifecycle and runtime behaviour are unchanged.
Change-source: pulse-maintainer
Safe-profile migration pinned the output of hostname -f as the agent's
reported name, so every migrated host switched to its FQDN while
root-profile hosts kept the short system hostname the agent reads. Pin
the system hostname instead. An explicit --hostname still wins, and the
server's authority check already accepts short and FQDN forms of the
bound name. Hosts migrated earlier keep their stored name.
Contract-Neutral: Safe-profile migration now pins the system hostname the agent already reports; no agent-lifecycle or deployment-installability clause names the hostname -f choice, and the new install_sh_test.go case proves the behaviour.
Uninstall treats a live Unraid go shell as an unknown boot owner and
refuses, because that shell may still hold later boot lines in memory.
Signalling the watchdog would release it to run them. The check only
looked for /boot/config/go in a process whose name is a shell. Unraid's
rc.local never runs that path: it writes a fromdos copy to /var/tmp/go
(go.safemode in safe mode) and executes that copy directly. The kernel
then names the process "go", with argv "/bin/bash /var/tmp/go", so the
check never matched it.
Hosts installed before the detached go entry still have this shell
blocked on the old foreground wrapper line. On those hosts uninstall
classified the shell as unrelated, stopped the watchdog, and let go run
the rest of its in-memory script. That is the case the live-shell
refusal was added to prevent.
The role check now covers a go or go.safemode process, or a shell, that
has /boot/config/go, /var/tmp/go or a .safemode form as a whole
argument. The old substring match is gone, so near-miss paths such as
/var/tmp/gopher.sh no longer block removal, and a Go toolchain process
named go still reads as unrelated. The NAS teardown control covers the
rc.local spellings, and a new role-table test pins Unraid and QNAP.
Both fail against the previous install.sh.
A go file without a #! line is still not recognised. Bash runs it in a
forked copy of rc.local, and the contracts now say so.
The Unraid installer appended `bash <wrapper>` to /boot/config/go. The
wrapper is an endless watchdog loop, so that line never returned, and
rc.local never reached anything the user had placed after the Pulse
block. On a maintainer host a reboot skipped swap, a memory logger and a
hosts entry the agent needed to reach its server, and Pulse showed the
host as down for two days while it was healthy.
The entry now backgrounds the wrapper with its output redirected, so go
returns and holds no boot output pipe open. Install-time cleanup used to
delete every go line containing "pulse-agent", including log directories,
hosts entries and a co-installed agent. It now removes only the
installer's marker and command lines that name a start-pulse-agent.sh
wrapper or this runtime binary outside a comment, so upgrades from the
foreground or hand-edited entry still leave exactly one launch. Kept
lines lose a trailing CR, as Unraid's fromdos does before running go, and
a removal that would leave go unparseable is refused with a warning.
Uninstall admits the detached entry as well as the earlier foreground
form.
The new tests execute the go file the installer writes and require it to
return, release its output pipe and run the next line, with a planted
foreground entry as the control, and pin the narrowed cleanup against
the removal filter. The NAS teardown controls now render their Unraid
entry through the same emitter.
The agent installer checked an --action-token-file's permissions with
GNU-only stat -c. BSD stat on macOS rejects it, the mode read came back
empty, and every action token file was refused as group- or
world-accessible. It now uses the existing portable_path_mode helper,
which the collector token path already relies on.
The ingress test runs both token options through the real installer
functions and the compiled token reader; on the macOS runner it is the
proof for this fix.
Contract-Neutral: portability fix restoring the documented --action-token-file option; no contract change
Preserve selected memory freshness and the VM/LXC interpretation.
Retain both native tool contracts and current API concurrency controls.
Qualify this source separately from release and installed recovery.
Contract-Neutral: Integrate already-governed parents without a new contract change. Incoming verification files already match main. Fresh integration tests and source-bound browser proof cover the combined memory and installer surfaces.
Legacy updates recover the collector's insecure setting even after the host
trusts the server certificate. Do not reject verified runner system trust
because of that unrelated setting. Keep HTTPS runner verification enabled
and preserve custom CA and exact fingerprint trust.
Exercise recovered configuration and the real credential lifecycle client
against TLS, including untrusted certificates and mismatched pins that must
receive no credential-bearing request.
A go shell can hold later launches in memory after its boot file changes. Treat that live mixed-purpose owner as unknown rather than signalling it or inferring quiescence from the edited file. Require the actual-caller refusal control alongside the existing NAS suite.
Change-source: pulse-maintainer
Retire only exact Unraid and QNAP boot entries before checked watchdog-first process termination and same-instance server removal. Preserve unrelated boot owners and refuse unknown, partial or concurrent state without erasing credentials or restarting. Exercise the complete uninstall caller and generated private watchdogs.
Change-source: pulse-maintainer
A missing SCRIPT path or empty COMMAND target cannot establish that a task is unrelated or absent. Retain recovery before any task or service mutation when those fields are unavailable. Add three actual-caller adverse controls to the mandatory sixteen-method hook and both owning contracts.
Change-source: pulse-maintainer
Disable and independently verify every exact owned middleware activation task before systemd stop and server removal. Close task, unit and process state after the full stop and after task deletion, retaining recovery on refusals or concurrent changes without restarting. Ordinary Linux state directories are not appliance identity. Register all fifteen actual-function/full-caller controls and update both owning contracts in this coherent candidate.
Change-source: pulse-maintainer
Inline and command-double changes did not establish cleanup on the retained race refusal. Register only the non-credential manual temporary with the existing installer trap and execute that exact trap in the confined caller controls. Never register the credential-bearing staged job backup for automatic deletion. All retention, no-clobber, refusal and native obligations remain intact.
Change-source: pulse-maintainer
The retained race refusals still left manual temporary files after the command-double change. Check write, permission and atomic link operations individually rather than relying on the grouped chain to reach cleanup. Keep concurrent files/directories and all credentials intact; the same mandatory race assertions remain. Matching Go1.26.9 is now actually observed and the complete installer suite remains required.
Change-source: pulse-maintainer
A pathname absence check followed by mv could overwrite a concurrent root-created job. Use exact-target non-replacement links for override creation and config restoration; directory races also refuse without creating nested artifacts. Confined concurrent-file/directory controls are mandatory. Partial activation is never restarted and conflicting staged recovery is never discarded.
Change-source: pulse-maintainer
Treat DSM6 Upstart and stale DSM7 jobs through their actual manager, not SysV or late best-effort cleanup. Keep trusted job state and credentials on refused, unknown or partial observations; require effective manual activation and observed stopped/absent processes before remote removal and local erasure. Stage the original config until absence is confirmed, restore without restart on failure, and preserve non-clobbering recovery. Mandatory production-function/caller controls retain every refusal and timeout boundary. This is confined source repair, not native Linux/Windows or whole-issue acceptance.
Change-source: pulse-maintainer
Retain recovery before unknown or unavailable timeout/sysrc observations, require bounded PID records, and align the existing daemon-supervisor assertion with checked signal delivery rather than ignored errors. Every source control remains mandatory.
Change-source: pulse-maintainer
Continue #1099: stop and disable the actual legacy manager before remote deregistration or local erasure, recheck after confirmation, and retain PID/service/credential material on refusal or unknown state. Check collector and supervisor absence, exact runlevel ownership and rendered signal failures with confined production-function controls. Appliance bootstrap and native acceptance remain separate.
Change-source: pulse-maintainer
Require bounded diagnostic-free service and all-runlevel readback before server removal or local mutation, and reconcile again after remote confirmation while recovery state still exists. Refused stops, disable failures, unknown reads and unexpected init paths retain local material; absent and repeated removal need independent manager/process absence. Add executable confined refusal, ordering, custom-runlevel and timeout-child controls to the registered installer hook and owning contracts. Native OpenRC, Windows, other-manager and installed acceptance remain separate.
Change-source: pulse-maintainer