Understanding BlueRock Sandbox Policies
The BlueRock Sandbox operates based on a structured JSON policy file. This configuration file acts as the central source of truth for the sandbox environment, dictating exactly what applications can execute, how file systems are mounted, what privileges are granted, and how network traffic is routed.
The policy file resides at /opt/bluerock/trex with filename bru_policy.json .
Policy Structure Overview
A standard sandbox policy is divided into three primary blocks:
exec: Controls binary execution permissions and remediation logic.options: Defines runtime environments, user privileges, and namespace isolation.network: Governs internal routing and firewall configurations.
Below is a reference template of a foundational policy configuration:
{
"brace": {
"exec": {
"enable": false,
"remediate": false,
"explicit_deny_list": false,
"match_list": []
},
"options": {
"bind_mount": {
"enable": false,
"mount_proc": true,
"mounts": []
},
"user": "",
"pid_ns": true,
"user_ns": false,
"allow_privileged": false
},
"network": {
"enable": false,
"general": {
"bridge": "<bridge-name>",
"gateway": "<gateway-address>"
},
"firewall": {}
}
}
}Execution Control (exec)
exec)The exec block is responsible for the Allow/Deny logic of binary execution within the container.
Parameter
Type
Description
enable
Boolean
Toggles the execution control feature on or off.
remediate
Boolean
Determines the response to a violation. false logs a warning (Observe Mode); true blocks the execution (Enforcement Mode).
explicit_deny_list
Boolean
Changes the interpretation of the match_list between an allow-list (false) and a deny-list (true).
match_list
Array
A list of file paths (supports wildcards) used to evaluate execution permissions.
Policy Execution
Executing policy is governed by a true/false logic within the BlueRock Sandbox policy. Toggling the explicit_deny_list setting determines how the match_list is interpreted.
Mode
explicit_deny_list
match_list Content
Resulting Behavior
Strict Allow-List
false
["<dir_path>/**"]
Only programs in the given path are allowed.
Block All
false
[] (Empty)
Nothing is allowed to run.
Selective Deny-List
true
["**/<cmd>"]
Everything runs except the specified command.
Permissive
true
[] (Empty)
Everything is allowed to run.
Note:
The match_list supports wildcards. For example, ["**/wh*"] matches both the whoami and which commands.
Runtime Options (options)
options)The options block manages system-level isolation, file system access, and user privileges.
Parameter
Type
Description
bind_mount
Object
Controls host-to-container directory mapping. Contains sub-parameters to enable mounts, control /proc visibility (mount_proc), and define specific volume paths (mounts).
user
String
Specifies the default user context under which the containerized application runs.
pid_ns
Boolean
Enables (true) or disables (false) PID namespace isolation, creating a private process tree for the sandbox.
user_ns
Boolean
Toggles Linux user namespace mapping for enhanced privilege isolation.
allow_privileged
Boolean
Grants extended system capabilities to the root user within the sandbox when set to true.
Network Configuration (network)
network)The network block defines how the sandbox interacts with internal and external networks.
Parameter
Type
Description
enable
Boolean
Activates or deactivates custom network isolation.
general
Object
Defines foundational network routing, including the virtual bridge interface (e.g., bru0) and the default gateway IP address.
firewall
Object
Contains the detailed ingress, egress, and protocol rules defining allowed traffic.
Policy-Driven Configuration Examples
Centralizing security logic within the policy file reduces manual input errors and ensures consistent enforcement across environments.
Binary Execution: Allow and Deny Lists
The exec block controls which binaries can run inside the sandbox.
Allow List Strategy (Whitelist) This is the recommended configuration for high-security environments. It ensures that only trusted system paths can execute. Any binary located outside these paths (e.g., in
/tmpor/home) will be blocked by default. Configuration:explicit_deny_list: Set tofalse.
Executing a command which is not part of match list:
Expected Output (if remediate: true):
Executing a match list command:
Expected Output (if remediate: true):
Executing a command which is not part of match list:
Expected Output (if remediate: false):
Deny List Strategy (Blacklist) This configuration allows for broader execution but targets specific dangerous binaries for exclusion. This is useful when the application requires access to various libraries but must be prevented from using tools that could lead to privilege escalation. Configuration:
explicit_deny_list: Set totrue.
Execution:
Expected Output (if remediate: true):
Expected Output (if remediate: false):
Running Python MCP Server and MCP Client
To run Python MCP Server and MCP Client in BlueRock Sandbox an MCP setup is required:
1. Install uv :
2. Create Project Directory Create a new project directory for the MCP applications and navigate into it:
3. Install Required Dependencies
Create an isolated Python environment using uv, then install the MCP framework, BlueRock sensor, and BlueRock runtime required for generating and exporting telemetry:
4. Add MCP Application Files
Create the MCP client and server scripts in the project directory using the sample code provided in the Appendix section. Ensure the following files are present in the mcp-observability directory:
Defining Mounts to run the MCP Server and Client
Defining mount points directly within the bru_policy.json file under the options.bind_mount block eliminates the requirement for extensive -v arguments in the Command Line Interface (CLI).
Important:
Modifications to bru_policy.json require a complete policy update to take effect. This process involves extracting the tarball, generating a new signature via trex.py, and uploading the repackaged files. Refer to the Understanding BlueRock Sandbox Policies for detailed instructions.
With file mounts pre-configured in the policy, the system allows for the direct execution of the MCP client or server without additional volume flags.
Terminal 1:
Starting the MCP Server Launch the sandbox and execute the Python server script:
Expected Output:
Terminal 2:
Starting the MCP Client Open a separate terminal and launch a second sandbox to execute the client script:
Running an Imported Container Image
Once the image is imported, you can launch it using the --image flag alongside standard BlueRock Sandbox execution controls. This execution method provides a fully isolated application layer. Following is example to update in the policy to run the imported image.
Important:
Modifications to bru_policy.json require a complete policy update to take effect. This process involves extracting the tarball, generating a new signature via trex.py, and uploading the repackaged files. Refer to the Understanding BlueRock Sandbox Policies for detailed instructions.
For execution:
Network Control: Ingress and Egress
Network profile define how a program running inside the sandbox connects to external network services. These are referenced via the --network-config flag but configured within the policy.
Egress (Outbound): Allows programs in sandbox to reach external network service.
parameters - IP, Port Protocol
For example: An agent program running inside sandbox is restricted to access specific LLM provider.
Ingress (Inbound): Allows in bound connections from specific host to the server program running inside the sandbox on specific port and protocol
For example: Allows an MCP client program from specific source address to connect to MCP server program running on specific port
Important:
Modifications to bru_policy.json require a complete policy update to take effect. This process involves extracting the tarball, generating a new signature via trex.py, and uploading the repackaged files. Refer to the Understanding BlueRock Sandbox Policies for detailed instructions.
Note:
Any changes to the network policy in BlueRock Sandbox require restarting the uc-docker.service.
For execution:
Expected Output:
Policy Deployment Lifecycle
Applying policy changes requires a manual sign-and-upload cycle. The Sandbox uses a signed manifest to ensure security integrity; local edits to bru_policy.json will effect with the following steps:
Activate the signing environment:
Generate the signed cryptographic archive:
Extract the signed policy and signature:
Upload the signature to the cloud repository:
Upload the policy manifest to the cloud repository:
Policy updates are applied automatically within 300 seconds (5 minutes). To enforce the new policy immediately, restart the service:
Note:
The sandbox operates on a Fail-Closed security model. If the .sig file is missing or does not match the policy.json content during the service restart, uc-docker.service will fail to initialize to prevent unverified configurations.
Last updated