feat: deploy cloud-only RMM and verify audited APT diagnostics
Rust development slice / linux (push) Failing after 7s
Rust development slice / linux (push) Failing after 7s
This commit is contained in:
@@ -29,6 +29,8 @@ ACTIVE = BASE / 'active'
|
||||
CODE = Path('/usr/lib/rmm-apt-transaction/apt_transaction.py')
|
||||
HOOK = '/usr/lib/rmm-apt-transaction/hook'
|
||||
APT_UNIT = Path('/etc/systemd/system/rmm-apt-helper.service')
|
||||
PRIVATE_CONTROL_DIRECTORIES = ('/etc/rmm', '/etc/rmm-remote', '/var/lib/rmm-helper',
|
||||
'/var/lib/rmm-agent', '/var/lib/rmm-agent-remote')
|
||||
MAX_INPUT = 1024 * 1024
|
||||
MAX_PACKAGES = 128
|
||||
RESOLVER = 'rmm-apt-local-v1'
|
||||
@@ -993,6 +995,7 @@ def inspect_sandbox(workspace=None):
|
||||
require(not Path('/var/lib/rmm-helper/consumption.sqlite').exists() and
|
||||
not Path('/etc/rmm/helper.json').exists() and not Path('/etc/rmm/apt-helper.json').exists(),
|
||||
'SANDBOX_LEDGER_OR_KEYS_VISIBLE')
|
||||
inspect_private_control_paths()
|
||||
# Parent gives us the original namespace identities; cannot accept flags alone.
|
||||
workspace = ACTIVE if workspace is None else workspace
|
||||
ids = json_bytes(sealed_read(workspace / 'host-namespaces.json'))
|
||||
@@ -1000,6 +1003,15 @@ def inspect_sandbox(workspace=None):
|
||||
require(os.readlink('/proc/self/ns/' + name) != ids[name], 'SANDBOX_NAMESPACE')
|
||||
|
||||
|
||||
def inspect_private_control_paths():
|
||||
# Validate directory contents rather than guessing future key filenames.
|
||||
# Both historical and current cloud identity/config layouts must be hidden.
|
||||
for name in PRIVATE_CONTROL_DIRECTORIES:
|
||||
path = Path(name)
|
||||
require(not path.is_symlink() and (not path.exists() or (path.is_dir()
|
||||
and next(path.iterdir(), None) is None)), 'SANDBOX_LEDGER_OR_KEYS_VISIBLE')
|
||||
|
||||
|
||||
def setup_sandbox(workspace=None, probe_db=None):
|
||||
"""One trusted setup implementation for real jobs AND read-only probes."""
|
||||
workspace = ACTIVE if workspace is None else workspace
|
||||
@@ -1018,9 +1030,9 @@ def setup_sandbox(workspace=None, probe_db=None):
|
||||
# available to the package child. Only the outside root controller sees them.
|
||||
for hidden in ('/etc/rmm', '/var/lib/rmm-helper'):
|
||||
require(Path(hidden).is_dir(), 'SANDBOX_PRIVATE_CONTROL_PATH_REQUIRED')
|
||||
mount(['-t', 'tmpfs', '-o', 'mode=0700,nosuid,nodev,noexec', 'tmpfs', hidden])
|
||||
for hidden in ('/var/lib/rmm-agent', '/home', '/root'):
|
||||
for hidden in (*PRIVATE_CONTROL_DIRECTORIES, '/home', '/root'):
|
||||
if Path(hidden).is_dir():
|
||||
require(not Path(hidden).is_symlink(), 'SANDBOX_PRIVATE_CONTROL_PATH_REQUIRED')
|
||||
mount(['-t', 'tmpfs', '-o', 'mode=0700,nosuid,nodev,noexec', 'tmpfs', hidden])
|
||||
# Hide ALL conventional host control sockets, not merely systemctl binaries.
|
||||
mount(['-t', 'tmpfs', '-o', 'mode=0755,nosuid,nodev,noexec', 'tmpfs', '/run'])
|
||||
|
||||
Reference in New Issue
Block a user