osquery-1/osquery/tables/CMakeLists.txt

84 lines
2.4 KiB
CMake
Raw Normal View History

if(APPLE)
file(GLOB OSQUERY_OBJC_TABLES "*/darwin/*.mm")
2015-02-03 05:21:36 +00:00
ADD_OSQUERY_OBJCXX_LIBRARY(FALSE osquery_tables_objc
${OSQUERY_OBJC_TABLES}
)
file(GLOB OSQUERY_DARWIN_TABLES "*/darwin/*.cpp")
2015-02-03 05:21:36 +00:00
ADD_OSQUERY_LIBRARY(FALSE osquery_tables_darwin
${OSQUERY_DARWIN_TABLES}
)
2014-09-06 01:12:37 +00:00
2015-02-03 05:21:36 +00:00
ADD_OSQUERY_LINK(FALSE "-framework CoreFoundation")
ADD_OSQUERY_LINK(FALSE "-framework Security")
ADD_OSQUERY_LINK(FALSE "-framework OpenDirectory")
ADD_OSQUERY_LINK(FALSE "-framework DiskArbitration")
ADD_OSQUERY_LINK(FALSE "-framework CoreServices")
file(GLOB OSQUERY_DARWIN_TABLES_TESTS "*/darwin/tests/*.cpp")
ADD_OSQUERY_TABLE_TEST(${OSQUERY_DARWIN_TABLES_TESTS})
2014-11-13 20:00:41 +00:00
elseif(FREEBSD)
file(GLOB OSQUERY_FREEBSD_TABLES "*/freebsd/*.cpp")
2015-02-03 05:21:36 +00:00
ADD_OSQUERY_LIBRARY(FALSE osquery_tables_freebsd
${OSQUERY_FREEBSD_TABLES}
2014-11-13 20:00:41 +00:00
)
2015-04-27 09:12:58 +00:00
file(GLOB OSQUERY_FREEBSD_TABLES_TESTS "*/freebsd/tests/*.cpp")
ADD_OSQUERY_TABLE_TEST(${OSQUERY_FREEBSD_TABLES_TESTS})
2014-09-05 14:54:41 +00:00
else()
file(GLOB OSQUERY_LINUX_TABLES "*/linux/*.cpp")
2015-02-03 05:21:36 +00:00
ADD_OSQUERY_LIBRARY(FALSE osquery_tables_linux
${OSQUERY_LINUX_TABLES}
2014-09-05 14:54:41 +00:00
)
2014-10-29 05:59:25 +00:00
2015-04-27 09:12:58 +00:00
file(GLOB OSQUERY_LINUX_TABLES_TESTS "*/linux/tests/*.cpp")
ADD_OSQUERY_TABLE_TEST(${OSQUERY_LINUX_TABLES_TESTS})
if(CENTOS OR RHEL OR AMAZON)
2014-12-31 17:33:19 +00:00
# CentOS specific tables
file(GLOB OSQUERY_REDHAT_TABLES "*/centos/*.cpp")
2015-02-03 05:21:36 +00:00
ADD_OSQUERY_LIBRARY(FALSE osquery_tables_redhat
${OSQUERY_REDHAT_TABLES}
2014-12-31 17:33:19 +00:00
)
2014-12-30 22:24:49 +00:00
2015-05-13 07:31:02 +00:00
ADD_OSQUERY_LINK(FALSE "rpm rpmio")
2014-12-31 17:33:19 +00:00
elseif(UBUNTU)
# Ubuntu specific tables
file(GLOB OSQUERY_UBUNTU_TABLES "*/ubuntu/*.cpp")
2015-02-03 05:21:36 +00:00
ADD_OSQUERY_LIBRARY(FALSE osquery_tables_ubuntu
${OSQUERY_UBUNTU_TABLES}
)
2015-05-13 07:31:02 +00:00
ADD_OSQUERY_LINK(FALSE "apt-pkg dpkg")
endif()
2015-02-03 05:21:36 +00:00
ADD_OSQUERY_LINK(FALSE "blkid")
2015-05-13 07:31:02 +00:00
ADD_OSQUERY_LINK(FALSE "cryptsetup libdevmapper.so libgcrypt.so")
2015-02-03 05:21:36 +00:00
ADD_OSQUERY_LINK(FALSE "udev")
ADD_OSQUERY_LINK(FALSE "uuid")
ADD_OSQUERY_LINK(FALSE "ip4tc")
endif()
2015-05-07 04:58:23 +00:00
file(GLOB OSQUERY_CROSS_TABLES "[!ue]*/*.cpp")
ADD_OSQUERY_LIBRARY(FALSE osquery_tables
${OSQUERY_CROSS_TABLES}
)
2015-04-27 09:12:58 +00:00
file(GLOB OSQUERY_CROSS_TABLES_TESTS "[!u]*/tests/*.cpp")
ADD_OSQUERY_TABLE_TEST(${OSQUERY_CROSS_TABLES_TESTS})
file(GLOB OSQUERY_UTILITY_TABLES "utility/*.cpp")
ADD_OSQUERY_LIBRARY(TRUE osquery_tables_utility
${OSQUERY_UTILITY_TABLES}
)
2015-05-07 04:58:23 +00:00
if(NOT FREEBSD)
file(GLOB OSQUERY_UTILS "utils/*.cpp")
ADD_OSQUERY_LIBRARY(FALSE osquery_utils
${OSQUERY_UTILS}
)
Major YARA refactor and enhancements 1. Rename yara_matches to yara_events. 2. Add support for Config::getParser(). - This returns a ConfigPluginRef, which is the ConfigParser for the given key. - Being able to get the parser is useful because the YARAConfigParserPlugin uses it to store the compiled rules as an attribute. 3. Finish rename and use ConfigParserPlugin. - Finish the table rename to yara_events. - Use the new ConfigParserPlugin interface to parse the YARA configuration. The file_paths and signatures are stored in the ConfigParserPlugin named "yara" under the key "yara". The rules are compiled and stored as a private attribute of the same ConfigParserPlugin object. Here is an example config using this new structure: { // Description of the YARA feature. "yara": { "signatures": { // Each key is an arbitrary group name to give the signatures listed "sig_group_1": [ "/Users/wxs/foo.sig", "/Users/wxs//bar.sig" ], "sig_group_2": [ "/Users/wxs/baz.sig" ] }, "file_paths": { // Each key is a key from file_paths // The value is a list of signature groups to run when an event fires // These will be watched for and scanned when the event framework // fire off an event to yara_events table "system_binaries": [ "sig_group_1" ], "tmp": [ "sig_group_1", "sig_group_2" ] } }, // Paths to watch for filesystem events "file_paths": { "system_binaries": [ "/usr/bin/%", "/usr/sbin/%" ], "tmp": [ "/Users/wxs/tmp/%%" ] } } - Currently the signature file must be an absolute path. 3. Move common YARA code to yara_utils. - In preparation for the yara table (different from yara_events) I'm moving the common YARA code into a separate place which is shared between the two tables. 4. Add yara table. - This allows you to do things like: ```sql select * from yara where path="/bin/ls" and sigfile="/tmp/foo.sig"; select * from yara where path="/bin/ls" and sig_group="sig_group_1"; ``` - The latter will use the signature grouping from the config. 5. Check for keys not existing.
2015-04-17 20:03:43 +00:00
2015-05-07 04:58:23 +00:00
file(GLOB OSQUERY_UTILS_TESTS "utils/tests/*.cpp")
ADD_OSQUERY_TEST(FALSE ${OSQUERY_UTILS_TESTS})
endif()