姿势
      
具有模型上下文协议(MCP)服务器支持的跨平台安全态势评估工具。Posture提供跨macOS、Windows和Linux的统一安全检查,使AI助手能够查询硬件安全模块、启动安全、磁盘加密和生物识别功能。
特性
安全评估
- 🛡️ 平台安全芯片 -安全飞地(macOS)/TPM(Windows/Linux)检测和状态
- 🔐 安全启动 -UEFI/Apple安全引导验证
- 💾 磁盘加密 -FileVault(macOS)、BitLocker(Windows)、LUKS(Linux)
- 👆 生物识别 -Touch ID、Face ID、Windows Hello、fprintd
- 📊 安全摘要 -统一的安全评分和建议
系统指标
- ⚡ CPU 使用率 -总体和每个核心的监测
- 🧠 内存使用 -总内存、已用内存、可用内存
- 📋 流程列表 -使用资源运行进程
输出格式
- 📄 JSON (默认)-用于编程的结构化数据
- 🗂️ 表格 -具有ANSI颜色和UTF-8图标的丰富ASCII表
安装
预构建二进制文件
从以下网址下载适用于您平台的最新版本 发布 页面。
从源代码构建
需要Go 1.23或更高版本。
git clone https://github.com/plexusone/posture.git
cd posture
go build -o posture ./cmd/posture/用法
姿势可以通过三种方式使用:
- 命令行界面 -交互式命令行工具
- MCP服务器 -AI助手的模型上下文协议服务器
- Go模块 -Go应用程序中的程序化访问
CLI使用情况
# Show security summary with score
posture summary -f table
# Check platform security chip (Secure Enclave / TPM) status
posture security-chip -f table
# Check Secure Boot status
posture secureboot -f table
# Check disk encryption status
posture encryption -f table
# Check biometric capabilities
posture biometrics -f table
# System metrics
posture cpu -f table
posture memory -f table
posture processes -n 10 -f tableMCP服务器使用情况
Claude桌面配置
添加到您的Claude Desktop配置文件中:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json 窗户: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"posture": {
"command": "/path/to/posture",
"args": ["serve"]
}
}
}MCP工具
| 工具 | 说明 |
|---|---|
get_platform_security_chip | 安全飞地(macOS)/TPM(Windows/Linux)状态 |
get_secure_boot_status | UEFI安全引导验证 |
get_encryption_status | 磁盘加密(FileVault/BitLocker/LUKS) |
get_biometric_capabilities | 生物特征认证状态 |
get_security_summary | 统一的安全态势与评分 |
get_cpu_usage | CPU使用率统计 |
get_memory | 内存使用统计 |
list_processes | 运行进程列表 |
Go模块使用
导入 inspector 用于程序化访问所有安全和系统指标的包。
安装
go get github.com/plexusone/posture示例:安全摘要
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"github.com/plexusone/posture/inspector"
)
func main() {
// Get unified security summary
summary, err := inspector.GetSecuritySummary()
if err != nil {
log.Fatal(err)
}
fmt.Printf("Security Score: %d/100\n", summary.OverallScore)
fmt.Printf("Status: %s\n", summary.OverallStatus)
// Output as JSON
data, _ := json.MarshalIndent(summary, "", " ")
fmt.Println(string(data))
// Or use built-in table formatting
fmt.Println(inspector.FormatSecuritySummaryTable(summary))
}示例:个人支票
package main
import (
"context"
"fmt"
"log"
"github.com/plexusone/posture/inspector"
)
func main() {
ctx := context.Background()
// Platform Security Chip (Secure Enclave / TPM)
if inspector.IsTPMSupported() {
tpm, err := inspector.GetTPMStatus()
if err == nil {
fmt.Printf("Security Chip: %s (enabled: %v)\n", tpm.Type, tpm.Enabled)
}
}
// Secure Boot
if inspector.IsSecureBootSupported() {
boot, err := inspector.GetSecureBootStatus()
if err == nil {
fmt.Printf("Secure Boot: %v (mode: %s)\n", boot.Enabled, boot.Mode)
}
}
// Disk Encryption
if inspector.IsEncryptionSupported() {
enc, err := inspector.GetEncryptionStatus()
if err == nil {
fmt.Printf("Encryption: %s (status: %s)\n", enc.Type, enc.Status)
}
}
// Biometrics
if inspector.IsBiometricsSupported() {
bio, err := inspector.GetBiometricCapabilities()
if err == nil {
fmt.Printf("Biometrics: %s (enrolled: %v)\n",
bio.BiometryType, bio.TouchIDEnrolled || bio.FaceIDEnrolled)
}
}
// System Metrics
cpu, _ := inspector.GetCPUUsage(ctx)
fmt.Printf("CPU Usage: %.1f%%\n", cpu.OverallPercent)
mem, _ := inspector.GetMemory(ctx)
fmt.Printf("Memory: %s / %s (%.1f%%)\n",
inspector.FormatBytes(mem.Used),
inspector.FormatBytes(mem.Total),
mem.UsedPercent)
}可用功能
| 功能 | 说明 |
|---|---|
GetSecuritySummary() | 统一的安全态势与评分 |
GetTPMStatus() | 平台安全芯片状态 |
GetSecureBootStatus() | 安全启动配置 |
GetEncryptionStatus() | 磁盘加密状态 |
GetBiometricCapabilities() | 生物特征认证状态 |
GetCPUUsage(ctx) | CPU使用率统计 |
GetMemory(ctx) | 内存使用统计 |
ListProcesses(ctx, limit) | 运行进程列表 |
每个函数都有一个对应的 IsXXXSupported() 检查平台可用性的功能。
平台支持
| 功能 | macOS | Windows | Linux |
|---|---|---|---|
| 平台安全芯片 | ✅ 安全飞地 | ✅ TPM 1.2/2.0 | ✅ TPM 2.0 |
| 安全启动 | ✅ 苹果安全启动 | ✅ UEFI安全引导 | ✅ UEFI安全引导 |
| 磁盘加密 | ✅ FileVault | ✅ BitLocker | ✅ LUKS/dm加密 |
| 生物识别 | ✅ 触摸ID/面部ID | ✅ Windows你好 | ✅ fprintd/你好 |
| CPU/内存/进程 | ✅ | ✅ | ✅ |
示例输出
安全摘要(表格式)
🛡️ Security Summary
────────────────────────────────────────────────────────────
Platform: 🍎 macOS
Security Score: 75/100
██████████████████████████████░░░░░░░░░░
Status: ✓ Good
Security Features:
┌──────────────────────────┬──────────────┬────────────────────┐
│ Feature │ Status │ Details │
├──────────────────────────┼──────────────┼────────────────────┤
│ 🛡️ Secure Enclave │ ✓ Enabled │ secure_enclave │
│ 🔒 Secure Boot │ ✓ Enabled │ full │
│ 🔒 FileVault │ ✗ Disabled │ disabled │
│ 👆 Biometrics │ ✓ Enabled │ touch_id │
└──────────────────────────┴──────────────┴────────────────────┘
⚠️ Recommendations:
──────────────────────────────────────────────────
1. Enable FileVault to protect data at rest安全摘要(JSON格式)
{
"platform": "darwin",
"overall_score": 75,
"overall_status": "good",
"tpm": {
"present": true,
"enabled": true,
"type": "secure_enclave"
},
"secure_boot": {
"enabled": true,
"mode": "full"
},
"encryption": {
"enabled": false,
"type": "filevault",
"status": "disabled"
},
"biometrics": {
"available": true,
"configured": true,
"type": "touch_id"
},
"recommendations": [
"Enable FileVault to protect data at rest"
]
}建筑
┌─────────────────────────────────────────────────────────────┐
│ Claude Desktop │
│ ┌────────────────────────────────────────────────────────┐ │
│ │ MCP Client │ │
│ └────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
│
│ stdio (JSON-RPC)
▼
┌─────────────────────────────────────────────────────────────┐
│ Posture │
│ ┌──────────────────┐ ┌──────────────────────────────────┐ │
│ │ MCP Server │ │ Security Tools │ │
│ │ │ │ 🛡️ get_platform_security_chip │ │
│ │ - Tool registry │ │ 🔒 get_secure_boot_status │ │
│ │ - JSON-RPC │ │ 🔐 get_encryption_status │ │
│ │ - stdio │ │ 👆 get_biometric_capabilities │ │
│ │ │ │ 📊 get_security_summary │ │
│ └──────────────────┘ └──────────────────────────────────┘ │
│ │ │
│ ┌───────────────────────────┴────────────────────────────┐ │
│ │ Inspectors │ │
│ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │
│ │ │ darwin │ │ windows │ │ linux │ │ common │ │ │
│ │ │ (cgo) │ │ (WMI) │ │ (sysfs) │ │(gopsutil│ │ │
│ │ └─────────┘ └─────────┘ └─────────┘ └─────────┘ │ │
│ └────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘安全注意事项
此工具的设计考虑了安全性:
- 只读操作 -不可能对系统进行任何修改
- 没有秘密泄露 -不访问密钥链、密码或私钥
- 非侵入性检查 -仅测试功能,从不提取密钥
- 流程列表是信息性的 -无法终止或修改进程
这个工具不做什么
- 访问或导出任何加密密钥
- 读取钥匙链项目或密码
- 修改系统设置
- 执行任意命令
- 访问文件内容
- 发出网络请求
为不同平台构建
# macOS (includes Secure Enclave)
GOOS=darwin GOARCH=arm64 go build -o posture-darwin-arm64 ./cmd/posture/
GOOS=darwin GOARCH=amd64 go build -o posture-darwin-amd64 ./cmd/posture/
# Linux (includes TPM, LUKS)
GOOS=linux GOARCH=amd64 go build -o posture-linux-amd64 ./cmd/posture/
GOOS=linux GOARCH=arm64 go build -o posture-linux-arm64 ./cmd/posture/
# Windows (includes TPM, BitLocker)
GOOS=windows GOARCH=amd64 go build -o posture-windows-amd64.exe ./cmd/posture/注意:由于cgo依赖关系,其他平台的macOS交叉编译将不包括Secure Enclave支持。
依赖项
- modelcontextprotocol/go-sdk -官方MCP Go SDK
- 雪楼/戈普苏蒂尔/v4 -跨平台系统指标
- spf13/眼镜蛇 -CLI框架
相关项目
许可证
MIT许可证-请参阅 许可证 文件以获取详细信息。
贡献
欢迎投稿!请随时提交拉取请求。
