osquery-1/tools/tests
Mike Arpaia a140333441 [fix #1390] query pack re-org
This commit contains the features specified in #1390 as well as a
refactoring of the general osquery configuration code.

The API for the config plugins hasn't changed, although now there's a
`genPack` method that config plugins can implement. If a plugin doesn't
implement `genPack`, then the map<string, string> format cannot be used.
The default config plugin, the filesystem plugin, now implements
`genPack`, so existing query packs code will continue to work as it
always has.

Now many other config plugins can implement custom pack handling for
what makes sense in their context. `genPacks` is not a pure virtual, so
it doesn't have to be implemented in your plugin if you don't want to
use it. Also, more importantly, all config plugins can use the standard
inline pack format if they want to use query packs. Which is awesome.

For more information, refer to #1390, the documentation and the doxygen
comments included with this pull requests, as well as the following
example config which is now supported, regardless of what config plugin
you're using:

```json
{
  "options": {
    "enable_monitor": "true"
  },
  "packs": {
    "core_os_monitoring": {
        "version": "1.4.5",
        "discovery": [
          "select pid from processes where name like '%osqueryd%';"
        ],
        "queries": {
          "kernel_modules": {
              "query": "SELECT name, size FROM kernel_modules;",
              "interval": 600
          },
          "system_controls": {
              "query": "SELECT * FROM system_controls;",
              "interval": 600,
              "snapshot": true,
          },
          "usb_devices": {
              "query": "SELECT * FROM usb_devices;",
              "interval": 600
          }
        }
    },
    "osquery_internal_info": {
        "version": "1.4.5",
        "discovery": [
          "select pid from processes where name like '%osqueryd%';"
        ],
        "queries": {
          "info": {
              "query": "select i.*, p.resident_size, p.user_time, p.system_time, time.minutes as counter from osquery_info i, processes p, time where p.pid = i.pid;",
              "interval": 60,
              "snapshot": true
          },
          "registry": {
              "query": "SELECT * FROM osquery_registry;",
              "interval": 600,
              "snapshot": true
          },
          "schedule": {
              "query": "select name, interval, executions, output_size, wall_time, (user_time/executions) as avg_user_time, (system_time/executions) as avg_system_time, average_memory from osquery_schedule;",
              "interval": 60,
              "snapshot": true
          }
        }
    }
  }
}
```

The `osquery_packs` table was modified to remove the superfluous
columns which could already have been found in `osquery_schedule`. Two
more columns were added in their place, representing stats about pack's
discovery query execution history.

Notably, the internal API for the `osquery::Config` class has changed
rather dramatically as apart of the refactoring. We think this is an
improvement. While strictly adhering to the osquery config plugin
interface will have avoided any compatibility errors, advanced users may
notice compilation errors if they access config data directly. All
internal users of the config have obviously been updated. Yet another
reason to merge your code into mainline; we update it for you when we
refactor!
2015-09-02 10:56:26 -07:00
..
test.config.d Ability to configure osquery from multiple files 2015-03-13 17:19:02 -07:00
CMakeLists.txt Various additional tests and benchmarks 2015-07-28 12:26:17 -07:00
osquery.supp Remove EventFactory::deregister... in favor of ::end 2015-02-01 02:20:09 -07:00
plist_benchmark.cpp Fast tests 2015-04-27 09:40:31 -07:00
sanitize_blacklist.txt Linting and asan fixups 2015-05-04 11:00:21 -07:00
stress.py Removing trailing whitespace 2015-05-11 23:31:13 -07:00
test_additional.py Pack and testing fixups 2015-05-28 12:17:27 -07:00
test_alf.plist Improve usb_devices on OSX 2014-12-10 01:17:24 -08:00
test_array.plist OSX XProtect siganture DB as virtual table 2014-12-16 21:35:26 -08:00
test_base.py [fix #1390] query pack re-org 2015-09-02 10:56:26 -07:00
test_binary.plist Organize /tools 2014-12-02 21:16:24 -08:00
test_cert.pem OSX XProtect siganture DB as virtual table 2014-12-16 21:35:26 -08:00
test_client.key Update testing x509 certs 2015-06-13 02:13:31 -07:00
test_client.pem Update testing x509 certs 2015-06-13 02:13:31 -07:00
test_enroll_secret.txt TLS plugin workflow tests 2015-05-26 19:55:00 -07:00
test_example_queries.py Various additional tests and benchmarks 2015-07-28 12:26:17 -07:00
test_extensions.py Relax extensions and shell timeouts 2015-07-02 12:14:44 -07:00
test_hashing.bin Add unit testing to hashing 2015-01-21 16:24:40 -08:00
test_hosts.txt Fix etc_hosts hostname parsing so that inline comments are now ignored; update tests 2015-04-06 23:32:56 -07:00
test_http_server.py Fix DBHandle checking with concurrent processes. 2015-06-02 02:50:04 -07:00
test_info.plist Improve usb_devices on OSX 2014-12-10 01:17:24 -08:00
test_inline_pack.conf [fix #1390] query pack re-org 2015-09-02 10:56:26 -07:00
test_launchd.plist Improve usb_devices on OSX 2014-12-10 01:17:24 -08:00
test_modules.py Schedule monitoring, doc updates, logger plugin fixes 2015-05-03 11:54:15 -07:00
test_noninline_packs.conf [fix #1390] query pack re-org 2015-09-02 10:56:26 -07:00
test_osqueryd.py TLS plugin workflow tests 2015-05-26 19:55:00 -07:00
test_osqueryi.py Relax extensions and shell timeouts 2015-07-02 12:14:44 -07:00
test_pack.conf Pack and testing fixups 2015-05-28 12:17:27 -07:00
test_parse_items.conf [fix #1390] query pack re-org 2015-09-02 10:56:26 -07:00
test_protocols.txt Adding tests to the prototocols table 2015-04-22 17:49:27 -07:00
test_release.py Various additional tests and benchmarks 2015-07-28 12:26:17 -07:00
test_server_ca.pem Update testing x509 certs 2015-06-13 02:13:31 -07:00
test_server.key Update testing x509 certs 2015-06-13 02:13:31 -07:00
test_server.pem Update testing x509 certs 2015-06-13 02:13:31 -07:00
test_xattrs.txt Use LaunchServices (part of CoreServices) to grab quarantine properties instead of manually parsing the colon separated attribute data. 2015-06-03 22:18:45 -07:00
test.badconfig [Fix #1125 #1126] Flag padding checks, config_check tests 2015-05-11 10:37:16 -07:00
test.config [fix #1390] query pack re-org 2015-09-02 10:56:26 -07:00
test.cpp Updating the license comment to be the correct open source header 2014-12-18 10:52:55 -08:00
test.plist [Fix #1355] Allow plist keys with '.' 2015-07-19 16:24:43 -07:00
utils.py Fix profile platform bug in leaks checking 2015-07-20 02:06:52 -07:00