You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用osquery监控远程端点:配置文件及远程扫描问题求助

osquery远程端点监控问题解决指南

先澄清核心误解

osquery不是直接通过IP发起远程扫描的工具,它采用客户端-服务器(C/S)架构:需要在笔记本(目标端点)上安装osqueryd客户端,由客户端主动连接台式机上的osquery服务器(或第三方管理平台如Fleet),而非台式机主动扫描笔记本IP。

解决osqueryd启动失败问题

1. 检查配置文件格式

osquery.conf必须是合法JSON格式,常见错误包括逗号遗漏、引号不匹配、路径错误。以下是基础客户端配置示例:

{
  "options": {
    "config_plugin": "tls",
    "logger_plugin": "tls",
    "tls_server_certs": "/etc/osquery/ca.pem",
    "tls_hostname": "192.168.1.100:8090",
    "enroll_tls_endpoint": "/enroll",
    "config_tls_endpoint": "/config",
    "logger_tls_endpoint": "/log"
  },
  "schedule": {
    "active_processes": {
      "query": "SELECT pid, name, path FROM processes WHERE state = 'R';",
      "interval": 60
    }
  }
}

2. 查看启动报错信息

启动时添加--verbose参数定位问题:

sudo osqueryd --config-path /etc/osquery/osquery.conf --verbose

常见报错对应解决:

  • "No such file or directory":检查配置文件、证书路径是否正确
  • "Permission denied":给配置文件/证书设置可读权限(如sudo chmod 644 /etc/osquery/osquery.conf)
  • "TLS handshake failed":检查证书是否匹配、服务器端口是否可达

3. 验证系统依赖

确保系统安装了必要依赖(如libssl),以Ubuntu为例:

sudo apt install libssl-dev

远程监控的正确流程

1. 搭建台式机端osquery服务器

  • 若自行搭建:需实现TLS接口(客户端注册、配置下发、日志接收),可参考osquery官方的TLS服务器示例代码
  • 更简便方案:使用Fleet(osquery官方管理平台),一键部署服务器,自带Web界面管理所有端点

2. 部署笔记本端osqueryd客户端

  1. 安装osquery包:根据笔记本系统选择对应安装包(Windows/macOS/Linux均有官方预编译包)
  2. 将配置好的osquery.conf放到对应目录:
    • Linux:/etc/osquery/osquery.conf
    • Windows:C:\Program Files\osquery\osquery.conf
    • macOS:/var/osquery/osquery.conf
  3. 启动客户端服务:
    • Linux:sudo systemctl start osqueryd && sudo systemctl enable osqueryd
    • Windows:通过服务管理器启动"osqueryd"服务
    • macOS:sudo launchctl start io.osquery.osqueryd

3. 验证连接有效性

  • 服务器端:查看注册日志,确认笔记本客户端已成功注册
  • 客户端:进入osquery交互式shell验证插件状态
osqueryi
SELECT name, status FROM osquery_registry WHERE name LIKE '%tls%';

返回结果中status应为0(正常加载)

常见避坑点

  • 防火墙:台式机需开放osquery TLS默认端口(8090),笔记本需能访问该端口(用telnet 192.168.1.100 8090测试连通性)
  • 证书:自签名证书需确保客户端的tls_server_certs指向CA证书,且服务器证书由该CA签发

内容的提问来源于stack exchange,提问作者MiKe

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.28 16:14:55