我使用osQueryv4.1.1来监视ubuntu框上的文件事件。
$ osqueryi --line "SELECT version, build, platform FROM os_version;"
version = 16.04.3 LTS (Xenial Xerus)
build =
platform = ubuntu$ osqueryi --line "SELECT version from osquery_info;"
version = 4.1.1我试图递归地查看/etc/目录中的所有文件,该目录的扩展名为.conf,使用以下通配符:/etc/%%/%.conf。但是,它也报告了/etc/下的任何文件。如果我创建了一个文件/etc/foo,它就会为CREATED事件和其他带有它的文件事件创建一个文件事件。
要重新生成的最小配置:
{
"schedule": {
"file_events": {
"query": "SELECT * FROM file_events",
"interval": "5",
"removed": "false"
}
},
"file_paths": {
"sys": ["/etc/%%/%.conf"]
}
}这些是我在执行touch /etc/foo时得到的文件事件。
{"name":"file_events","hostIdentifier":"<hostname>","calendarTime":"Mon Dec 30 13:56:03 2019 UTC","unixTime":1577714163,"epoch":0,"counter":0,"numerics":false,"columns":{"action":"CREATED","atime":"1577714161","category":"sys","ctime":"1577714161","gid":"0","inode":"389945","mode":"0644","mtime":"1577714161","size":"0","target_path":"/etc/foo","time":"1577714161","uid":"0"},"action":"added"}
{"name":"file_events","hostIdentifier":"<hostname>","calendarTime":"Mon Dec 30 13:56:03 2019 UTC","unixTime":1577714163,"epoch":0,"counter":0,"numerics":false,"columns":{"action":"ATTRIBUTES_MODIFIED","atime":"1577714161","category":"sys","ctime":"1577714161","gid":"0","inode":"389945","mode":"0644","mtime":"1577714161","size":"0","target_path":"/etc/foo","time":"1577714161","uid":"0"},"action":"added"}
{"name":"file_events","hostIdentifier":"<hostname>","calendarTime":"Mon Dec 30 13:56:03 2019 UTC","unixTime":1577714163,"epoch":0,"counter":0,"numerics":false,"columns":{"action":"UPDATED","atime":"1577714161","category":"sys","ctime":"1577714161","gid":"0","inode":"389945","mode":"0644","mtime":"1577714161","size":"0","target_path":"/etc/foo","time":"1577714161","uid":"0"},"action":"added"}问题:
/etc/%%/%.conf甚至是一个有效和可用的通配符吗?我可以找到以下函数:filesystem.cpp#replaceGlobWildcards(),但是除了尝试提取没有通配符的基本路径之外,我不知道它到底想做什么。
另外,我知道它使用火柴,但它如何将SQL模式转换为fnmatch兼容表达式。
发布于 2019-12-30 21:08:40
https://stackoverflow.com/questions/59532454
复制相似问题