Policy Builder
The BlueRock Secure MCP Server consumes a signed policy blob generated using the TREX tool.
The TREX tool performs the following operations:
Generate a policy template
Manually edit the generated policy template JSON file to define the required policy rules
Sign the policy and generate a signed policy blob (.tar)
After the signed policy blob is generated, the following manual steps are required:
Extract the signed policy blob to obtain the policy file (policy.json) and signature file (policy.json.sig)
Upload the extracted policy files to the configured cloud storage bucket for UC retrieval
UC verifies the policy signature during startup before loading it.
TREX Tool Location
On BlueRock Node AMI (Amazon Linux 2023 and Ubuntu 24.04):
/opt/bluerock/trexStep 1: Create Signing Key and Certificate
Navigate to the TREX tool directory:
cd /opt/bluerock/trexGenerate a private key and self-signed certificate:
Extract the public key from the certificate:
Step 2: Configure trex.toml
Create a trex.toml file under /opt/bluerock/trex with the following configuration:
This enables TREX tool to sign outgoing policies using SHA256.
Step 3: Activate TREX Python Environment
The TREX Python virtual environment is pre-created on the BlueRock node:
Step 4: Generate Policy Template
Generate a policy model file for EC2 deployments:
The generated JSON file contains the policy template with default values. Edit the generated JSON file to define required policy rules.
Example MCP Protection Configuration:
Policy enforcement behavior is controlled using the remediate flag.
remediate: false→ observe moderemediate: true→ enforce mode
Step 5: Generate Signed Policy Blob
Generate the signed policy package:
This produces:
Extract the archive:
The extracted files include:
policy.jsonpolicy.json.sha256policy.json.sig
These files are required for policy verification by UC.
Note: The policy filename can be any valid JSON file name. There is no mandatory naming requirement.
Step 6: Upload Policy Files to S3
The EC2 instance hosting the BlueRock runtime must be associated with an IAM role that allows access to the S3 bucket storing the policy files. This IAM role must allow the instance to read policy artifacts during runtime policy retrieval.
Example IAM policy:
This policy allows the EC2 instance to:
list objects in the policy storage bucket
download the policy file and signature file required for runtime verification
After configuring the IAM role, upload the policy files to the configured S3 bucket.
Example:
Policy Verification
During UC startup:
Policy files are downloaded from S3
SHA256 hash is verified
Digital signature is validated using the public key
Policy is loaded if verification succeeds
If verification fails:
The invalid policy is not applied
An error is logged
The service continues running
Policy Package Content
Every valid policy deployment requires the following files in the Cloud Storage:
policy.json
Policy Blob
policy.json.sig
Cryptographic signature
public.pem
Public key for verification
The private key used for signing must never be uploaded.
If there is a mismatch in the policy signature/ Wrong PUB key uploaded, Policy signature file is missing, or an incorrect version of TREX tool is used for the upload, the BlueRock Control Plane will reject the policy.
Last updated