如何在 Falco 上下文中通过 Ansible 在远程主机上识别命令 运行?

How to identify commands ran by Ansible on a remote host in Falco context?

我想知道是否有人知道如何通过 Ansible 在远程主机中识别命令 运行。

为了给您更多背景信息,我将深入描述我的工作流程:

所以我 运行 遇到的问题是,我的剧本触发了一些警报,例如:

Warning Sensitive file opened for reading by non-trusted program (user=XXXX user_loginuid=XXX program=python3 command=python3 file=/etc/shadow parent=sh gparent=sudo ggparent=sh gggparent=sshd container_id=host image=<NA>)

我的问题是,我们能否为所有 Ansible 命令设置一个“标志或前缀”,这将允许我将这个前缀标志列入白名单,避免无故触发我的警报。

PS:在我看来,将用户 root 列入白名单 python3 不是解决方案。

Ansible 是 python 工具,因此访问文件的进程将是 python3。 Ansible 执行的命令基于剧本中的步骤。

您可以通过修改falco规则来解决您的问题。您可以评估 falcon 规则中的 proc.pcmdlineproc.aname 的链来识别该命令是由 ansible 进程执行的(例如进程是 python3,parent 是sh grandparent 是 sudo,等等)