feat(agent): remote self-uninstall over the control channel (VA-87) #90
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/VA-87-remote-self-uninstall"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add an
uninstallaction to the post-auth control-channel dispatcher so the server can tell a connected agent to fully remove itself when a device is deleted. The agent acks the command FIRST (so the server can complete the delete) and only then spawns a detached teardown that removes the service unit and binary, wipes the enrolled identity/certs and the entire settings + data dirs, and exits the process so the removed binary cannot reconnect.Full removal is a separate path from the audit-preserving CLI uninstall:
install::uninstall_full/uninstall_full_self(systemd system + user, mode picked from the effective uid) andinstall_windows::uninstall_service_full(SCM service, scheduling the running exe for delete-on-reboot via MoveFileEx when it cannot be deleted live). The state-preserving CLIuninstall_system/uninstall_user/uninstall_serviceare unchanged. Teardown is best-effort: the identity/state wipe runs even if unit/binary removal fails, and the process exits regardless.The teardown+exit is gated behind a new
DispatchContext::apply_uninstallflag (mirroringapply_oobupdate): off by default so tests and detached dispatchers only ack, flipped on in the production net.rs wiring. Tests cover the ack-without-teardown contract, the flag default/builder, and that the full wipe removes the enrolled identity dir and is idempotent.#VA-87