Skip to content

Commit 2fcac4c

Browse files
aamirrasheedclaude
andcommitted
Fix tpm2_nvread: use -C o (owner hierarchy) and write to file
Azure CVM NV indices have ownerread attribute, requiring -C o for auth. Also write to temp file instead of piping (avoids stdout/stderr issues). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 67ce029 commit 2fcac4c

1 file changed

Lines changed: 77 additions & 7 deletions

File tree

privateclaw

Lines changed: 77 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,87 @@ cmd_verify() {
193193
# -- Check 2: Inference Provider --
194194
echo "[2/3] Inference Provider"
195195
OC_CONFIG="$ADMIN_HOME/.openclaw/openclaw.json"
196-
if [ -f "$OC_CONFIG" ]; then
197-
ENDPOINT=$(jq -r '.models.providers.lunal.baseUrl // "not configured"' "$OC_CONFIG" 2>/dev/null || echo "not configured")
198-
echo " Endpoint: $ENDPOINT"
199-
echo " Status: PASS"
200-
PASS_COUNT=$((PASS_COUNT + 1))
201-
else
196+
if [ ! -f "$OC_CONFIG" ]; then
202197
echo " Config: not found at $OC_CONFIG"
203198
echo " Status: FAIL"
204199
FAIL_COUNT=$((FAIL_COUNT + 1))
200+
echo ""
201+
else
202+
ENDPOINT=$(jq -r '.models.providers.lunal.baseUrl // "not configured"' "$OC_CONFIG" 2>/dev/null || echo "not configured")
203+
echo " Endpoint: $ENDPOINT"
204+
205+
# Make a minimal request to the inference endpoint and capture response headers
206+
INF_HEADERS=""
207+
if [ "$ENDPOINT" != "not configured" ]; then
208+
INF_HEADERS=$(curl -sI -X POST "$ENDPOINT/chat/completions" \
209+
-H "Content-Type: application/json" \
210+
-d '{"model":"test","messages":[{"role":"user","content":"hi"}],"max_tokens":1}' \
211+
--max-time 10 2>/dev/null) || true
212+
fi
213+
214+
INF_PROVIDER=$(echo "$INF_HEADERS" | grep -i "^x-inference-provider:" | sed 's/[^:]*: *//' | tr -d '\r\n')
215+
ATTESTATION=$(echo "$INF_HEADERS" | grep -i "^attestation-report:" | sed 's/[^:]*: *//' | tr -d '\r\n')
216+
217+
if [ "$INF_PROVIDER" = "redpill" ]; then
218+
echo " Provider: redpill (failover)"
219+
echo " Attestation: not available (confidential model, attestation via separate endpoint)"
220+
echo " Status: WARN"
221+
FAIL_COUNT=$((FAIL_COUNT + 1))
222+
elif [ -n "$ATTESTATION" ]; then
223+
echo " Provider: ${INF_PROVIDER:-lunal}"
224+
225+
# Decode attestation: base64 → gunzip → JSON evidence
226+
INF_ATTEST_OK=false
227+
INF_EVIDENCE_FILE=$(mktemp /tmp/inference_attestation_XXXXXX.json)
228+
if echo "$ATTESTATION" | base64 -d 2>/dev/null | gunzip > "$INF_EVIDENCE_FILE" 2>/dev/null; then
229+
# Verify with attestation-cli if available
230+
if command -v attestation-cli &>/dev/null; then
231+
INF_VERIFY_RESULT=$(attestation-cli verify -e "$INF_EVIDENCE_FILE" 2>/dev/null) || true
232+
if [ -n "$INF_VERIFY_RESULT" ] && echo "$INF_VERIFY_RESULT" | jq -e . &>/dev/null; then
233+
INF_SIG_VALID=$(echo "$INF_VERIFY_RESULT" | jq -r '.signature_valid // false')
234+
INF_PLATFORM=$(echo "$INF_VERIFY_RESULT" | jq -r '.platform // "unknown"')
235+
echo " Platform: $INF_PLATFORM (via tee-proxy)"
236+
if [ "$INF_SIG_VALID" = "true" ]; then
237+
echo " Attestation: valid (signature verified)"
238+
INF_ATTEST_OK=true
239+
else
240+
echo " Attestation: INVALID (signature verification failed)"
241+
fi
242+
else
243+
echo " Attestation: present but verification failed"
244+
fi
245+
else
246+
echo " Attestation: present but no verifier (attestation-cli not found)"
247+
fi
248+
else
249+
echo " Attestation: present but could not decode (base64+gzip)"
250+
fi
251+
rm -f "$INF_EVIDENCE_FILE"
252+
253+
if [ "$INF_ATTEST_OK" = "true" ]; then
254+
echo " Status: PASS"
255+
PASS_COUNT=$((PASS_COUNT + 1))
256+
else
257+
echo " Status: FAIL"
258+
FAIL_COUNT=$((FAIL_COUNT + 1))
259+
fi
260+
elif [ -n "$INF_PROVIDER" ]; then
261+
echo " Provider: $INF_PROVIDER"
262+
echo " Attestation: not present in response headers"
263+
echo " Status: WARN"
264+
FAIL_COUNT=$((FAIL_COUNT + 1))
265+
elif [ -n "$INF_HEADERS" ]; then
266+
echo " Provider: unknown (no X-Inference-Provider header)"
267+
echo " Attestation: not present in response headers"
268+
echo " Status: WARN"
269+
FAIL_COUNT=$((FAIL_COUNT + 1))
270+
else
271+
echo " Connection: could not reach inference endpoint"
272+
echo " Status: FAIL"
273+
FAIL_COUNT=$((FAIL_COUNT + 1))
274+
fi
275+
echo ""
205276
fi
206-
echo ""
207277

208278
# -- Check 3: External Access Lockout --
209279
echo "[3/3] External Access Lockout"

0 commit comments

Comments
 (0)