Skip to content

Secrets, passwords, and OpenBao: Sandboxed shell execution

Back to Secrets, passwords, and OpenBao.

Install and diagnose the production backend on Linux:

Terminal window
brezel-services-installer sandbox install
brezel-services-installer sandbox doctor

Bubblewrap with prlimit (from util-linux), Bash, and Python 3 is the production default. Docker or Podman can be selected explicitly as a development fallback, including on macOS. If no permitted backend is available, execution fails closed. Define profiles in config/agent_execution.php:

'profiles' => [
'repository-maintenance' => [
'backend' => 'auto',
'source_path' => '/srv/brezel/workspaces/example',
'network' => 'none',
'timeout_seconds' => 60,
'memory_mb' => 512,
'cpus' => 1.0,
'pids' => 128,
'container_image' => 'python:3.13-slim-bookworm',
'shell' => '/bin/bash',
],
],

shell_execute works in one writable workspace per agent run. The source is copied from the profile; the live source is never mounted writable. cwd must remain below that workspace. At terminal run completion Brezel writes a content-free artifact manifest containing relative paths, sizes, and SHA-256 hashes, links its path from run metadata, and retains the workspace for the configured period (24 hours by default). An hourly job removes expired workspaces. Bubblewrap creates new process, mount, user, IPC, and network namespaces and exposes only a minimal read-only runtime plus the workspace. The container fallback uses a read-only root, drops all capabilities, enables no-new-privileges, limits processes, CPU, memory, and time, and mounts only the workspace.

Every shell run also provides a run-bound brezel-tool CLI through an atomic request/response mailbox in the private workspace. It does not carry an API credential and has no network dependency. The broker resolves every requested tool against the current agent policy and tool/toolkit assignments; shell/SSH execution and secret-value tools cannot be invoked through the CLI. Inputs and outputs are JSON and therefore compose with normal shell pipelines:

Terminal window
brezel-tool --list | python3 -m json.tool
brezel-tool search_entities --json '{"module_identifier":"tasks","search":"website","limit":10}' \
| python3 -c 'import json,sys; print([row["id"] for row in json.load(sys.stdin)["results"]])'
printf '%s' '{"module_identifier":"tasks"}' \
| brezel-tool describe_module \
| python3 -m json.tool

Generated artifacts can be persisted without an external upload target. Create the file in run://workspace, then call create_file_from_workspace directly or through brezel-tool. The tool validates the workspace boundary and configured size limit, checks the acting user’s create permission on the target files module, records agent provenance, and returns a downloadable file card in chat:

Terminal window
python3 -m zipfile -c task-export.zip task-export/
brezel-tool create_file_from_workspace \
--json '{"path":"task-export.zip","name":"tasks.zip"}'

CLI calls are included in the agent execution audit trail. The mailbox and executable are removed or retained together with the normal run workspace lifecycle and are not exposed over HTTP or TCP.

Network mode is none by default. full must be explicitly configured by an administrator. allowlist is fail-closed until an egress proxy is configured; do not emulate an allowlist only with DNS because rebinding and private/metadata addresses must also be blocked.

The SSH toolkit exposes ssh_open, ssh_exec, and ssh_close. Sessions belong to one agent run and preserve the remote working directory. Version 1 supports ssh_static credentials (password or in-memory private key) and OpenBao ssh_otp. ssh_signed is rejected until certificate issuance and renewal have a dedicated implementation.

On the first connection Brezel reads the server key before authentication and creates a trust_ssh_host approval with its SHA-256 fingerprint. Approval pins the fingerprint in non-secret configuration. A later mismatch blocks the connection instead of silently replacing the pin. Private keys and passwords stay in memory and are never written to temporary files or returned to the model.

Shell and SSH executions write a separate audit event with agent, run, acting user, profile/backend, redacted command, working directory, exit status, duration, session, host metadata, and grant identifiers. Secret values are excluded; OpenBao’s audit device remains the backend-level record of credential access.