sync: auto-sync from Mikes-MacBook-Air.local at 2026-06-07 19:46:36
Author: Mike Swanson Machine: Mikes-MacBook-Air.local Timestamp: 2026-06-07 19:46:36
This commit is contained in:
@@ -67,28 +67,31 @@ Interact with the GuruRMM agent fleet: list agents, run remote commands (PowerSh
|
||||
|
||||
## Phase 0 — Bootstrap (run once per session)
|
||||
|
||||
**Use the helper script** (cross-platform, handles Mac jq/JSON issues):
|
||||
|
||||
```bash
|
||||
IDENTITY_PATH="${HOME}/.claude/identity.json"
|
||||
if [ ! -f "$IDENTITY_PATH" ]; then
|
||||
IDENTITY_PATH=$(git rev-parse --show-toplevel 2>/dev/null)/.claude/identity.json
|
||||
fi
|
||||
REPO_ROOT=$(jq -r '.claudetools_root // empty' "$IDENTITY_PATH" 2>/dev/null)
|
||||
if [ -z "$REPO_ROOT" ]; then
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
|
||||
fi
|
||||
VAULT="$REPO_ROOT/.claude/scripts/vault.sh"
|
||||
# Authenticate and set environment variables
|
||||
eval "$(bash .claude/scripts/rmm-auth.sh)"
|
||||
# This sets: $TOKEN, $RMM, $REPO_ROOT
|
||||
```
|
||||
|
||||
**Alternative (manual, for reference only — use helper script above):**
|
||||
|
||||
```bash
|
||||
REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null)"
|
||||
IDENTITY_FILE="$REPO_ROOT/.claude/identity.json"
|
||||
VAULT_PATH=$(jq -r '.vault_path' "$IDENTITY_FILE")
|
||||
VAULT_SH="$VAULT_PATH/scripts/vault.sh"
|
||||
RMM="http://172.16.3.30:3001"
|
||||
|
||||
RMM_EMAIL=$(bash "$VAULT" get-field infrastructure/gururmm-server.sops.yaml credentials.gururmm-api.admin-email)
|
||||
RMM_PASS=$(bash "$VAULT" get-field infrastructure/gururmm-server.sops.yaml credentials.gururmm-api.admin-password)
|
||||
RMM_EMAIL=$(bash "$VAULT_SH" get-field infrastructure/gururmm-server.sops.yaml credentials.gururmm-api.admin-email)
|
||||
RMM_PASS=$(bash "$VAULT_SH" get-field infrastructure/gururmm-server.sops.yaml credentials.gururmm-api.admin-password)
|
||||
|
||||
JWT=$(curl -s -X POST "$RMM/api/auth/login" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data-binary @- <<JSON
|
||||
{"email": "$RMM_EMAIL", "password": "$RMM_PASS"}
|
||||
JSON
|
||||
)
|
||||
# Use jq to build JSON safely (avoids heredoc issues on Mac)
|
||||
PAYLOAD=$(jq -n --arg email "$RMM_EMAIL" --arg password "$RMM_PASS" '{email: $email, password: $password}')
|
||||
JWT=$(curl -s -X POST "$RMM/api/auth/login" -H "Content-Type: application/json" -d "$PAYLOAD")
|
||||
TOKEN=$(echo "$JWT" | jq -r '.token // empty')
|
||||
|
||||
if [ -z "$TOKEN" ]; then
|
||||
echo "[ERROR] RMM login failed: $JWT"
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user