feat: snapshot Linux-first RMM MVP and pause handover
Rust development slice / linux (push) Failing after 1m10s

This commit is contained in:
BuTzZ
2026-11-12 22:06:25 +01:00
commit 6c3203d725
194 changed files with 49234 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
# Targeted local agent/helper checks
Actually executed on the development Linux host, not the target VM:
```sh
/home/Kevin/.cargo/bin/cargo test -p rmm-agent -p rmm-agent-linux -p rmm-privileged-helper
```
First-increment result: **24 unit tests passed** (4 agent, 12 Linux provider,
6 helper verifier/ledger/clock, 2 helper peer-ACL/policy). Tests live next to their private
implementation APIs. They cover SQLite reopen, exact duplicate/conflicting
offers, request reservation ambiguity, state/event rollback, cancellation/
expiry evidence, duplicate grants and attempts, unknown resource retention,
every permit/identity binding, forged signatures, payload tampering, clock
window endpoints, unsafe paths/corruption, peer UID mismatch, root execution
denial in the network agent, actual harmless script bytes/output/limits and
provider process-group cleanup. Unsafe service/package/reboot effects use
existing typed mocks; native APT mutation is specifically tested as denied.
Also actually passed for these packages: `cargo clippy --all-targets -- -D warnings`,
`cargo fmt -- --check`, and debug `cargo build -p rmm-agent -p rmm-privileged-helper`
(using the explicit `/home/Kevin/.cargo/bin/cargo` path). Initial Clippy errors in
two provider test slice clones, helper accept-loop style and agent nested-if
style were corrected, not suppressed.
This is not a real browser-approved WSS job, VM service, package or reboot
acceptance. The complete bootstrap and known hard blockers are in
`deploy/linux/README.md`. Do not run native host mutation to replace VM evidence.
## Second increment — actually executed locally
The targeted Rust command above now passes **34 tests** (10 agent, 15 Linux,
7 helper-library, 2 helper-binary). Added tests cover native observation wire
mapping/size/unsupported metadata, fresh live inventory time, typed log request
allowlist/window/limits including inward fractional-time rounding, future-schedule fairness, write-once signing-key pins,
actual loopback **mTLS** key bootstrap with DNS/SNI-preserving connect override,
wrong-server-name rejection without creating trust, and durable original boot/
awaiting-reboot evidence with retained resource locking.
Also actually passed:
```sh
python3 tests/agent_jobs/test_install.py
python3 -m py_compile deploy/linux/install.py tests/agent_jobs/test_install.py
```
Two create-only staging/guard tests passed; the installer was not run against
the host root or VM. An initial Python annotation incompatibility on the local
interpreter was corrected using postponed annotations; tests then passed.
Targeted Clippy with `-D warnings`, debug builds and Rust formatting checks also
passed. No native service/package/reboot effects, VM access or server restart.
+59
View File
@@ -0,0 +1,59 @@
import importlib.util
from pathlib import Path
import tempfile
import unittest
ROOT = Path(__file__).resolve().parents[2]
SPEC = importlib.util.spec_from_file_location("rmm_linux_install", ROOT / "deploy/linux/install.py")
assert SPEC is not None and SPEC.loader is not None
installer = importlib.util.module_from_spec(SPEC)
SPEC.loader.exec_module(installer)
class InstallationTests(unittest.TestCase):
def test_create_only_staging_and_no_service_activation(self):
with tempfile.TemporaryDirectory(prefix="rmm-package-test-") as temporary:
path = Path(temporary)
binary = path / "agent"
data = bytearray(64)
data[:6] = b"\x7fELF\x02\x01"
data[18:20] = b"\x3e\x00"
binary.write_bytes(data)
ca = path / "ca.pem"
ca.write_bytes(b"-----BEGIN CERTIFICATE-----\ntest public fixture\n-----END CERTIFICATE-----\n")
stage = path / "stage"
installer.install(stage, binary, ca, binary, False)
self.assertTrue((stage / "usr/local/libexec/rmm-agent").is_file())
self.assertFalse((stage / "var/lib/rmm-agent").exists())
self.assertFalse((stage / "etc/rmm/helper.json").exists())
self.assertFalse((stage / "etc/systemd/system/multi-user.target.wants").exists())
with self.assertRaises(ValueError):
installer.install(stage, binary, ca, binary, False)
with self.assertRaises(ValueError):
installer.install(Path("/"), binary, ca, None, False)
def test_rejects_private_keys_and_symlink_directories(self):
with tempfile.TemporaryDirectory(prefix="rmm-package-guard-") as temporary:
path = Path(temporary)
root = path / "root"
root.mkdir()
(root / "usr").symlink_to(path)
with self.assertRaises(ValueError):
installer.directory(root / "usr", 0o755)
artifact = path / "not-elf"
artifact.write_bytes(b"not an executable")
with self.assertRaises(ValueError):
installer.elf(artifact)
data = bytearray(64)
data[:6] = b"\x7fELF\x02\x01"
data[18:20] = b"\x3e\x00"
artifact.write_bytes(data)
ca = path / "private.pem"
ca.write_bytes(b"-----BEGIN CERTIFICATE-----\n-----BEGIN PRIVATE KEY-----\n")
with self.assertRaises(ValueError):
installer.install(path / "no-install", artifact, ca, None, False)
self.assertFalse((path / "no-install").exists())
if __name__ == "__main__":
unittest.main()