Feat/control socket introspection#153
Conversation
Add a per-sandbox Unix control socket under /dev/shm/sandlock-$UID/<name>/
that serves introspection requests. Each sandbox gets a runtime directory
containing a `pid` file and a `control.sock` Unix socket.
CLI changes:
- `sandlock list` → `sandlock ps` (NAME/PID/UPTIME/CMD columns via /proc)
- `sandlock config <name>` queries the control socket for effective policy
(JSON or --toml output)
- `sandlock kill <name>` reads pid from the per-sandbox pid file
- Removed network_registry.rs and all network.json references
- Removed --name incompatibility with --no-supervisor
Core changes:
- New `control` module: runtime dir helpers, control loop (tokio task),
wire protocol (4-byte BE length + JSON, v:1, verb:config), SO_PEERCRED
audit, stale-dir pruning via kill(pid,0) liveness check
- `profile.rs`: added Serialize to all section structs; added reverse
serializer (sandbox_to_profile, sandbox_to_toml, sandbox_to_json,
format_net_rule, format_http_rule, bind_ports_to_specs, time_start_str)
- `seccomp/state.rs`: added DeniedSet::denied_paths() accessor
- `sandbox.rs`: Runtime gains control_handle + control_dir fields; control
socket setup in do_create_stdio (supervisor path) + pid-file-only for
no_supervisor; control loop spawned after notif startup; cleanup in
wait() and Drop
Wire protocol: 4-byte big-endian length prefix + UTF-8 JSON.
Request: {"v":1,"verb":"config","args":{}}
Response: {"v":1,"ok":true,"data":{...ProfileInput...}}
🤖 Generated with [Pochi](https://getpochi.com) | [Task](multikernel#68)
Co-Authored-By: Pochi <noreply@getpochi.com>
Add 10 integration tests in sandlock-core exercising the control socket wire protocol (list, config, prune stale dirs, serializer round-trips). Add 8 CLI integration tests for ps, config, kill, and help commands. Make control socket setup best-effort (warn instead of fail) so nested sandboxes where /dev/shm is restricted by outer landlock still work. Update README.md: replace `sandlock list` with `sandlock ps`, add `sandlock config` examples, update port virtualization section. 🤖 Generated with [Pochi](https://getpochi.com) | [Task](multikernel#68) Co-Authored-By: Pochi <noreply@getpochi.com>
|
Thanks for the PR! Just design-level review. Layering looks right: Five things worth resolving before merge: 1. pid file and socket refer to different processes. 2. Name collision silently destroys a live sandbox. 3. Pruning races startup. 4. The 64 KB cap is client-side only. 5. No opt-out. Every |
No description provided.