osquery-python 扩展导致 osqueryi 错误

osquery-python extension causing osqueryi errors

我有一个关于使用 osquery-python 创建 osquery 扩展的新手问题。我创建了一个小扩展,可以从我的 linux 系统获取一些额外的 RPM 信息。按照文档中的说明,我将路径添加到 /etc/osquery/extensions.load 中的扩展以使其自动加载。我重新启动了 osqueryd,我看到扩展名 运行ning 使用 ps ax.

如果我以交互方式 运行 osqueryi,我可以看到 table 并获取数据。一切都很完美。

然而,当我 运行 一个 osqueryi 命令 'one-liner' 例如:

osqueryi .tables
我的输出出现以下错误:

#INFO:thrift.transport.TSocket:Could not connect to /root/.osquery/shell.em
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/thrift/transport/TSocket.py", line 104, in open
    handle.connect(sockaddr)
  File "/usr/lib64/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 2] No such file or directory
ERROR:thrift.transport.TSocket:Could not connect to any of ['/root/.osquery/shell.em']

我做错了什么?

扩展 运行 在一个单独的进程中。您可以看到套接字错误,这表明扩展进程无法与 osquery 进程通信。确保 osqueryd 或 osqueryi 是 运行ning。 Link: osquery doc page for extensions.