feat: deploy cloud-only RMM and verify audited APT diagnostics
Rust development slice / linux (push) Failing after 7s

This commit is contained in:
2026-11-13 13:49:11 +01:00
parent 6c3203d725
commit fbef0e4e2f
48 changed files with 3125 additions and 34 deletions
+23
View File
@@ -212,6 +212,29 @@ class PreconditionsTests(unittest.TestCase):
with self.assertRaises(apt.Veto):
apt.inspect_sandbox()
def test_private_control_layouts_must_be_empty_or_absent_in_worker(self):
for layout in ('etc-rmm', 'etc-rmm-remote', 'rmm-helper', 'rmm-agent', 'rmm-agent-remote'):
with self.subTest(layout=layout), tempfile.TemporaryDirectory() as temp:
path = Path(temp) / layout
with patch.object(apt, 'PRIVATE_CONTROL_DIRECTORIES', (str(path),)):
apt.inspect_private_control_paths() # optional layout absent
path.mkdir()
apt.inspect_private_control_paths() # masked empty directory
(path / 'arbitrary-future-secret-name').write_text('synthetic')
with self.assertRaisesRegex(apt.Veto, 'SANDBOX_LEDGER_OR_KEYS_VISIBLE'):
apt.inspect_private_control_paths()
def test_private_control_symlink_cannot_claim_an_empty_mask(self):
with tempfile.TemporaryDirectory() as temp:
base = Path(temp); (base / 'empty').mkdir()
(base / 'link').symlink_to(base / 'empty', target_is_directory=True)
with patch.object(apt, 'PRIVATE_CONTROL_DIRECTORIES', (str(base / 'link'),)):
with self.assertRaisesRegex(apt.Veto, 'SANDBOX_LEDGER_OR_KEYS_VISIBLE'):
apt.inspect_private_control_paths()
(base / 'empty').rmdir() # dangling symlink is not an absent layout
with self.assertRaisesRegex(apt.Veto, 'SANDBOX_LEDGER_OR_KEYS_VISIBLE'):
apt.inspect_private_control_paths()
def test_previous_launch_or_handoff_is_unknown_never_relaunched(self):
for marker in ('launch.json', 'hook-armed.json'):
with tempfile.TemporaryDirectory(dir='/tmp/opencode') as temp:
@@ -170,6 +170,13 @@ print('CLONE_GAPS_CLOSED')
def test_dedicated_unit_has_narrow_profile_without_weakening_general_unit(self):
unit = (ROOT / 'deploy/linux/rmm-apt-helper.service').read_text()
# Explicit User=root triggers systemd 255's seccomp/setuid path:
# CAP_SETUID disappears from E/P and setup capabilities leak into I.
# Default root preserves the exact controller profile, not extra caps.
self.assertFalse(any(line.startswith('User=') for line in unit.splitlines()))
self.assertIn('Group=rmm-agent', unit)
self.assertIn('SystemCallFilter=adjtimex clock_adjtime', unit)
self.assertNotIn('CAP_SYS_TIME', next(line for line in unit.splitlines() if line.startswith('CapabilityBoundingSet=')))
for required in ('NoNewPrivileges=true', 'PrivateNetwork=true', 'ProtectSystem=strict',
'RestrictNamespaces=mnt pid net', 'DevicePolicy=strict', 'PrivateDevices=no',
'AmbientCapabilities=', 'SystemCallArchitectures=native'):