Agent Mesh
Go a2aa2a-protocolagent-meshagentic-aiinferencemcpmeshmesh-networknetwork-securitynetworking-aip2p-network
Update container_mesh.bash to use curl pod for token generation and commit docs changes
Antonio Ojeaaeb6e977c18c
diff --git a/site/content/docs/quickstart.md b/site/content/docs/quickstart.mdindex 32ab7d16..1fcebf3d 100644--- a/site/content/docs/quickstart.md+++ b/site/content/docs/quickstart.md@@ -40,15 +40,18 @@ Expand-Archive -Path "sam.zip" -DestinationPath "$env:ProgramFiles\sam"## 2. Join the Mesh-To register your node with the mesh and obtain a cryptographic identity token (Biscuit), run the OIDC authorization flow.+To register your node with the mesh and obtain a cryptographic identity token (Biscuit), you can use either the interactive OIDC authorization flow or the non-interactive bootstrap token flow.-### Using the Binary+### Option A: Interactive OIDC Flow (Default)++The interactive flow uses your browser to authenticate your identity against Dex (OIDC):++#### Using the Binary```bashsam-node join https://bananas.sam-mesh.dev```-### Using Docker-Create a local directory to persist your node identity:+#### Using Docker```bashmkdir -p $(pwd)/sam-datadocker run -it \@@ -57,7 +60,26 @@ docker run -it \join --data-dir /data https://bananas.sam-mesh.dev```-The CLI will output a Device Authorization URL (if headless/Docker) or open your browser (if using the binary natively). Once authenticated, the node registers and saves the identity to `~/.config/sam-mesh/agent.db` (or `/data/agent.db` in Docker).+The CLI will output a Device Authorization URL (if headless/Docker) or open your browser natively. Once authenticated, the node registers and saves the identity database.++### Option B: Non-Interactive Bootstrap Flow (Headless)++If you are deploying a headless server or router and have a generated bootstrap token from the Control Plane API:++#### Using the Binary+```bash+sam-node join --bootstrap-token <your-token> https://bananas.sam-mesh.dev+```++#### Using Docker+```bash+docker run -it \+ -v $(pwd)/sam-data:/data \+ ghcr.io/google/sam-node:latest \+ join --data-dir /data --bootstrap-token <your-token> https://bananas.sam-mesh.dev+```++*Note: In non-interactive mode, unless the Hub runs with `--auto-approve-enrollment`, the enrollment request remains **PENDING** until approved manually by a network administrator.*---diff --git a/site/content/docs/user/control-plane-configuration.md b/site/content/docs/user/control-plane-configuration.mdindex 673b77c5..042c0159 100644--- a/site/content/docs/user/control-plane-configuration.md+++ b/site/content/docs/user/control-plane-configuration.md@@ -153,3 +153,61 @@ Administrators can immediately revoke any active session to disable a node's abi}```* **Enforcement**: Revoked nodes are marked as banned in the database. When the node next attempts a proactive `/refresh` handshake, the request is denied with a `403 Forbidden` status, and the node's local daemon immediately terminates.++---++## 6. Headless Node Enrollment (Bootstrap Token Flow)++To enroll a headless server, router, or background daemon that cannot complete interactive OIDC authentication, SAM supports a **Bootstrap Token** flow.++### Step 1: Generate a Bootstrap Token++An administrator with the `admin-token` can dynamically generate a time-bounded, single-use bootstrap token:++```bash+curl -X POST \+ -H "Authorization: Bearer <your-admin-token>" \+ -H "Content-Type: application/json" \+ -d '{"role": "sam:role:node", "ttl_hours": 24, "max_usages": 1, "description": "Headless node deployment token"}' \+ http://<control-plane-ip>:8080/admin/bootstrap-tokens+```++This returns a JSON response containing the plaintext token:+```json+{+ "id": "62e92ffca...",+ "token": "sam-bt-72fb0175788dee0...",+ "role": "sam:role:node",+ "expires_at": "2026-07-12T15:00:00Z"+}+```++### Step 2: Request Enrollment on the Node++Run the node `join` command with the generated token:++```bash+sam-node join --bootstrap-token sam-bt-72fb0175788dee0... http://<control-plane-ip>:8080+```++The node submits its enrollment request and waits (polls) for approval.++### Step 3: Approve the Enrollment++Administrators can review pending enrollment requests:++```bash+# List all pending enrollments+curl -H "Authorization: Bearer <your-admin-token>" http://<control-plane-ip>:8080/admin/enrollments+```++To approve the request and issue the node its identity Biscuit:++```bash+curl -X POST \+ -H "Authorization: Bearer <your-admin-token>" \+ http://<control-plane-ip>:8080/admin/enrollments/<request-id>/approve+```++Alternatively, you can boot the control plane with `--auto-approve-enrollment` to automatically approve all valid bootstrap token requests without manual gates.+diff --git a/tests/e2e/lib/container_mesh.bash b/tests/e2e/lib/container_mesh.bashindex b1515c20..f41b1472 100644--- a/tests/e2e/lib/container_mesh.bash+++ b/tests/e2e/lib/container_mesh.bash@@ -267,16 +267,18 @@ if [[ -z "${MESH_HELPERS_LOADED:-}" ]]; thenkubectl --context="${KUBECONTEXT}" rollout status deployment/sam-db --timeout=60skubectl --context="${KUBECONTEXT}" rollout status deployment/sam-control-plane --timeout=60s- local cp_pod- cp_pod=$(kubectl --context="${KUBECONTEXT}" get pod -l app=sam-control-plane -o jsonpath='{.items[0].metadata.name}')-local token_json- token_json=$(kubectl --context="${KUBECONTEXT}" exec "${cp_pod}" -c sam-control-plane -- \- wget -qO- \- --post-data='{"role": "sam:role:router", "max_usages": 999999}' \- --header="Content-Type: application/json" \- --header="Authorization: Bearer super-secret-admin-token" \- http://localhost:8080/admin/bootstrap-tokens)+ token_json=$(kubectl --context="${KUBECONTEXT}" run curl-token-gen \+ --image=curlimages/curl:8.6.0 \+ --restart=Never \+ --rm \+ -i \+ -- \+ curl -s -X POST \+ -H "Content-Type: application/json" \+ -H "Authorization: Bearer super-secret-admin-token" \+ -d '{"role": "sam:role:router", "max_usages": 999999}' \+ http://sam-control-plane:8080/admin/bootstrap-tokens)local router_tokenrouter_token=$(echo "${token_json}" | jq -r .token)