Commit Graph

2036 Commits

Author SHA1 Message Date
Teddy Reed
bcd90070ae Remove time-override for events add API (#2508)
This will remove the use of current time for syslog.time and introduce
a new column called 'datetime'.

Events now uses an "optimize_id" alongside "optimize" to prevent returning
colliding events added within the same second as the previous genTable call.
2016-09-23 16:46:02 -07:00
Michael McGrew
30c17885ad New windows tables (#2451) 2016-09-23 14:33:44 -07:00
Jason Ogden
ee3ce66465 Extended crontab table to support files in /etc/cron.d/ (#2517)
merge dis in
2016-09-23 13:03:27 -07:00
Teddy Reed
62edfd46fe Toggle --utc to true (#2504) 2016-09-23 10:14:27 -07:00
Nick Anderson
83442532d7 Added flagfile to Windows service install (#2509) 2016-09-22 17:44:21 -07:00
Seshu Pasam
0f555c010d Use special base value of '0' that can handle values starting with 0x (#2505) 2016-09-22 13:32:45 -07:00
Nick Anderson
2626f8cf46 Fixed Thrift exit verbosity in Windows (#2500) 2016-09-21 18:54:03 -07:00
Teddy Reed
53b73d99c7 [Fix #2483] Lock registry manipulation while setting active plugins (#2499) 2016-09-21 18:04:58 -07:00
Teddy Reed
6ac58f17d6 Remove extensions retry and introduce watcher retry (#2498) 2016-09-21 16:17:30 -07:00
Teddy Reed
a6589c49e3 [Fix #2482] Use atomic member in Dispatcher tests (#2494) 2016-09-21 10:52:52 -07:00
yying
a7af70d021 Adding remote config/logging capabilities to Windows build (#2469) 2016-09-20 14:18:58 -07:00
Teddy Reed
ef10e93d60 Improve scheduled/differential query performance and logging (#2476) 2016-09-19 16:45:13 -07:00
Zachary Wasserman
9701c55d96 Add active column to osquery_packs table (#2475) 2016-09-19 13:00:11 -07:00
Nick Anderson
5877c3d464 Removing service start functionality (#2464) 2016-09-16 15:17:03 -07:00
Nick Anderson
386f123e03 Changing windows service name for parity with other platforms (#2465) 2016-09-16 15:16:48 -07:00
Bryon Gloden, CISSP®
0ef69c6b1d [windows] fix deallocation mismatches (#2468) 2016-09-15 15:13:05 -07:00
Teddy Reed
366b5f08ca Limit Linux package dependencies (#2463) 2016-09-14 10:31:21 -07:00
Teddy Reed
c7ee4f9ca4 Add librpm build and RPM tables (#2456) 2016-09-12 22:43:36 -07:00
Teddy Reed
53364b3cb5 Check for plist existance before attempting parsing (#2450) 2016-09-12 22:41:23 -07:00
Teddy Reed
a6ea7d6f6e Fix potential cast issue in memory_info (#2457) 2016-09-12 22:40:51 -07:00
Mitchell Grenier
072a93ccac Accelerated checkins (#2454) 2016-09-12 16:53:42 -07:00
yying
a27d6567e4 Core and Additional Tests (#2441) 2016-09-12 09:46:52 -07:00
Teddy Reed
817cb7ebd4 Fix minor sandboxes performance issues and plist parsing exceptions (#2455) 2016-09-09 19:45:37 -07:00
Nick Anderson
5060392b06 Multiple bug fixes in crashes (#2447) 2016-09-09 15:10:11 -07:00
Teddy Reed
71fff517e5 Add warning for event-based table without events (#2449) 2016-09-08 15:44:32 -07:00
Mitchell Grenier
61c9da1c42 Buffer the distributed queries to RocksDB for greater reliability (#2452) 2016-09-08 15:40:14 -07:00
Nick Anderson
467f9b3409 Adding Bool and String Array WMI Wrapper functions (#2430) 2016-09-07 18:04:33 -07:00
Teddy Reed
ea9ef3211c Change schedule and distributed log execution status text (#2445) 2016-09-07 15:35:28 -07:00
Teddy Reed
1bc52f8a50 [Fix #2443] Restore shellstaticFunc argument names (#2444) 2016-09-07 14:28:56 -07:00
Nick Anderson
01011f4d0f Fixed bug in MULTI_SZ processing (#2439) 2016-09-06 16:41:57 -07:00
Teddy Reed
81d8a4aa68 Emit warnings for improper 'osquery' table usage (#2432) 2016-09-02 19:13:37 -07:00
yying
84e6a3401a Reducing compiler warnings and fails on warn in VS (#2433) 2016-09-02 15:04:03 -07:00
Nick Anderson
7c90823a0c Upgrade LLVM to 3.8.1 on Linux (#2436) (#2435) 2016-09-02 14:53:04 -07:00
Teddy Reed
b61bbdbae3 Remove OpenSSL and cpp-netlib old version exceptions (#2413) 2016-08-31 17:32:50 -07:00
yying
d347c847e1 Support for extensions (#2363) 2016-08-31 16:45:06 -07:00
Teddy Reed
65dd56e113 Introduce table 'attributes' (#2431) 2016-08-31 15:32:20 -07:00
Teddy Reed
d6e20279d8 Use LOG(INFO) and set INFO as default logging mode (#2420)
This is fairly important, it changes the default mode for what status
events are logged to INFO. It had been set to WARNING and INFO was relatively
unused.

This also removes expected support for RocksDB 'in-memory' databases.
If a shell-user requests a database via CLI flags it will now work.
2016-08-31 15:09:01 -07:00
Teddy Reed
080bc5ed88 Improve verbose logging for several linux event publishers (#2421) 2016-08-29 14:26:25 -07:00
Teddy Reed
49ee904aea Add .list and .socket to shell meta command set (#2418) 2016-08-29 12:37:04 -07:00
Teddy Reed
0b3f6af306 Improve status logging when using multi-loggers (#2422) 2016-08-29 06:59:55 -07:00
Teddy Reed
05a795d80a Count subscriber events correctly in osquery_events (#2419)
This also changes the osquery_events API by renaming restarts to refreshes.
2016-08-29 06:57:24 -07:00
Teddy Reed
9824e6bd58 Rename phys_footprint to total_size and add threads (#2412) 2016-08-29 06:56:38 -07:00
Teddy Reed
6d1e73d729 Handle empty Linux pwd members (#2417) 2016-08-29 06:55:22 -07:00
Teddy Reed
89b1b6f3ff Fix Linux memory_map printing and use IOMEM instead (#2416) 2016-08-29 06:54:10 -07:00
Teddy Reed
1bff276fcf Increase TLS client timeout from 4s to 32s (#2410) 2016-08-27 13:12:48 +01:00
Teddy Reed
132fa3a753 Display flags in alphabetical order (#2407) 2016-08-24 17:44:16 +01:00
Nick Anderson
e6d4f36ebb Adding etc_hosts virtual table to windows (#2381) 2016-08-24 17:02:14 +01:00
Michael McGrew
a14961d868 Minor fixes to cb_info table (#2399) 2016-08-22 23:29:22 +01:00
yying
2f1cad864d Support for building static osquery executable (#2398) 2016-08-22 23:27:12 +01:00
Nick Anderson
f1d6686735 Fixed type bug with DWORD registry values (#2383) 2016-08-18 10:12:30 -07:00
Nick Anderson
fe7b8d98f9 Adding getSystemRoot function (#2386)
Adding a cross platform function for getting the OS root
and returning it as a boost::fs::path
2016-08-18 09:32:34 -07:00
Teddy Reed
1b75972181 [Fix #2387] Attempt to create user's osquery homedir (#2395) 2016-08-17 17:27:46 -07:00
Teddy Reed
e969b92a2e Fix code auditing job and disable Homebrew auto-update (#2392) 2016-08-17 16:00:30 -07:00
Nick Anderson
feb18c6173 Adding install/uninstall flags to daemon (#2379) 2016-08-17 09:23:11 -07:00
Michael McGrew
a0e83466d2 Add table for pulling back carbon black sensor info (#2377) 2016-08-16 21:56:29 -07:00
Teddy Reed
0eb696f1b3 Build POSIX applications tables (#2378) 2016-08-16 18:04:43 -07:00
Nick Anderson
9786b0efed Adding the windows registry virtual table (#2356) 2016-08-16 12:37:53 -07:00
Teddy Reed
a227c0cf3b Fix dep_packages and apply to all Linux (#2373) 2016-08-15 22:11:01 -07:00
Teddy Reed
a2540a2614 Update to AWS-SDK-CPP version 0.14.x (#2371) 2016-08-15 21:30:39 -07:00
Teddy Reed
f93253ec48 Nitpicks and style formatting 2016-08-15 16:07:51 -07:00
Ryan Holeman
a217035d12 Add AWS STS assume role authentication capability 2016-08-15 16:07:51 -07:00
Teddy Reed
987368221f Remove several raw strings that confuse static analysis (#2367) 2016-08-15 14:52:11 -07:00
Gary
8f57d2ea81 Change second FLAGS_pofile_delay to seconds (#2359) 2016-08-15 08:30:20 -07:00
Teddy Reed
a2017f68f1 Add clang-format rules from 3.6 (#2360) 2016-08-15 01:33:17 -07:00
Teddy Reed
58fd284f05 Improve dispatcher tests (#2358)
This improves dispatcher tests by allowing units to act like component
tests and use embedded std::thread-based osquery APIs. A unit may force
a 'service' to run by joining the Dispatcher before deconstructing.
2016-08-14 15:41:53 -07:00
Teddy Reed
7f54dca7e7 [Fix #2112] Remove forced benchmark skip (#2349)
Google benchmark 1.0.0 is included with the 1.8.0 build redesign.
2016-08-13 19:38:55 -07:00
Teddy Reed
f88d404e6d Add 'type' to logged_in_users (#2343) 2016-08-12 22:09:57 -07:00
Teddy Reed
a4ffa9d02a Fix shared library build and introduce FAST (#2344) 2016-08-12 19:25:28 -07:00
Teddy Reed
dd3020df79 [Fix #2319] Emit verbose log when Linux audit is immutable (#2347) 2016-08-12 18:30:21 -07:00
Teddy Reed
791dd4038a [Fix #2342] Use seconds for --profile_delay precision (#2348) 2016-08-11 07:49:55 -07:00
Teddy Reed
e6fec935c7 Move lz4 link order for RH-based hosts (#2341) 2016-08-10 17:03:54 -07:00
artemdinaburg
6e3f4b8e13 Copy required DLLs into the build directory (#2339) 2016-08-10 16:48:33 -07:00
artemdinaburg
d8bfe962aa Fix Windows under 1.8 build system (#2333) 2016-08-10 14:06:47 -07:00
Teddy Reed
33c1afa4b8 Allow the non-blocking kernel-test publisher to drop 5% (#2336) 2016-08-10 08:45:37 -07:00
Teddy Reed
1c4d6397fa OS X IOKit utilities refactor to allow SKIP_TABLES (#2335) 2016-08-09 20:49:56 -07:00
Teddy Reed
f3f605e26a Introduce a PLATFORM_MASK and isPlatform (#2334)
Along with the platform defines and platform string defines provided by
CMake to the build, add a PLATFORM_MASK define.

Use this define as a platform-type mask with the PlatformType enum.
2016-08-09 20:27:42 -07:00
artemdinaburg
7509e6c848 Fix make sdk with Packages CMake gate (#2327) 2016-08-09 14:44:48 -07:00
Teddy Reed
3d6fad00cf [Fix #2330] Add size check to package_bom variable address (#2331) 2016-08-08 15:36:38 -07:00
Zachary Wasserman
8aa9d63c42 Properly intialize BufferedLogForwarder for TLS output plugin (#2328)
Missing initialization of the BufferedLogForwarder was causing an underflow in
the count of buffered logs, and error messages as described in #2324. This
commit brings the initialization of the forwarder for TLS in line with
aws_kinesis and aws_firehose, removing that error.
2016-08-08 15:20:25 -07:00
Teddy Reed
1d2be3d962 Speed up osquery_additional_tests by restoring cache intervals (#2312) 2016-08-01 00:38:43 -07:00
Teddy Reed
7eab0f39bd Fix race conditions in Linux inotify publisher (#2309)
1. This adds several mutexes to the inotify publisher and its tests.
2. A fix for Linux 4.1 and LLVM TSAN is applied to CMake logic.
2016-07-31 22:41:37 -07:00
Teddy Reed
7c1ecc6871 Brew-based build redesign (#2251) 2016-07-31 11:32:31 -07:00
Zachary Wasserman
1074aad471 Use TLSTransport HTTP client in aws_util (#2299) 2016-07-28 23:09:28 -04:00
yying
50487c6880 Changes to make pidfile work on Windows (#2297) 2016-07-28 16:04:34 -07:00
Zachary Wasserman
129ec81853 Add release valve for purging buffered logs in BufferedLogForwarder (#2244) 2016-07-27 15:26:45 -07:00
nerddotcat
e015c132f6 Added memory_info table for Linux (#2282) 2016-07-27 15:20:07 -07:00
Nick Anderson
df9a33e0ec Rearranged virtual tables for Windows (#2291) 2016-07-25 17:15:19 -07:00
yying
6eb3cc4f9a Refactored timer functionality in osquery shell (#2290) 2016-07-25 15:35:34 -07:00
Teddy Reed
c99a1e15a0 Refactor system into POSIX and add CPUID to Windows (#2288) 2016-07-25 15:34:17 -07:00
Teddy Reed
14230d7bfa Port utilities/file to Windows (#2286) 2016-07-25 15:13:41 -07:00
Teddy Reed
42dbbd92ba Print UTC for blank timezones in utilities/time (#2287) 2016-07-25 14:46:14 -07:00
yying
0ef284b8e7 Changes to make osqueryd/osqueryi mostly build sans cputime/uptime tables (#2283) 2016-07-25 11:58:55 -07:00
Nick Anderson
10719e5cff Fixed 'off the end' bug in crashes table (#2285) 2016-07-23 11:06:56 -07:00
yying
2fb3797c53 Changes to support building a osquery Windows service. (#2278) 2016-07-22 13:29:37 -07:00
Teddy Reed
870c5bd9f9 Clean up verbose logging for OS X kernel extension (#2276) 2016-07-21 14:29:17 -07:00
Teddy Reed
c22f6147ea Move OSQUERY_HOME into core and use as filesystem config default (#2275) 2016-07-21 13:28:23 -07:00
Teddy Reed
6fc0ddb31d Add watcher column to osquery_info (#2261) 2016-07-21 13:07:24 -07:00
Teddy Reed
6df4c8c4d4 The watcher process should apply memory limits to itself (#2263) 2016-07-21 12:33:14 -07:00
yying
547e8f961c CMake configuration file changes to support Windows (#2258) 2016-07-20 23:48:55 -07:00
Teddy Reed
1e4dcb121b Introduce --audit_allow_sockets for Linux socket_events (#2270) 2016-07-20 23:47:54 -07:00
Zachary Wasserman
f1f00cec2b Enable DB in osqueryi when --database_path specified (#2268)
Prior to this change, both --disable_database=false and --database_path had to
be specified together. Now, if the user specifies --database_path the database
is enabled automatically.
2016-07-20 17:44:50 -07:00
Teddy Reed
edc3fa5a25 Remove process_file_events subscriber from Linux (#2267) 2016-07-20 17:20:23 -07:00
Teddy Reed
5be180a8f9 Swap removed and added for logs (#2260) 2016-07-20 12:25:10 -07:00
nerddotcat
ebf3ae378d added ssh_keys table for id_rsa files. (#2245) 2016-07-19 09:21:01 -07:00
artemdinaburg
78e1cf7ab4 Transition __attribute__((constructor)) to a more platform independent approach (#2233) 2016-07-14 14:19:33 -07:00
Zachary Wasserman
8161a5f0a8 Add autocompletion of table names in osqueryi (#2236) 2016-07-14 14:15:32 -07:00
Nick Anderson
8d97d06b89 Crashes table now grabs all register values (#2243) 2016-07-13 11:29:07 -07:00
Marcin Wielgoszewski
805e24928d Log execution of a distributed query (#2241) 2016-07-12 19:22:06 -07:00
Teddy Reed
45530c0496 Slight performance improvments (#2242) 2016-07-12 19:16:50 -07:00
Teddy Reed
7f304a0934 Various fixups and best practices (#2237) 2016-07-11 09:45:57 -07:00
Zachary Wasserman
b5c129f324 Fix process path parsing (#2234)
This commit fixes two issues with `path` in the linux processes table:

(1) Fixes a bug in which `on_disk` is set to `NULL` instead of `0` when the
binary is not on disk.

(2) Fixes a bug in which a filename ending in ` (deleted)` could cause osquery
to return an incorrect value for `on_disk`. See
https://github.com/facebook/osquery/issues/1607
2016-07-08 12:06:56 -07:00
Teddy Reed
54557b16e7 [Fix #2196] Fix osquery home directory checking (#2232) 2016-07-07 17:33:52 -07:00
Teddy Reed
48cb4d555d Add systemLog API (#2229)
This includes a minor SDK refactor as it move quite a few specialized
functions and facilities from core.h into system.h. There was a breaking point
for needing to frequently update core includes.

The new logger systemLog function allows a call site to bypass logging config
and write a line to the OS logger (aka syslog).
2016-07-07 15:16:28 -07:00
Teddy Reed
6852122af9 Force RocksDB to sync writes for non-event domains (#2228)
RocksDB is the default "database" plugin. Writes are normally kept in an
in-memory memtable. Writes that are not part of the event pubsub system can
be forced to sync to disk.
2016-07-07 14:08:12 -07:00
Ryan Holeman
88053a08b4 Optional top level decorator functionality (#2177) 2016-07-06 15:31:59 -07:00
Zachary Wasserman
8909602a40 Increase block period in flaky BufferedForwarder test (#2222)
This test was intermittently failing because it relies on the actual thread
scheduling. Our discussion in issue #2218 decided that it was worth keeping the
test around, while trying to mitigate the flakiness. The longer sleeps in this
test ran successfully hundreds of times in local testing.
2016-07-06 14:59:24 -07:00
Teddy Reed
21d1fca37d Add shutdown method to extensions (#2224)
This alters the osquery.thrift spec to add a ::shutdown method to the
Extension class. The ExtensionManager inherits from this but includes a
no-op shutdown method.

When an ExtensionManager (osquery core) stops, it optionally requests all
Extensions to shutdown immediately. This helps quit extensions processes
faster.
2016-07-06 12:23:24 -07:00
artemdinaburg
bede048323 Merge posix/windows processes table into single entity (#2220) 2016-07-05 21:18:14 -07:00
Teddy Reed
f740a1f020 Fix SQLite access after ASIO usage (#2217)
Using the boost ASIO libraries before calling SQLite open causes the
"file://" protocol to be rewritten with a prepended CWD.
2016-07-05 12:56:38 -07:00
artemdinaburg
e6fbde820e Windows Daemon/Shell: Make osquery code more Windows-friendly (#2188) 2016-07-01 14:56:07 -07:00
Teddy Reed
8dfe79ad83 Use a noexcept lexical_cast for SQL type conversions (#2212) 2016-07-01 11:37:19 -07:00
Teddy Reed
662b1483d5 Remove unused variable in virtual_table (#2210) 2016-06-30 18:41:43 -07:00
Teddy Reed
1f9739eed4 [Fix #2203] Restore extension respawn limits to 20s (#2207) 2016-06-30 17:53:05 -07:00
Teddy Reed
753c023640 Fix milli/micro conversion when waiting for active plugins (#2205) 2016-06-30 13:31:32 -07:00
artemdinaburg
5292100c22 Use vector.data() to get internal vector buffers (#2204) 2016-06-30 12:32:26 -07:00
Teddy Reed
9756713e36 Adds -fpermissive and fixes 'using' for anon struct (#2200) 2016-06-29 20:15:58 -07:00
artemdinaburg
c20c91f2e5 CMake changes to build Windows tables (#2194)
This PR implements the CMake changes to build Windows tables, and serves as a follow-on to PR
2016-06-28 11:19:32 -07:00
artemdinaburg
864d77b180 Windows Daemon/Shell: Windows Processes Table (#2184)
Include table changes necessary for a Windows processes table and changes to other tables needed for daemon and shell to run. The Windows processes table uses WMI as a backend to gather information. This commit does not yet build these tables.
2016-06-28 11:07:34 -07:00
Teddy Reed
47e1a5ba74 Use noexcept boost::filesystem overloads (#2195) 2016-06-27 16:39:04 -07:00
Nick Anderson
72df044ef5 Adding check for nullptr before dereferencing. This fixes #2185 (#2187) 2016-06-24 13:59:49 -07:00
Teddy Reed
c8c67c455a Simplify watchdog limits configuration (#2173) 2016-06-19 23:27:16 -07:00
Ryan Holeman
b47f246ab4 Optional randomization of shard ids for AWS Kinesis load balancing (#2157) 2016-06-15 15:29:59 -07:00
yying
d2d9a27845 [Fix #2165] Use noexcept boost methods in PlatformFile (#2167) 2016-06-15 10:23:48 -07:00
Zachary Wasserman
79818c72ab Add newlines in firehose records (#2166) 2016-06-14 16:50:28 -07:00
Nick Anderson
cf30388705 Moved test_utils to it's own directory out of core. Updated references (#2154) 2016-06-09 10:49:26 -07:00
Teddy Reed
866ff13fc3 Fix OS X kernel extension autoload (#2151) 2016-06-08 11:14:36 -07:00
Ryan Holeman
deb9c56633 Changed stream validation from list streams to describe streams (#2141) 2016-06-07 17:17:15 -07:00
Teddy Reed
78c8e8eca9 Minor cleanups to extension autoloading (#2147) 2016-06-07 17:14:17 -07:00
Teddy Reed
91b34010df Allow table specs to use multiple row indexes (#2146) 2016-06-07 17:13:48 -07:00
Zachary Wasserman
462cd8bdbf Update AWS logger code for AWS SDK 0.12.4 (#2140)
The AWS SDK changed how custom HTTP clients are used, and this commit brings
compatibility with the new initialization style.
2016-06-07 15:06:49 -07:00
yying
9879733867 Filesystem Abstractions - Integrations (#2128)
* Integrated filesystem operation abstraction code into filesystem.cpp
* Modified filesystem unit tests to be more platform agnostic
* Added append mode for PlatformFile
* Minor bug fixes in filesystem operations
2016-06-07 14:08:50 -07:00
Teddy Reed
a8d6bc7c58 Use self-process for query join tests (#2144) 2016-06-07 13:01:07 -07:00
Teddy Reed
763f4e9437 Use SQLite 3.14.0 to support LIKE and EQUALS (#2137)
This commit bumps the third-party SQLite to the 3.14.0 pre-release (18:59).
With 3.14.0 the LIKE and EQUALS constraint operators may be mixed within a
query. Previously these would fail to produce a valid set.

As part of the support, each virtual table should choose to bypass rowid-based
deduplication using the new "WITHOUT ROWID" create table epilog. This will
be appended to the schema if the table defines a PRIMARY KEY using index=True.
2016-06-06 09:36:53 -07:00
Teddy Reed
e0f350e439 Limit SMBIOS reads to 0x000f0000-0x00100000 (#2135) 2016-06-05 13:09:03 -07:00
Nick Anderson
240958ea76 Fixed typing in FileOps tests (#2127)
Some of the types in fileops tests were causing warnings to be thrown
during build, due to type mismatch. I've added a few local variables to
quiet these warnings.
2016-06-02 15:46:55 -07:00
yying
5f81cd9e2b Filesystem Abstractions - Code and Unit Tests (#2119)
* Implemented filesystem operations abstraction code
* Added filesystem operations abstraction unit tests
* Modified CMake configurations to support the building of the abstraction code and unit tests
2016-05-31 12:20:38 -07:00
Teddy Reed
05882d717c Add basic string split and inet_aton functions (#2124)
The three new SQLite functions:
- split: Splits a column using a set of tokens and a selected index.
- regex_split: Similar to split but with a regex instead of tokens.
- inet_aton: Returns the IPv4 decimal value for a string-formatted address.
2016-05-29 02:06:02 -07:00
Teddy Reed
1cf80c9300 Fix os_version detection for Ubuntu 16.04 (#2125) 2016-05-28 20:02:58 -07:00
Teddy Reed
37544138b5 Add basic math extension functions (#2123) 2016-05-28 17:46:24 -07:00
Teddy Reed
a9ed73c68d Add removeService to Dispatcher API (#2116)
With a removeService method, combined with the abstracted thread start in
the Dispatcher API, services auto-remove when finished.

This will un-break the kernel communication tests. These tests only stop
when all their producer threads/services have ended.

This also promotes the OS X kernel build to 10.11.
2016-05-27 11:17:06 -07:00
Teddy Reed
10664a4945 Add --ephemeral for daemons and disable shell events (#2111)
This changes several initialization steps:
- The daemon (and shell, though not needed) have a new --ephemeral flag.
- Events are now disabled in the shell by default, use --nodisable_events to
  re-enable.
- RocksDB-based backing storage is now disabled in the shell by default.

The --ephemeral flag for the daemon is disabled by default and will allow
skipping configuration and database path sanity, and skipping pidfile checks.
This is intended to be used when debugging or monitoring the daemon process.

To make the RocksDB backing storage feature usage very clear we introduce a new
flag: --disable_database. The shell sets this to true unless overridden in
a flagfile or via command line arguments.
2016-05-20 08:39:04 -07:00
Teddy Reed
a5100f7b12 Disable Google Benchmark and AWS SDK from build (#2113)
See: #2112 and #2107
2016-05-19 17:23:07 -07:00
Teddy Reed
9d53a1c148 Rename time and environment columns for process_events (#2096) 2016-05-19 14:41:03 -07:00
Sharvil Shah
8b0e6e138f Fix benchmark target and bump version of google-benchmark to 1.0.0 (#2065) 2016-05-19 11:56:54 -07:00
Teddy Reed
c4acfe89e5 Introduce table aliases (#2104) 2016-05-19 09:40:43 -07:00
Teddy Reed
b28c4d8d0f Introduce table options (#2101)
Table options includes a change to the Registry::call API for TablePlugins.
When requesting route information or the 'columns' action, a new 'op' key is included.
2016-05-18 12:23:52 -07:00
Teddy Reed
50694052c4 Use POST for distributed queries within the node API (#2103) 2016-05-18 09:20:17 -07:00
yying
26ad131c38 Building osquery unit tests on Windows 10 (#2100)
Integrated process abstraction code into more locations
Defined new macros for abstracting across various platforms
Added GLOG_NO_ABBREVIATED_SEVERITIES for glog to support Windows
Fixed some minor CMake issues involving thrift
Updated gflags package; reflecting change in provision script
Preparing CMake config files for WIN32 support
2016-05-17 12:39:11 -07:00
Teddy Reed
9c01d4a6e3 Add quicklook_cache to Darwin (#2099) 2016-05-13 23:49:10 -07:00
Teddy Reed
77273f6500 Add logEvent API to logger plugins (#2088) 2016-05-13 19:48:40 -07:00
yying
15d1455957 Process Operations - osquery/core Integration (#2087)
This integrates the process abstraction operations within osquery core.
2016-05-13 19:47:45 -07:00
Teddy Reed
0ffe0c9d16 Add --pack flag to the shell (#2093)
This introduces a new testing-related flag to the osqueryi shell.
The --pack flag takes a single argument, the name of a configured pack.

To list the configured packs try:
$ osqueryi -A osquery_packs

To run all queries, immediately and serially, try:
$ osqueryi --pack NAME_OF_PACK
2016-05-12 09:22:05 -07:00
Teddy Reed
3813f09abb Clean up host identifier UUID access (#2092)
When selecting UUID as the host identifier the client follows:
- If host_identifier is set to hostname, return the hostname
- If UUID check a static UUID container
- If empty request the UUID from the backing storage, RocksDB
- If empty use the Apple hardware UUID or generate a UUID
- If the Apple UUID request fails generate a UUID

When no UUID is available in the backing store save the new UUID.
2016-05-12 08:40:37 -07:00
Teddy Reed
fcd00aff2c [Fix #2032] Remove manual Thrift library discovery (#2085)
The Thrift library should be discovered simiarly to all others.
When using the build-macros for library discovery the caller can choose
how to discover static or dynamic links.
2016-05-11 14:17:12 -07:00
yying
63c0258aec Abstracted platform specific process operations into a common interface. (#2069)
Added Windows support for process operations.
Added unit tests for process abstraction code for POSIX and Windows.
Modified CMake config files to support building the new code and unit tests.
2016-05-11 14:16:32 -07:00
Teddy Reed
ce2ba6d9c8 Refactor logStatus and logger initialization (#2081)
The initialization of a logger plugin was confusing. The 'init' step was
introduced to allow a daemon to buffer status events before a logger plugin
is determined by external/remote configuration. The buffered statuses could
then be transferred via a medium other than Glog (the default). To determine
if Glog should continue to write statuses to the filesystem the 'init' method
returned a Status.

Logger plugins should now use a feature method override to select how status
logs should be handled.
2016-05-11 12:05:09 -07:00
Teddy Reed
57c6b2a521 Revive the OS X kernel-based publishers (#2083)
The OS X kernel subscribers have not been starting because they expect the
publisher thread to run before they begin configuration. Due to some recent
refactors the publisher thread creation now occurs after configuration.

The subscriber logic to check for a valid kernel connection is still valid.

This commit has two additional side-effects:
- The RocksDB plugin is modified to use 3 background merge threads.
- The OS X kernel publisher syncing thread is now non-blocking.
2016-05-11 11:47:42 -07:00
Teddy Reed
0bb79c83e0 Remove the logHealth method from logger plugins (#2079) 2016-05-10 08:34:55 -07:00
Nick Anderson
2ac2eef3c8 Filtering out LowBattery crash logs (#2080)
The mobile 'LowBattery' crash logs provide little if any data of value,
and seem to be nothing more than notification events.  We're filtering
these out of the crashes table.
2016-05-10 08:01:28 -07:00
Teddy Reed
947799d28e Introduce within-query caching (#2077)
This adds a new optimization feature that allows expensive tables to cache
their results between JOINs. Consider JOINing a list of open sockets, for each
process, then requesting to hash each process path. This query may hash
the same path multiple times.

Within-query caching allows the hash table to respond with the previous
result of the hash request as long as the requested computation was the result
of a single query. Subsequent queries will perform subsequent hashing.
2016-05-09 10:32:33 -07:00
Nick Anderson
209900d5a8 Adding mobile device crash parsing and 'type' column to Crashes table (#2076)
This commit adds mobile device crashes to the list of crash logs parsed by the Crashes table as well as adding a lamdba to improve code reuse.  The commit also adds a 'type' column to the table to indicate what kind of log this crash log was.
2016-05-06 13:14:06 -07:00
Nick Anderson
27fa7001c9 Renamed crash_log table. Small fixes to parsing behavior (#2074)
Renamed the crash_log table to crashes for future abstraction to other
operating systems. Also fixed how the table was parsing the most recent
stack trace and the registers.  Register values are now all parsed into
one column 'registers', which will be a space delimited string of the
form:

register:value register:value ... register:value

in order to best allow for OS abstraction.
2016-05-06 09:18:06 -07:00
Teddy Reed
9011123f2d Add local_timezone and datetime (ISO) to time table (#2073)
It is often helpful to know the local timezone of the machine. For this use
local_timezone, as the base timezone will use local or UTC depending on the
--utc flag. This will be default=UTC in osquery 1.8.0.

The datetime field is added to mimic ISO 8601, along with iso_8601.
The timestamp field remains as the time stamp used for logging (within osquery)
and commonly outside of osquery. The goal for adding multiple representations
is to allow joining/augmenting of other tables.
2016-05-05 23:05:51 -07:00
Teddy Reed
921221ed46 Add osquery version to status logs (#2067) 2016-05-05 13:19:25 -07:00
Teddy Reed
9053a1f125 Include decorations within results events (#2068)
Currently, the decorations are applied to statuses and results in batch format.
This seems like an oversight, decorations should be on all results.
2016-05-05 13:19:10 -07:00
Teddy Reed
5a56805970 Introduce --utc flag to convert all calendar UNIX times to UTC (#2064)
Beginning in version 1.8.0 all time uses will converge on an osquery-provided
getUnixTime() API call that returns, by default, UNIX time integers converted
to UTC/GMT. The 'time' table will respond with the parsed time for the
configuration. If the timezone is not UTC then osquery is using localtime.

This configuration option will affect the 'unix_time' response in the 'time'
table. Because of this configurable-effect the table is extended to include
'local_time' which is always the system local UNIX time.
2016-05-03 13:00:31 -07:00
Teddy Reed
b6f09a7ecb Add action for snapshot query results (#2061) 2016-05-03 11:16:22 -07:00
Zachary Wasserman
4bb95a3a29 Fix AWS credentials test failure when env vars set (#2062) 2016-05-02 19:17:09 -07:00
Teddy Reed
9c541ee1ce [Fix #2058] Send Content-Encoding when using TLS compression (#2060)
When the configuration flag: --logger_tls_compress is used the client should
send a "Content-Encoding: gzip".
2016-05-02 18:03:04 -07:00
Zachary Wasserman
5f778a201b Prevent error when TLS response body is empty (#2053) 2016-04-25 18:10:12 -07:00
Zachary Wasserman
262833c86a Add AWS Kinesis and Firehose logger plugins (#2045)
This commit adds logger plugin implementations for the Amazon
Kinesis (https://aws.amazon.com/kinesis/) and Kinesis
Firehose (https://aws.amazon.com/kinesis/firehose/) services. To support
these plugins there are a number of utility classes and functions for
AWS authentication, configuration and API integration. The logger plugin
implementations take advantage of the BufferedLogForwarder base class
for reliable buffering and batch sending of logs. In their current
implementations, the logger plugins only support sending of result logs
to these AWS services.
2016-04-25 16:19:51 -07:00
Zachary Wasserman
9be5c465ef Improve error messages for TLS JSON (de)serialization (#2050) 2016-04-22 11:29:56 -07:00
yying
18013da24b Initial support for building on Windows (#2015)
* Committing changes related to our experimentation with a "pure" Win64 build

* Placates CMake such that a Visual Studio 14 x64 solution is generated!

* Updated changes to fix the issue of GFlags not being found.

* Added cases to handle Win64 specific CMake options such as include/link
directories and compiler options

* Comment change in CMakeList.txt

* Changed wording of get_platform error message. Adding Powershell
provisioning script.

* Finalized provision powershell script

* Added a deployment XML file for insuring C++ support exists for VS2015

* Added admin check and resolved some potential PATH issues.

* Fixed some potential bugs in VS2015 automated install

* Adding a wrapper for provision.ps1 so people don't need to know obscure
powershell syntax

* Fixing a bug with third-party archive extraction

* Ignoring the updating of pip for now...

* Fix invocation of choco.exe

* Resolved pip install issues

* Removed some debugging residue

* Changing get_platform.py from tabs to spaces

* Added distro detection for ubuntu and darwin

* Using 4 spaces

* Added a newline after powershell invocation

* Added OS detection for freebsd and fedora

* Fixed bug with freebsd

* Adding arguments parsing to prepare for modularizing platform detection

* Removing bash platform detection logic and forwarding the task to
get_platform.py

* Removing get_platform support in provision.sh since it doesn't appear to
be used anywhere now

* Fixed some comment/spacing issues. Made a few efficiency changes

* A few bug fixes, revereted back to WIN32 variable for now

* Added Facebook copyright information.

* Fixed boost and rocksdb library paths

* Added support for installing our custom chocolatey packages

* Fixed path to ignore the symlink

* Force environment variable propagation

* Forgot to add new line after make-win64-dev-env.bat

* Added error handling for choco install failures

* Handles download and python/pip errors

* When chocolatey is not detected, refreshenv.bat is not found in the PATH.
Hardcode the PATH as per chocolatey install instructions

* Takes care of updating git submodules in third-party\

* Fixes a bug in which Linux provisioning fails because of unset FAMILY
env var.
2016-04-15 14:01:16 -07:00
Zachary Wasserman
9370d9e1f5 Fix pessimizing move warnings (#2040)
Fixes warnings generated by Clang when `std::move` is used in a `return`
statement. Verified by `make clean`, saw no warnings, `make test` passes.
2016-04-15 13:15:23 -07:00
Zachary Wasserman
2376fedb73 Introduce BufferedLogForwarder (#2036)
BufferedLogForwarder is a base class for external log forwarding schemes
that require buffering and retries. It generalizes the logic from the
existing TLSLogForwarderRunner.

The existing TLSLoggerPlugin and TLSLogForwarderRunner are refactored to
demonstrate the use of this new base class.
2016-04-15 09:49:35 -07:00
Serey Ty
a8c8e9e9cb fix the cpu id displayed in core column (#2038) 2016-04-15 08:38:32 -07:00
Nick Anderson
134c2750c2 Adding Crash Logs table for OS X (#2027)
Added a table that parses out some of the informaiton in the OS X logs
stored in /Library/Logs/DiagnosticReports as well as
/Users/<user>/Library/Logs/DiagnosticReports
2016-04-13 16:25:40 -07:00
Teddy Reed
a98e483ef5 Reset configuration state in relative tests 2016-04-12 13:06:02 -07:00
Teddy Reed
192953bcd3 [Fix #2030] Add generate_foreign and --enable_foreign (#2034) 2016-04-11 09:33:45 -07:00
Zachary Wasserman
8cb862e327 Allow TLS to proceed without node key if enrollment disabled 2016-04-07 08:47:03 -07:00
Justin Gerace
8207feecd1 Add time column to shell_history table
* Add time column to shell_history table

* Add support for zsh timestamp format in shell_history table
2016-04-05 11:02:14 -07:00
Zachary Wasserman
f8ff713d81 Add type safe dispatcher pause APIs
These APIs using std::chrono::duration allow us to take advantage of
automatic time conversion and type safety among different units of time.
No changes were made to existing call sites.
2016-04-01 20:53:51 -07:00
Zachary Wasserman
cebd103e9b Add gmock into gtest CMake config 2016-04-01 14:59:24 -07:00
Teddy Reed
c159ea7c71 Refactor install_history 2016-04-01 10:02:56 -07:00
Tim Zimmermann
5c47e2b91e Add InstallHistory table
See #1922.
2016-04-01 09:51:01 -07:00
Teddy Reed
97690b1b95 Merge pull request #1983 from theopolis/decorators
Introduce decorator queries
2016-03-30 21:04:31 -07:00
Teddy Reed
c727b6d015 Merge pull request #1961 from zwass/syslog_events
Add syslog table for querying of rsyslog logs
2016-03-30 14:22:34 -07:00
Zachary Wasserman
98cdd3643f Add linux syslog virtual table
This commit adds an event-based virtual table implementation for
querying the linux syslog. It introduces an event publisher that
attaches to a named pipe to ingest CSV formatted syslog forwarded from
rsyslogd. An event subscriber/virtual table makes these log lines
available for queries. Currently, no additional processing is done on
the input data besides parsing.

Using this table requires a properly configured rsyslogd. Documentation
for this configuration is forthcoming in the wiki.
2016-03-30 13:36:57 -07:00
Justin Gerace
0c07203121 Add more Scientific Linux conditionals 2016-03-29 23:56:11 -07:00
Teddy Reed
4de0737ce4 Add test for SchedulerRunner 2016-03-29 15:27:07 -07:00
Teddy Reed
e3436c72ef Merge pull request #1981 from PoppySeedPlehzr/master
Treating the disabled plugins as a folder
2016-03-29 15:24:45 -07:00
Nick Anderson
7677494849 Treating the 'Disabled Plug-ins' as a folder as opposed to a plugin, and added a 'disabled' column to the table 2016-03-29 14:28:25 -07:00
Teddy Reed
2379493721 Introduce decorator queries 2016-03-29 10:03:50 -07:00
Mike Arpaia
d70affe3d3 [Fix #1962] Clear cache of distributed query results after flush
If the distributed plugin's `writeResults` method can be successfully
called, we must clear the local vector of results so that we're not
constantly growing it over time.
2016-03-29 09:26:27 -07:00
Zachary Wasserman
91691f71d6 Update flaky test for ASL table
Previously, this test relied on there being console messages available
to query for. Now, it actually writes a message to ASL, then verifies
that the message can be found. It also exercises a more complicated
query than previously. Also remove potentially high latency queries.

Fixes issue #1975
2016-03-28 14:06:53 -07:00
Teddy Reed
2a350afb10 Merge pull request #1974 from theopolis/sane_logging_disable
[Fix #1973] Improve logging/extensions relays
2016-03-27 01:00:16 -07:00
Teddy Reed
b9194026db [Fix #1973] Improve logging/extensions relays 2016-03-27 00:43:02 -07:00
Teddy Reed
e663d91f00 Merge pull request #1972 from theopolis/fix_1971
[Fix #1971] Use recursive locks for config data predicates
2016-03-26 22:27:45 -07:00
Teddy Reed
a18444813b [Fix #1971] Use recursive locks for config data predicates 2016-03-26 21:52:22 -07:00
Zachary Wasserman
0eff0f2f4e Collection of doc fixes
- Minor fix in creating tables documentation
- Fix docs for join
- Add note about config paths
- Update events docs
- Fix link to query packs
2016-03-25 14:12:41 -07:00
Teddy Reed
684697ba8d Merge pull request #1963 from theopolis/yara_move
Add move events to yara_events
2016-03-24 12:16:18 -07:00
Teddy Reed
339f142da4 Add move events to yara_events 2016-03-24 11:24:54 -07:00
Teddy Reed
d2d1431061 Move dispatcher to public API 2016-03-21 15:27:51 -07:00
Teddy Reed
52a3285c18 Merge pull request #1953 from theopolis/pgroup
[Fix #1878] Rename processes 'group' to 'pgroup'
2016-03-20 22:14:08 -07:00
Teddy Reed
eb76fc1860 Rename processes 'group' to 'pgroup' 2016-03-20 19:35:49 -07:00
Teddy Reed
27f4754e5e [Fix #1928] Reorder deps installs to build all with clang 2016-03-20 19:15:44 -07:00
Teddy Reed
482eecfab1 Protect udev publisher from fast interrupts 2016-03-20 18:46:34 -07:00
Teddy Reed
59196b6f44 Merge pull request #1952 from theopolis/profile_fix
Fix shell's --profile switch
2016-03-20 16:37:46 -07:00
Teddy Reed
ebb0ab30ce Fix shell's --profile switch 2016-03-20 16:05:13 -07:00
Teddy Reed
89c32de89d Merge pull request #1950 from friedbutter/signature_multiple_results
add feature to select multiple rows to signature table
2016-03-20 13:53:09 -07:00
Teddy Reed
15a998e54f Use the default shutdown flow within extensions 2016-03-20 01:45:49 -07:00
Sereyvathana Ty
0706146c01 add feature to select multiple rows to signature table 2016-03-19 17:42:21 -07:00
Teddy Reed
4609486f74 Merge pull request #1947 from theopolis/osx_publisher_locks
Enhance publisher resource locking on OS X
2016-03-18 19:13:55 -07:00
Teddy Reed
54578df073 Merge pull request #1946 from theopolis/debian_packages_fixup
Fixup Debian package builds
2016-03-18 18:17:33 -07:00
Teddy Reed
9f5de79af1 Fixup Debian package builds 2016-03-18 16:59:59 -07:00
Teddy Reed
d7c2f88289 Enhance publisher resource locking on OS X 2016-03-18 16:14:15 -07:00
Teddy Reed
3576189281 Check for interrupt requests in TLS config refresher 2016-03-18 12:03:27 -07:00
Teddy Reed
c62a0f41b6 Various cleanups 2016-03-18 10:40:07 -07:00
Teddy Reed
3e103e69ba Merge pull request #1931 from ilovezfs/iokitlib-header-casesensitivity
IOKitLib.h not IOKitlib.h
2016-03-16 22:32:03 -07:00
Teddy Reed
593f024514 Merge pull request #1936 from theopolis/events_ex
Expire data when record is before expire time
2016-03-16 12:58:21 -07:00
Teddy Reed
7040780863 Expire data when record is before expire time 2016-03-16 12:35:06 -07:00
Teddy Reed
621f1bd3a9 [Fix #1896] Gate additional and kernel tests/benchmarks 2016-03-15 23:05:37 -07:00
Teddy Reed
bb20a968d9 Merge pull request #1930 from theopolis/debug
Build debug packages
2016-03-15 11:12:56 -07:00
ilovezfs
52e7d55600 IOKitLib.h not IOKitlib.h
As with all other appearances of IOKitLib.h in the osquery sources, use
the capitalization "IOKitLib.h" not "IOKitlib.h" to avoid build failure
on case-sensitive file systems.
2016-03-15 09:43:11 -07:00
Teddy Reed
42222bd4a5 Build debug packages 2016-03-15 08:58:01 -07:00
Sereyvathana Ty
f912fca415 add cdhash, team_identifier, and authority to signature table
cdhash - code directory hash
(https://developer.apple.com/library/mac/documentation/Security/Conceptu
al/CodeSigningGuide/RequirementLang/RequirementLang.html)

team_identifier is a unique id of the app developer

authority is the common name of the signed certificate
2016-03-14 23:19:27 -07:00
Zachary Wasserman
1af6684019 Apple system log virtual table implementation
This adds a virtual table implementation for efficient querying of the
Apple System Log (ASL) store.
2016-03-14 12:19:03 -07:00
Teddy Reed
0ba2861cf9 [Fix #1920] Detach thread before joining/clearing (terminate) 2016-03-13 12:15:18 -07:00
Teddy Reed
59274e59c6 Remove boost::thread from fsevents tests 2016-03-12 00:30:05 -08:00
Teddy Reed
21c7ab642b Remove boost::thread from inotify tests 2016-03-12 00:15:58 -08:00
Teddy Reed
3de52846d0 Remove boost::thread 2016-03-11 11:50:44 -08:00
Teddy Reed
bc384ba7ad Merge pull request #1914 from russellhancox/certificate-files
Darwin: Allow certificates table to read DER/PEM files
2016-03-11 08:19:51 -08:00
Russell Hancox
05c1dbecb0 Darwin: Allow certificates table to read DER/PEM files as well as keychain 2016-03-11 11:02:54 -05:00
Teddy Reed
d3786c45a3 Merge pull request #1916 from theopolis/deps_updates
Several package updates within provision code
2016-03-10 20:26:04 -08:00
Teddy Reed
32efa9a09b Several package updates within provision code
1. Update boost to 1.60 from 1.55 on Linux platforms
2. Add asio (1.11.0) to the deps set
3. Update snappy to 1.1.3 on Linux platforms
4. Update cpp-netlib to 0.12.0-rc1 from 0.11 on Linux platforms
 - OS X and brew also include 0.12.0-rc1 as a devel option
5. Update libapt to 1.2.6 from 0.8.6 on Ubuntu/Debian
 - This adds lzma as a dependent link
2016-03-10 19:40:15 -08:00
Zachary Wasserman
c91798b083 Add path to error message when config file not found
Example:
```
$ sudo ./build/darwin/osquery/osqueryd --allow_unsafe --config_path
/foo/bar
W0310 13:34:40.473743 1955008512 init.cpp:506] Error reading config:
config file does not exist: /foo/bar
```
2016-03-10 14:13:08 -08:00
Teddy Reed
9d8c3adef7 Merge pull request #1879 from theopolis/lints-2
Fix various lint issues
2016-03-10 01:10:42 -08:00
Teddy Reed
96e2562e2d Merge pull request #1913 from sharvilshah/process_state_mnemonics
[#1886] Use mnemonics for process states on Darwin
2016-03-09 23:30:41 -08:00
Teddy Reed
26c8b5640f Fix various lint issues 2016-03-09 19:55:39 -08:00
Teddy Reed
03d0d7e835 Merge pull request #1910 from theopolis/null
Allow NULL values, stop using -1 as int/double invalid values
2016-03-09 19:23:35 -08:00