55# TEE verification and management for PrivateClaw CVMs.
66# https://github.com/lunal-dev/privateclaw-cli (repo name unchanged)
77
8+ VERSION=" v1.5.6"
9+
810ATTEST_DIR=" /etc/privateclaw"
911EVIDENCE_FILE=" $ATTEST_DIR /evidence.json"
1012SNP_EVIDENCE_FILE=" $ATTEST_DIR /snp_evidence.json"
@@ -893,13 +895,74 @@ MOTDEOF
893895 echo " Assignment complete for $INSTANCE_NAME "
894896}
895897
898+ # ---------------------------------------------------------------------------
899+ # privateclaw info
900+ # Print environment info for user debugging: component versions, hostname,
901+ # gateway IP, and install date.
902+ # ---------------------------------------------------------------------------
903+ cmd_info () {
904+ # attestation-cli version
905+ local att_version=" not found"
906+ if [ -n " $ATTESTATION_CLI " ]; then
907+ att_version=$( $ATTESTATION_CLI --version 2> /dev/null || echo " not found" )
908+ fi
909+
910+ # openclaw version -- try binary first, then fall back to package.json
911+ local openclaw_version=" not found"
912+ if command -v openclaw & > /dev/null; then
913+ openclaw_version=$( openclaw --version 2> /dev/null | head -1 || echo " " )
914+ fi
915+ if [ -z " $openclaw_version " ] || [ " $openclaw_version " = " not found" ]; then
916+ local pkg=" $HOME /.npm-global/lib/node_modules/openclaw/package.json"
917+ if [ -f " $pkg " ]; then
918+ if command -v jq & > /dev/null; then
919+ openclaw_version=$( jq -r ' .version // "not found"' " $pkg " 2> /dev/null || echo " not found" )
920+ else
921+ openclaw_version=$( grep -oE ' "version"[[:space:]]*:[[:space:]]*"[^"]+"' " $pkg " | head -1 | sed -E ' s/.*"([^"]+)"$/\1/' )
922+ [ -z " $openclaw_version " ] && openclaw_version=" not found"
923+ fi
924+ fi
925+ fi
926+
927+ # Hostname
928+ local host
929+ host=$( hostname -f 2> /dev/null || hostname 2> /dev/null || echo " unknown" )
930+
931+ # Gateway IP -- strip protocol + port from openclaw.json baseUrl
932+ local gateway_ip=" not found"
933+ local openclaw_conf=" $HOME /.openclaw/openclaw.json"
934+ if [ -f " $openclaw_conf " ] && command -v jq & > /dev/null; then
935+ gateway_ip=$( jq -r ' .models.providers.confidential.baseUrl // empty' " $openclaw_conf " 2> /dev/null \
936+ | sed ' s|https://||; s|http://||' \
937+ | cut -d: -f1 \
938+ | cut -d/ -f1)
939+ [ -z " $gateway_ip " ] && gateway_ip=" not found"
940+ fi
941+
942+ # Install date
943+ local installed=" not found"
944+ if [ -f /usr/local/bin/privateclaw ]; then
945+ installed=$( stat -c %y /usr/local/bin/privateclaw 2> /dev/null | cut -d' ' -f1)
946+ [ -z " $installed " ] && installed=" not found"
947+ fi
948+
949+ # Aligned output (labels padded to 18 chars)
950+ printf ' %-18s %s\n' " privateclaw:" " $VERSION "
951+ printf ' %-18s %s\n' " attestation-cli:" " $att_version "
952+ printf ' %-18s %s\n' " openclaw:" " $openclaw_version "
953+ printf ' %-18s %s\n' " Hostname:" " $host "
954+ printf ' %-18s %s\n' " Gateway IP:" " $gateway_ip "
955+ printf ' %-18s %s\n' " Installed:" " $installed "
956+ }
957+
896958# ---------------------------------------------------------------------------
897959# Main dispatch
898960# ---------------------------------------------------------------------------
899961case " ${1:- } " in
900962 attest) shift ; cmd_attest " $@ " ;;
901963 verify) shift ; cmd_verify " $@ " ;;
902964 assign) shift ; cmd_assign " $@ " ;;
965+ info) shift ; cmd_info " $@ " ;;
903966 * )
904967 echo " Usage: privateclaw <command> [flags]"
905968 echo " "
@@ -908,5 +971,6 @@ case "${1:-}" in
908971 echo " -v/--verbose shows full cert chain and diagnostic details"
909972 echo " attest Generate attestation evidence (run at boot)"
910973 echo " assign Apply user configuration from IMDS (run by systemd)"
974+ echo " info Print component versions, hostname, gateway IP, and install date"
911975 ;;
912976esac
0 commit comments