Commit Graph

1189 Commits

Author SHA1 Message Date
Tom Ritter
2acf0b9177 Add a fuzz target for SQL query (#5923) 2019-10-27 10:20:44 -04:00
Tom Ritter
f637199511 Add scripts to generate a dictionary and seed corpus for the config fuzzing (#5915) 2019-10-27 10:20:15 -04:00
Alessandro Gario
41fb4efba1
CMake: Migrate macOS and Windows to the OpenSSL formula (#5928) 2019-10-26 14:03:31 +02:00
Teddy Reed
5ff42eccb6
packaging: Fix up make_linux_package to work for version 4+ (#5825) 2019-10-20 11:54:42 -04:00
kumarak
9346926030 Restore extension SDK support to osquery 4.x (#5851)
CMake utility functions(generateOsqueryExtensionGroup,addOsqueryExtensioni{Ex},
addOsqueryModule) to add extensions.

Updates the boost library submodules needed for extensions build.

Use cache variable(OSQUERY_EXTENSION_GROUP_NAME) for the grouping of extensions
and fix the linkage with osquery interface library.
2019-10-18 18:45:20 -04:00
Stefano Bonicatti
974bdef901 Various fixes and CI steps for packaging (#5881)
* Fix packaging regression on Windows

Component variables should be set only for Linux and macOS,
otherwise on Windows the internal WiX IDs change and the
WiX fragment patch won't work.

Cleanup the version patch component, since WiX doesn't support
version components that are not digits.

* Add the rpm package to the CI Dockerfile, to test rpm packaging

* Fix TGZ generation on other platforms

* Add dpkg-dev and file packages to the CI Dockerfile

They are needed for creating DEB debug packages.

* Add a packaging steps to the CI

Set TGZ as a default packaging system when one cannot detected.

Fix generatePackageTarget indentation.
2019-10-13 12:53:16 +02:00
Alessandro Gario
225bbaf992
Integrate cppcheck and clang-tidy within the CMake project (#5730) 2019-10-08 18:17:11 +02:00
Stefano Bonicatti
fdd2272148 Provide CI Dockerfile and some fake packages (#5855)
Since normally the tests are run on a more complete VM or physical host,
we create fake empty packages to install so that
the test DebPackages.test_sanity doesn't fail.
2019-10-07 16:26:43 +02:00
adhamehab
657932cd2c Upgrade Python tools to Python3 (#5846) 2019-10-05 10:30:10 -04:00
William Woodruff
a9b23807b2 darwin/firewall: Fixes for alf_exceptions, make alf_services an alias for sharing_preferences (#5378) 2019-10-04 15:42:10 -04:00
grrrrrrrrrr
31e6dfdfeb Fix make rpm script to not break because of symlinks (#5780)
Signed-off-by: grant <grantseltzer@gmail.com>
2019-09-26 07:32:21 -04:00
Stefano Bonicatti
dd575f93f4 Add a test for the format_check script (#5835)
The test modifies the source code, appending "\n\n" at the end of each .cpp files.

Then runs the format_check target and verifies if the list of files to be formatted,
identified by the script, are the same ones previously modified.
2019-09-25 23:35:43 -04:00
Teddy Reed
e5599c01f3
packaging: Fix up make_osx_package to work for version 4+ (#5827) 2019-09-25 23:00:01 -04:00
Teddy Reed
9134c7a6d1
format: Fix auto-formatting and format checking (#5830) 2019-09-23 17:32:06 -04:00
Teddy Reed
bbec01d5fa
Revert "Remove deprecated macOS package generator (#5808)" (#5821)
This reverts commit 54289cd3d4.
2019-09-21 19:02:38 -04:00
Alessandro Gario
54289cd3d4
Remove deprecated macOS package generator (#5808) 2019-09-16 17:03:36 +02:00
Stefano Bonicatti
57f9916473 Patch environment file path in initd and systemd scripts during DEB packaging (#5802)
Also add a check to systemd script to create and empty config file,
if this is missing.

Co-authored-by: seph <seph@directionless.org>
2019-09-12 18:02:23 -04:00
Nick Anderson
11d3ff476a deploy: updating msi build script (#5794)
Summary: This adds a few minor updates to the MSI build function. First
it keeps build artifacts located in `build/msi` for ease of access.
Further it updates component referneces to be x64 compatible. Finally it
updates a few path references to reflect the new repo layout, as well as
changes a few references for author and ownership information to be
osquery.

Test Plan: Will update with sample MSI builds for Cmake.
2019-09-12 13:13:17 -04:00
seph
83a9ecfad8 Fix the website download link schemas
We use this tool to generate a PR to the website. However, the download links are broken. This is because they need `platform` and not `url`. I don't know the history of the change here, but empirically we need it.

Relates to:
* https://github.com/osquery/osquery-site/pull/88
* https://github.com/osquery/osquery-site/pull/148
2019-09-11 14:18:53 -04:00
Nick Anderson
492fb79390
deploy: update windows choco scripts to migrate service to Program Files (#5790) 2019-09-11 08:24:17 -07:00
Alessandro Gario
15ddbfb472
Buck: Update version to 4.0.1 (#5786) 2019-09-10 03:13:44 +02:00
Teddy Reed
f4bd3e1630
deployment: Add Mozilla CA certificate store 2019-08-28 (#5773)
* deployment: Add Mozilla CA certificate store 2019-08-28

This is the cacerts file that was once proviced by the OpenSSL Homebrew
formula. The osquery packages in 3.x and previous provided this store as
the default / fallback.

The hash can be corroborated via:
https://curl.haxx.se/ca/cacert.pem.sha256

38b6230aa4bee062cd34ee0ff6da173250899642b1937fc130896290b6bd91e3

* install certs.pem directly from source
2019-09-08 17:42:01 -04:00
Mike Myers
9b1c1d58f9 Fix bugs and update pathname variables in MSI package build script (#5733) 2019-09-04 08:08:55 -04: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
Nick Anderson
1af15ed4f3 packaging: updating packaging script to support Buck binary output (#5647) 2019-08-19 17:39:29 -04:00
Teddy Reed
dc5e13c3d2 deps: Remove old provisioning scripts 2019-08-08 11:37:09 +02:00
Alessandro Gario
4581ec42ce Remove deprecated build tools 2019-08-04 22:21:38 +02:00
Stefano Bonicatti
9cf33c84f8 Restore AugeasTests test
PR: osquery/osquery#5629
2019-07-19 22:36:40 +02:00
seph
54f967a528
Change MSI Service Error handling (#5467)
The Wix configuration sets the service as _critical_. As I understand it, this means failures to start osquery, are considered startup failures, and will trigger a reboot. As there are occasional windows bugs causing a failure to start, this seems unfortunate. I think hit someone on slack today 

This PR changes that to _normal_

Docs are http://wixtoolset.org/documentation/manual/v3/xsd/wix/serviceinstall.html
2019-07-19 09:51:41 -07:00
Nick Anderson
4eede7b00b
buck: fixing up buck config generation script for use on Windows (#5623) 2019-07-05 15:49:47 -07:00
Gustavo Grieco
b4bbcd274a Improve the downloader.py script to use urllib2 (#5612)
* Improve the downloader.py script to use urllib2

This will allow to automatically handle URL re-directions (e.g. 302)

* Better exception handling
2019-06-29 02:28:12 +02: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
Alessandro Gario
33fbbecb5f Initial commit
Taken from osql-experimental.

Initial support for Linux and macOS.
2019-06-26 21:49:06 -04:00
Teddy Reed
597a0c613d buck: Remove quotes from project/buck_out config 2019-06-25 08:49:11 -04:00
Teddy Reed
c2451f3383
release: prepping for osquery 3.4.0 release on Windows
Please see #5590
2019-06-21 17:25:34 -04:00
Nick Anderson
214302bdeb
windows: updating more references to osquery installation path (#5580) 2019-06-05 12:45:40 -07:00
Nick Anderson
46b9c8f800
deploy: updating MSI package to install to Program Files (#5579) 2019-06-05 09:46:41 -07:00
Nick Anderson
c10914f199
deployment: updating osquery installation path to reside in Program Files (#5568) 2019-05-17 10:03:37 -07:00
Michael Lee
65c9c9b9ac Switch to the more common form
Summary:
Iterating through a string is no longer allowed, and `range(0, len(_))` and `range(len(_))`
are equivalent. Switch to the shorter, more commonly used form

Reviewrs: #sentinel

Reviewed By: philipjameson

Differential Revision: D14657008

fbshipit-source-id: 1aabcbf168896bd0ee64b0d4eb17a72d6863aab2
2019-03-28 19:39:30 -07:00
Alexander Kindyakov
76cc3eaf66 Mute signed-unsigned comparison warning for tests on macosx
Summary: Right now it blocks us, because build on macox doesn't work. Fix will take some time - lots of changes. But on the other hand value of such change in tests is nearly zero. So, let's just mute it.

Reviewed By: guliashvili

Differential Revision: D14597262

fbshipit-source-id: adaacc003f49647e255001bb84cc0e71273cd486
2019-03-25 09:28:27 -07:00
Alexander Kindyakov
7e8f5536e6 Force buck to produce short file paths on windows (#5528)
Summary:
Pull Request resolved: https://github.com/facebook/osquery/pull/5528

by using config option `cxx.filepath_length_limited=true`. Because unfortunately there is very low limit for file path length on windows up to win10 (260 chars).

Reviewed By: KapJI

Differential Revision: D14460635

fbshipit-source-id: f63fc564766b49c2d4fb5f1c2bb7015592ab17e1
2019-03-14 10:55:41 -07:00
Filipe Manco
0166d04805 Move python configuration to the toolchain bcfg for Windows
Summary: Having two configuration files makes it harder to manage system.py so move this to the same file and to the toolchain generation script. This will allow us to automatically determine toolchain path as well in the future.

Reviewed By: marekcirkos

Differential Revision: D14425055

fbshipit-source-id: fdc017f2cc55a2efbb33cdf17df64df620eb11b8
2019-03-13 05:39:11 -07:00
Alexander Kindyakov
8a3c498f33 Add windows system OLE library to osquery windows buckconfig (#5490)
Summary:
Pull Request resolved: https://github.com/facebook/osquery/pull/5490

We use functionality of this libraries, how did it work before?

Reviewed By: guliashvili

Differential Revision: D14280974

fbshipit-source-id: c3b0c2d8d570680460cdc5bbe80efc24467bcb93
2019-03-01 10:18:29 -08:00
Filipe Manco
aaa94770b0 Add osqueryd buck alias
Summary: You can now build with `buck build @<mode> osqueryd` for both internal and external build. Also changed NBTD to make use of this.

Reviewed By: marekcirkos

Differential Revision: D14279886

fbshipit-source-id: 1b61bdf254b3d980388e2f23384101c91bf51b20
2019-03-01 08:50:48 -08:00
Filipe Manco
bc35638678 Define osquery version on base.cfg (#5478)
Summary:
Pull Request resolved: https://github.com/facebook/osquery/pull/5478

This makes it easier to update the osquery version and simplifies cxx.bzl by removing osquery specific preprocessor flags.

This will also make rebuilding osquery after changing versions faster, since the flags are now only defined for the headers which need them.

Reviewed By: akindyakov

Differential Revision: D14183142

fbshipit-source-id: 396d550f5b35a1d294fee802d2364cd9f7ab1d7a
2019-02-27 11:23:03 -08:00
Filipe Manco
53626785a2 Pass kwargs to osquery_tp_prebuilt_cxx_library (#5469)
Summary:
Pull Request resolved: https://github.com/facebook/osquery/pull/5469

This way we can specify extra arguments that are going to be added to the library, like exported_preprocessor_flags which is required by some libraries.

Reviewed By: marekcirkos, akindyakov

Differential Revision: D14220787

fbshipit-source-id: 652954e297e49147dfc9f77db8181e2c0e9e123f
2019-02-26 07:59:14 -08:00
Alexander Kindyakov
c44067f788 Frank approach to build fbcode/fb_osquery with dependency to xplat/osquery
Summary:
We need to be able to build `fbcode` projects with dependencies to `fbsource/xplat/osquery/oss/sdk:plugin_sdk`. As far as osquery is a part of `fbsource` now it would be very useful to build against it, make a tests. Which will helps us a lot to develop faster, will unblock us to run tests for every change either to `xplat/osquery` and to `fbcode`, which going to prevent code from bugs and interface breaking (which happens now too often).

`osquery` is very platform dependent project, because it built internally at least for 4 OS: `linux`, `freebsd`, `windows`, `darwin`. `osquery` has its own third-party libraries located in `fbsource/xplat/osquery/third-party`.

Also we have internal osquery extension (`fb_osquery`) in `fbcode` built with strong dependency to `osquery` and with lots of dependencies to `fbcode` projects (e.g. scribe, GK, ODS, configurator, serivicerouter and more).

We could not build `fb_osquery` directly against `osquery` because build system restrictions and third-party dependencies collision.

  - Add necessary for `fb_osquery` parts of `fbsource/xpat/osquery` to xplat whitelist.
  - Make it possible to use `fbcode` `cpp_library` target definition for `fbsource/xplat/osquery` targets when they are used for `fbcode` build.
  - Make a translation platform dependant osquery targets for fbcode platform independent build.
  - Use `fbcode/tp` libs instead of `fbsource/xplat/osquery/tp` in case of `fbcode` build.

Differential Revision: D13991062

fbshipit-source-id: 1294825f1c5f991bd465e0e299b8e5ff67bbc543
2019-02-22 05:46:01 -08:00
Marek Cirkos
a1246af406 Revert part of D13903315
Summary: This was patched with D13767582 and is already deployed

Reviewed By: mkareta

Differential Revision: D14124516

fbshipit-source-id: 30679472458f4ed9647adc117db4352b940cf1cf
2019-02-20 01:59:23 -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
Jesse Kornblum
56d552d2a4 Add Facebook copyright header to bzl files (#5451)
Summary:
Pull Request resolved: https://github.com/facebook/osquery/pull/5451

This diff adds a Facebook copyright header to the bzl files used in osquery. Ultimately we want to update the files in `tools/build_defs/oss/osquery/`, but those are generated files. This diff updates the source files which we use to generate those files.

Reviewed By: fmanco

Differential Revision: D14131483

fbshipit-source-id: 2230dc382c26530ccd0909882fe6193ee7c674fb
2019-02-19 09:29:31 -08:00