Commit Graph

53 Commits

Author SHA1 Message Date
Alessandro Gario
dab1a20582
libs: Update RocksDB to version 6.14.5 (#6759) 2020-11-21 17:41:16 +01:00
Teddy Reed
14804127d8
Reduce linkage requirements for tests (#6715) 2020-10-18 10:47:00 -04:00
Teddy Reed
5b8f20bfce
refactor: Move ephemeral database plugin into core and simplify tests (#6648) 2020-09-21 18:25:08 -04:00
Teddy Reed
d7d6c56473
database: Remove read only concept (#6637) 2020-09-10 19:58:38 -04:00
Teddy Reed
cb428e105e
Apply scheduler_timeout correctly (#6618) 2020-09-03 23:56:16 -04:00
Breakwell
6d57dc8066
Windows 32 bit Support (#6543) 2020-09-01 23:29:26 -04:00
Teddy Reed
b36678d707
refactor: Rename database APIs to not use DatabasePlugin class (#6620) 2020-08-31 22:45:43 -04:00
Teddy Reed
160ac6c906
refactor: Change the include path for osquery/core/plugins (#6619) 2020-08-29 20:24:39 -04:00
Teddy Reed
37fd74c2f4
bug: Fix buildup of RocksDB SST files (#6606) 2020-08-28 16:19:42 -04:00
seph
29f4694df2
Update copyright notices (#6589)
Bulk update copyright notices from Facebook to "The osquery authors"
2020-08-11 16:46:54 -04:00
Teddy Reed
8ee7e3a3b0
refactor: Move osquery/include files to appropriate places (#6557) 2020-08-11 11:54:54 -04:00
Ted Reed
5cd2d6cbd3 detangle: Move platform setup and teardown out of Initializer 2020-07-09 10:38:53 -04:00
analyzeDFIR
c197af9716
Fix for #5890: Event Format Results and the Kafka Logger (#6449) 2020-06-06 21:44:26 -04:00
herbmaster
ef65c779b1
Link librdkafka on windows (#6454) 2020-06-01 15:53:01 -04:00
Stefano Bonicatti
52f310a5a8
First steps to remove the Buck build system (#6361)
* First steps to remove the Buck build system

* Azure Pipelines: Rename jobs for consistency
2020-04-09 01:56:21 +02:00
Stefano Bonicatti
2e84e8cdf1
Fix parsing an invalid decorators config (#6317)
The "decorators" configuration value must be a JSON object,
otherwise we try to search through its inexistent members
and dereference a null pointer.

Added also a regression test.

Addresses https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19274
2020-03-20 08:39:08 -04:00
Nick Collier
09c5246823
Make AWS kinesis status logging configurable (#6135) 2020-03-15 21:04:03 -04:00
Ivan Tse
4a4d52dbce
Fix database_dump for rocksdb (#6272) 2020-03-07 07:50:43 -05:00
flappy-sh
d9faba2d9e
Build librdkafka on Windows (#6095) 2020-03-06 15:06:55 -05:00
seph
ae66d8f3bc
Add path to ATC generated specs (#6278)
Add the `path` column to the ATC generate specs. This matches the existing data, as it is already includes in the returned rows.
2020-03-01 08:42:21 -05:00
Stefano Bonicatti
36f9807b9c
Fix build without tests enabled (#6224) 2020-02-03 22:01:13 +01:00
Stefano Bonicatti
d0b42a98e2
Fix all TLS tests and framework (#6170) 2020-02-03 07:50:25 -08:00
Teddy Reed
fce0059c5e
config: Fix JSON format assumptions in file_paths parser (#6159) 2020-01-16 20:50:54 -05:00
Stefano Bonicatti
515704954c Move the test config files in their own directory
This is to have better separation between them and the python tests.
BUCK files have been updated accordingly.

Changes to the internal generateCopyFileTarget function were needed.
The function now supports a base folder to be set so that the regex or file path
is appended to that base path, without having it included in the destination.
It will also not use a library target anymore, but a custom one so
that's possible to set properties with custom names.

Use only one copy target to copy test config files instead of having
multiple that overlaps.
It may give issues when copying and tests in the end will need all of
them.
2019-12-07 20:51:09 -05:00
Teddy Reed
d52786d08c
parsers: Always apply the options parser first (#6050) 2019-11-19 00:23:15 -05:00
Teddy Reed
bf9a9ec567
config: Code review for ATC parser (#6029) 2019-11-12 18:46:18 -05:00
Stefano Bonicatti
e571f1aa5a Don't always link to all AWS libraries (#6032)
While in the end the osqueryd binary will require almost all libraries
built and linked, having each intermediate library depend on the whole
set of AWS libraries might result in higher compiling time.
Especially since on some platforms not all libraries are used.

This should speed up the compilation speed on Windows.
2019-11-11 09:52:21 -05:00
Teddy Reed
c964db2a49
logging: Change logNumericsAsNumbers to numerics and add docs (#6002)
This is an API change for the format of logged events.
The top-level log field "logNumericsAsNumbers" was introduced to help
migrate from string-encoded numerics to JSON numbers.

This change updates the field to be "numerics", updates the flag to
conform to flag naming conventions, and documents the expectation.
2019-11-09 13:29:14 -05:00
Teddy Reed
b0bf653745
powershell/config: Add checks for character_frequencies (#5945)
Co-Authored-By: Stefano Bonicatti <smjert@gmail.com>
2019-10-31 12:03:53 -04:00
Teddy Reed
04896c85cd
killswitch: Remove killswitch code (#5949)
This was determined to be the wrong approach to adding simple
killswitches. The intent was to quickly flip on/off features. It was
not widely adopted due to the dependencies killswitching has.

A different approach is to implement the same functions with something
simple like filesystem flags.
2019-10-29 19:14:35 -04:00
Teddy Reed
d373d04260
logger: Restore TLS logger runtime flags (#5962)
This is a follow up to #5956, which reverts the CLI_FLAG changes.
2019-10-29 00:43:06 -04:00
Teddy Reed
0c06658e45 logger: Expose max_lines and correct flag types (#5956)
Multiple flags are moved from FLAG to CLI_FLAG due to the way they are
implemented/used in code. If they were FLAG(s), meaning if they were
also configurable via configuration at runtime, the new values would
still be ignored.

These are:
  - logger_tls_endpoint
  - logger_tls_period
  - logger_tls_max

The flag logger_tls_max has been renamed to logger_tls_max_linesize and
an alias is added for compatibility.

A new flag is added, logger_tls_max_lines, to expose a previously
hardcoded value of 1024 for the maximum number of log lines to send
every period.
2019-10-28 10:19:50 +01:00
Teddy Reed
54859ace98
tests: Enable RocksDB plugin tests (#5832) 2019-09-27 08:26:53 -04:00
Teddy Reed
516c0e4563
rocksdb: Remove use of OptimizeForSmallDB in rocksdb plugin (#5797)
This fixes the crash in #5793.

The fix was attempted in a31d758 but it did not include the existing plugin implementation.
2019-09-12 13:22:56 -04:00
pawel-lmcb
1a4b277ce2 Fix optional AWS table compilation on Windows (#5719) 2019-09-06 13:19:29 -07:00
Alessandro Gario
6481b34e23
Refactor third-party libraries to build from source on Linux (#5706)
Add a way to compile third-party libraries from source instead of downloading prebuilt ones.
Each library source code is downloaded with git into a submodule at configure time,
in response to the find_package(library_name) CMake call,
except for OpenSSL where the official source archive is used.
Each submodule is attached to a release tag on its own upstream repository.
All the libraries are built using CMake directly, except for OpenSSL which uses a formula system,
which permits to build libraries with a separate build system
when there's no easy way to integrate it directly with CMake.

This new dependency system determines which library is fetched from where using the concept of "layers".
Currently we have three of them: source, formula, facebook,
where the last layer represents the pre-built libraries.
The provided order will be used when looking for libraries.

A system to patch submodule source code has been added and it's currently used with googletest, libudev and util-linux.
Patches should be put under libraries/cmake/source/<library name>/patches/<submodule>,
where <submodule> is often one and is "src", but in other cases, like AWS,
there are multiple with a more specific name.
If for whatever reason the submodule cloning or the patching fails,
the submodule has to be unregistered and its folder should be cleared.
This should be achievable with "git submodule deinit -f <submodule path>"

Following some other changes on existing functionality:

- Changed the CMake variable BUILD_TESTING to OSQUERY_BUILD_TESTS
  to avoid enabling tests on third party libraries.
  Due to an issue with glog the BUILD_TESTING variable
  will be always forced to OFF.
- Moved compiler and linker flags to their own file cmake/flags.cmake
- Moved all the third-party CMakeLists.txt used for pre-built libraries under libraries/cmake/facebook
- Added the --exclude-folders option to tools/format-check.py and tools/git-clang-format.py,
  so that it's possible to ignore any third party library source code.
- The format and format_check target use the new --exclude-folders option
  to exclude libraries/cmake/source from formatting.
- The test and osquery binaries are properly compiled with PIE (osquery/osquery#5611)

Co-authored-by: Stefano Bonicatti <stefano.bonicatti@gmail.com>
Co-authored-by: Teddy Reed <teddy@casualhacking.io>
2019-08-30 16:25:19 +02:00
anjalichandnani
ecf98560e1 Ensure views are recreated on startup. (#5732) 2019-08-29 10:03:03 -04:00
Stefano Bonicatti
db9f3f2ffe Fix undefined-behavior in TLSLoggerTests.test_database
Issue highlighted by asan activated in PR osquery/osquery#5628

StatusLogLine needs to be initialized before using it.

PR: osquery/osquery#5665
2019-08-16 16:47:18 +02:00
Matteo Piano
880f003a09 allow mounting SQLite DBs using WAL journaling with ATC 2019-07-17 10:12:48 -07:00
Stefano Bonicatti
942878854b Add CMake support
Taken from osql-experimental.

- Change CMake code license to the one present in osquery right now

- Package metadata doesn't mention Trail of Bits or osql anymore

- Set specific ACLs for the osqueryd on Windows when packaging

- Remove LLVM_INSTALL_PATH support on macOS, since we are using AppleClang

- Remove OSQUERY_SOURCE_DIR variable need and source in a submodule support

- Add targets format_check and format to check code formatting and
  format it with clang-format

- Do not warn about not using Clang on macOS when using AppleClang
2019-06-26 21:49:06 -04:00
Alexander Kindyakov
606d54ffc5 Remove the rest use cases of createError with message as an arg (#5524)
Summary:
Pull Request resolved: https://github.com/facebook/osquery/pull/5524

So let's get rid of the rest usecases of createError with message as an argument in order to remove it completely.

Reviewed By: jessek

Differential Revision: D14437933

fbshipit-source-id: acfb1a2a2a79e03d7cb650b305ee8ad3b6218d2a
2019-03-13 11:36:21 -07:00
Jeremy Calvert
c8bb439442 OSQueryd changes for encoding type in JSON syntax
Summary:
Add log_numerics_as_numbers flag.

Internal SQLite query has method that returns QueryDataTyped (instead of QueryData), which are boost::variant<string, double, long long>.

Ints are encoded as such if and only if new log_numerics_as_numbers flag is set to true.

Reviewed By: fmanco

Differential Revision: D13778323

fbshipit-source-id: 7d7bb31781486f63fcc088cd479d3b6f255a5cb4
2019-03-04 09:15:21 -08:00
Filipe Manco
c2019aa648 Move plugins to a separate directory [6/?] (#5485)
Summary:
Pull Request resolved: https://github.com/facebook/osquery/pull/5485

Initial steps to separate plugins from the rest of osquery. On the long run separating plugins will provide more build flexibility such that we can have configurable builds that include only the bits and pieces we actually ne
er deployment. Reducing the attack surface, possibility of supply chain attacks, binary size, etc.

Move numeric monitoring

Reviewed By: guliashvili

Differential Revision: D14259758

fbshipit-source-id: 1016fc28a0052417d658b6ce1cb3368e56597a7b
2019-03-02 04:23:06 -08:00
Filipe Manco
d14fd5d538 Move plugins to a separate directory [5/?] (#5483)
Summary:
Pull Request resolved: https://github.com/facebook/osquery/pull/5483

Initial steps to separate plugins from the rest of osquery. On the long run separating plugins will provide more build flexibility such that we can have configurable builds that include only the bits and pieces we actually need per deployment. Reducing the attack surface, possibility of supply chain attacks, binary size, etc.

Move killswitch

Reviewed By: guliashvili

Differential Revision: D14259760

fbshipit-source-id: deaaa148fac25b3f534a8881a1ea9eda0ec6bdc9
2019-03-02 04:23:06 -08:00
Alexander Kindyakov
e7ae02c572 remove 'update' config plugin from config package and move it to oss/plugins (#5474)
Summary:
Pull Request resolved: https://github.com/facebook/osquery/pull/5474

To be able to exclude config:update plugin from osquery plugin sdk.

Reviewed By: guliashvili

Differential Revision: D14241686

fbshipit-source-id: e378718b1e79e3dbe314a676945c18d15d054a3d
2019-02-27 08:32:19 -08:00
Alexander Kindyakov
2b808e3296 Move out to plugins/ registration of enroll:tls plugin in registry (#5473)
Summary:
Pull Request resolved: https://github.com/facebook/osquery/pull/5473

to be able to exclude dependency on enroll:tls plugin from plugins_sdk.
Only plugin registration was moved by now. The actual plugin code will be moved a bit later.

Reviewed By: guliashvili

Differential Revision: D14241687

fbshipit-source-id: 814d52719ff27bd1283bcaecdc912fca3830ff5e
2019-02-27 08:32:19 -08:00
Alexander Kindyakov
cf743f77b7 New cli flag [tls_enroll_max_attempts] instead of reusing [config_tls_max_attempts] (#5472)
Summary:
Pull Request resolved: https://github.com/facebook/osquery/pull/5472

To get rid of dependency on `plugins/config:tls_config` from `osquery/remote/enroll/tls_enroll`.
To be able to remove dependency on `plugins/config:tls_config` from plugins_sdk.

Reviewed By: guliashvili

Differential Revision: D14241685

fbshipit-source-id: 27cda0be9d0b6dc142374cc3a9e7c40a4fa97b94
2019-02-27 08:32:19 -08:00
Alexander Kindyakov
b7d635ec2b remove thrift_impl from osquery plugin_sdk
Summary: To be able to build with different `thrift_impl` modules in extensions (like facebook does with fbthrift) I removed implementation from `extensions` lib and explicitly used for `osqueryd` and for all tests. This allows us to remove `thrift_impl` from sdk dependencies list. If you need it - please use explicitly as I did for `osqueryd`. If you want to use your own implementation of `thrift_impl` - build it and link against it and sdk simultaneously.

Reviewed By: marekcirkos

Differential Revision: D14224206

fbshipit-source-id: 218dc05d87e1ffaca37783185fc672a20684d757
2019-02-26 11:20:08 -08:00
Jesse Kornblum
c7355b19aa Update osquery licensing wording (#5452)
Summary:
Pull Request resolved: https://github.com/facebook/osquery/pull/5452

As suggested in another diff, this diff updates the language we use to describe the osquery licensing terms. We are changing all instances of

//This source code is licensed as defined on the LICENSE file found in the root directory of this source tree.//

to

//This source code is licensed in accordance with the terms specified in the LICENSE file found in the root directory of this source tree.//

We accomplish this with a codemod:

  $ codemod -md xplat/osquery/oss --extensions cpp,h,in,py,sh,mm,ps1 "(.\s+)This source code is licensed as defined on the LICENSE file found in the(.*)root directory of this source tree\." "\1This source code is licensed in accordance with the terms specified in\2the LICENSE file found in the root directory of this source tree."

Reviewed By: fmanco

Differential Revision: D14131290

fbshipit-source-id: 52c90da342263e2a80f5a678ecd760c19cf7513e
2019-02-19 10:59:48 -08:00
Filipe Manco
484520e1ff Move plugins to a separate directory [4/?] (#5449)
Summary:
Pull Request resolved: https://github.com/facebook/osquery/pull/5449

Initial steps to separate plugins from the rest of osquery. On the long run separating plugins will provide more build flexibility such that we can have configurable builds that include only the bits and pieces we actually need per deployment. Reducing the attack surface, possibility of supply chain attacks, binary size, etc.

Move killswitch

Move test declaration to it's own BUCK file for consistency with the rest of the project.

Reviewed By: marekcirkos

Differential Revision: D14121618

fbshipit-source-id: 3e30e57befed4387585ed553ec087fdf8db6efc3
2019-02-19 07:14:37 -08:00