Merge remote-tracking branch 'upstream/master' into staging-base
Conflicts: pkgs/build-support/cc-wrapper/default.nix pkgs/build-support/gcc-wrapper-old/builder.sh pkgs/build-support/trivial-builders.nix pkgs/desktops/kde-4.14/kde-package/default.nix pkgs/development/compilers/openjdk-darwin/8.nix pkgs/development/compilers/openjdk-darwin/default.nix pkgs/development/compilers/openjdk/7.nix pkgs/development/compilers/openjdk/8.nix pkgs/development/compilers/oraclejdk/jdk-linux-base.nix pkgs/development/compilers/zulu/default.nix pkgs/development/haskell-modules/generic-builder.nix pkgs/misc/misc.nix pkgs/stdenv/generic/builder.sh pkgs/stdenv/generic/setup.sh
This commit is contained in:
@@ -1,25 +1,44 @@
|
||||
{ stdenv, fetchFromGitHub, pythonPackages }:
|
||||
|
||||
let honcho = pythonPackages.buildPythonApplication rec {
|
||||
name = "honcho-${version}";
|
||||
version = "0.6.6";
|
||||
let
|
||||
inherit (pythonPackages) python;
|
||||
pname = "honcho";
|
||||
|
||||
in
|
||||
|
||||
pythonPackages.buildPythonApplication rec {
|
||||
name = "${pname}-${version}";
|
||||
version = "1.0.1";
|
||||
namePrefix = "";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "nickstenning";
|
||||
repo = "honcho";
|
||||
rev = "v${version}";
|
||||
sha256 = "0lawwcyrrsd9z9jcr94qn1yabl9bzc529jkpc51jq720fhdlfcr0";
|
||||
sha256 = "11bd87474qpif20xdcn0ra1idj5k16ka51i658wfpxwc6nzsn92b";
|
||||
};
|
||||
|
||||
buildInputs = with pythonPackages; [ nose mock jinja2 ];
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
nosetests
|
||||
runHook postCheck
|
||||
buildInputs = with pythonPackages; [ jinja2 pytest mock coverage ];
|
||||
|
||||
buildPhase = ''
|
||||
${python.interpreter} setup.py build
|
||||
'';
|
||||
|
||||
doCheck = false;
|
||||
installPhase = ''
|
||||
mkdir -p "$out/lib/${python.libPrefix}/site-packages"
|
||||
|
||||
export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
|
||||
|
||||
${python}/bin/${python.executable} setup.py install \
|
||||
--install-lib=$out/lib/${python.libPrefix}/site-packages \
|
||||
--prefix="$out"
|
||||
'';
|
||||
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
PATH=$out/bin:$PATH coverage run -m pytest
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "A Python clone of Foreman, a tool for managing Procfile-based applications";
|
||||
@@ -28,11 +47,4 @@ let honcho = pythonPackages.buildPythonApplication rec {
|
||||
maintainers = with maintainers; [ benley ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
# Some of honcho's tests require that honcho be installed in the environment in
|
||||
# order to work. This is a trick to build it without running tests, then pass
|
||||
# it to itself as a buildInput so the tests work.
|
||||
honcho.overrideDerivation (x: { buildInputs = [ honcho ]; doCheck = true; })
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
{ stdenv, lib, fetchFromGitHub, pkgconfig, cmake, pythonPackages
|
||||
, udev, audit, aws-sdk-cpp, cryptsetup, lvm2, libgcrypt, libarchive
|
||||
, libgpgerror, libuuid, iptables, apt, dpkg, lzma, lz4, bzip2, rpm
|
||||
, beecrypt, augeas, libxml2, sleuthkit, yara, lldpd, google-gflags
|
||||
, thrift, boost, rocksdb_lite, cpp-netlib, glog, gbenchmark, snappy
|
||||
, openssl, linenoise-ng, file, doxygen, devicemapper
|
||||
, gtest, sqlite
|
||||
}:
|
||||
|
||||
let
|
||||
thirdparty = fetchFromGitHub {
|
||||
owner = "osquery";
|
||||
repo = "third-party";
|
||||
rev = "6919841175b2c9cb2dee8986e0cfe49191ecb868";
|
||||
sha256 = "1kjxrky586jd1b2z1vs9cm7x1dxw51cizpys9kddiarapc2ih65j";
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "osquery-${version}";
|
||||
version = "2.5.2";
|
||||
|
||||
# this is what `osquery --help` will show as the version.
|
||||
OSQUERY_BUILD_VERSION = version;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "facebook";
|
||||
repo = "osquery";
|
||||
rev = version;
|
||||
sha256 = "16isplk66qpvhrf041l0lxb4z6k7wwd1sg7kpsw2q6kivkxpnk3z";
|
||||
};
|
||||
|
||||
patches = [ ./misc.patch ] ++ lib.optional stdenv.isLinux ./platform-nixos.patch;
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkgconfig cmake pythonPackages.python pythonPackages.jinja2
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
udev audit
|
||||
|
||||
(aws-sdk-cpp.override {
|
||||
apis = [ "firehose" "kinesis" "sts" ];
|
||||
customMemoryManagement = false;
|
||||
})
|
||||
|
||||
lvm2 libgcrypt libarchive libgpgerror libuuid iptables.dev apt dpkg
|
||||
lzma lz4 bzip2 rpm beecrypt augeas libxml2 sleuthkit
|
||||
yara lldpd google-gflags thrift boost
|
||||
cpp-netlib glog gbenchmark snappy openssl linenoise-ng
|
||||
file doxygen devicemapper cryptsetup
|
||||
gtest sqlite
|
||||
|
||||
# need to be consistent about the malloc implementation
|
||||
(rocksdb_lite.override { jemalloc = null; gperftools = null; })
|
||||
];
|
||||
|
||||
preConfigure = ''
|
||||
export NIX_CFLAGS_COMPILE="-I${libxml2.dev}/include/libxml2 $NIX_CFLAGS_COMPILE"
|
||||
|
||||
cmakeFlagsArray+=(
|
||||
-DCMAKE_LIBRARY_PATH=${cryptsetup}/lib
|
||||
-DCMAKE_VERBOSE_MAKEFILE=OFF
|
||||
)
|
||||
|
||||
cp -r ${thirdparty}/* third-party
|
||||
chmod +w -R third-party
|
||||
rm -r third-party/{googletest,sqlite3}
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "SQL powered operating system instrumentation, monitoring, and analytics";
|
||||
homepage = "https://osquery.io/";
|
||||
license = licenses.bsd3;
|
||||
platforms = platforms.linux;
|
||||
maintainers = with maintainers; [ cstrahan ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index a976a46d..408ac308 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -125,14 +125,13 @@ else()
|
||||
set(CXX_COMPILE_FLAGS "${CXX_COMPILE_FLAGS} -std=c++14 -stdlib=libc++")
|
||||
else()
|
||||
set(LINUX TRUE)
|
||||
- set(CXX_COMPILE_FLAGS "${CXX_COMPILE_FLAGS} -std=c++14 -stdlib=libstdc++")
|
||||
+ set(CXX_COMPILE_FLAGS "${CXX_COMPILE_FLAGS} -std=c++14")
|
||||
endif()
|
||||
set(POSIX TRUE)
|
||||
endif()
|
||||
|
||||
if(POSIX)
|
||||
add_compile_options(
|
||||
- -Qunused-arguments
|
||||
-Wstrict-aliasing
|
||||
-Wno-missing-field-initializers
|
||||
-Wno-unused-local-typedef
|
||||
@@ -154,7 +153,6 @@ if(POSIX)
|
||||
)
|
||||
if(NOT FREEBSD)
|
||||
add_compile_options(
|
||||
- -Werror=shadow
|
||||
-fvisibility=hidden
|
||||
-fvisibility-inlines-hidden
|
||||
)
|
||||
@@ -372,12 +370,6 @@ elseif(NOT FREEBSD)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
-if(NOT IS_DIRECTORY "${CMAKE_SOURCE_DIR}/third-party/sqlite3")
|
||||
- WARNING_LOG("Cannot find git submodule third-party/sqlite3 directory")
|
||||
- WARNING_LOG("Please run: make deps or git submodule update --init")
|
||||
- message(FATAL_ERROR "No sqlite3 directory")
|
||||
-endif()
|
||||
-
|
||||
# Make sure deps were built before compiling (else show warning).
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_SOURCE_DIR}/tools/provision.sh" check "${CMAKE_BINARY_DIR}"
|
||||
@@ -439,6 +431,8 @@ endif()
|
||||
|
||||
if(APPLE)
|
||||
LOG_PLATFORM("OS X")
|
||||
+elseif(OSQUERY_BUILD_PLATFORM STREQUAL "nixos")
|
||||
+ LOG_PLATFORM("NixOS")
|
||||
elseif(OSQUERY_BUILD_PLATFORM STREQUAL "debian")
|
||||
LOG_PLATFORM("Debian")
|
||||
elseif(OSQUERY_BUILD_PLATFORM STREQUAL "ubuntu")
|
||||
@@ -477,7 +471,6 @@ if(POSIX)
|
||||
include_directories("${BUILD_DEPS}/include/openssl")
|
||||
endif()
|
||||
|
||||
-include_directories("${CMAKE_SOURCE_DIR}/third-party/sqlite3")
|
||||
include_directories("${CMAKE_SOURCE_DIR}/include")
|
||||
include_directories("${CMAKE_SOURCE_DIR}")
|
||||
|
||||
@@ -559,21 +552,10 @@ else()
|
||||
set(GTEST_FLAGS "-DGTEST_USE_OWN_TR1_TUPLE=0")
|
||||
endif()
|
||||
|
||||
-set(GTEST_FLAGS
|
||||
- ${GTEST_FLAGS}
|
||||
- "-I${CMAKE_SOURCE_DIR}/third-party/googletest/googletest/include"
|
||||
- "-I${CMAKE_SOURCE_DIR}/third-party/googletest/googlemock/include"
|
||||
-)
|
||||
-join("${GTEST_FLAGS}" " " GTEST_FLAGS)
|
||||
-
|
||||
set(BUILD_GTEST TRUE)
|
||||
|
||||
-add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/googletest")
|
||||
-
|
||||
include(Thrift)
|
||||
|
||||
-add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/sqlite3")
|
||||
-
|
||||
add_subdirectory(osquery)
|
||||
add_subdirectory(tools/tests)
|
||||
|
||||
diff --git a/include/osquery/core.h b/include/osquery/core.h
|
||||
index b597edee..b0628037 100644
|
||||
--- a/include/osquery/core.h
|
||||
+++ b/include/osquery/core.h
|
||||
@@ -15,8 +15,9 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
-#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__linux__)
|
||||
#include <boost/thread/shared_mutex.hpp>
|
||||
+#include <boost/thread/recursive_mutex.hpp>
|
||||
#else
|
||||
#include <shared_mutex>
|
||||
#endif
|
||||
@@ -188,7 +189,7 @@ inline bool isPlatform(PlatformType a, const PlatformType& t = kPlatformType) {
|
||||
return (static_cast<int>(t) & static_cast<int>(a)) != 0;
|
||||
}
|
||||
|
||||
-#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__linux__)
|
||||
#define MUTEX_IMPL boost
|
||||
#else
|
||||
#define MUTEX_IMPL std
|
||||
@@ -204,10 +205,10 @@ using WriteLock = MUTEX_IMPL::unique_lock<Mutex>;
|
||||
using ReadLock = MUTEX_IMPL::shared_lock<Mutex>;
|
||||
|
||||
/// Helper alias for defining recursive mutexes.
|
||||
-using RecursiveMutex = std::recursive_mutex;
|
||||
+using RecursiveMutex = MUTEX_IMPL::recursive_mutex;
|
||||
|
||||
/// Helper alias for write locking a recursive mutex.
|
||||
-using RecursiveLock = std::lock_guard<std::recursive_mutex>;
|
||||
+using RecursiveLock = MUTEX_IMPL::lock_guard<MUTEX_IMPL::recursive_mutex>;
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/osquery/CMakeLists.txt b/osquery/CMakeLists.txt
|
||||
index 77913d31..671b20d4 100644
|
||||
--- a/osquery/CMakeLists.txt
|
||||
+++ b/osquery/CMakeLists.txt
|
||||
@@ -57,7 +57,7 @@ endif()
|
||||
|
||||
# Construct a set of all object files, starting with third-party and all
|
||||
# of the osquery core objects (sources from ADD_CORE_LIBRARY macros).
|
||||
-set(OSQUERY_OBJECTS $<TARGET_OBJECTS:osquery_sqlite>)
|
||||
+set(OSQUERY_OBJECTS "")
|
||||
|
||||
# Add subdirectories
|
||||
add_subdirectory(config)
|
||||
@@ -138,6 +138,8 @@ elseif(FREEBSD)
|
||||
ADD_OSQUERY_LINK_ADDITIONAL("rocksdb-lite")
|
||||
endif()
|
||||
|
||||
+ADD_OSQUERY_LINK_CORE("sqlite3")
|
||||
+
|
||||
if(POSIX)
|
||||
ADD_OSQUERY_LINK_CORE("boost_system")
|
||||
ADD_OSQUERY_LINK_CORE("boost_filesystem")
|
||||
@@ -157,6 +159,7 @@ ADD_OSQUERY_LINK_ADDITIONAL("cppnetlib-client-connections${WO_KEY}")
|
||||
ADD_OSQUERY_LINK_CORE("glog${WO_KEY}")
|
||||
|
||||
if(POSIX)
|
||||
+ ADD_OSQUERY_LINK_ADDITIONAL("benchmark")
|
||||
ADD_OSQUERY_LINK_ADDITIONAL("snappy")
|
||||
ADD_OSQUERY_LINK_ADDITIONAL("ssl")
|
||||
ADD_OSQUERY_LINK_ADDITIONAL("crypto")
|
||||
@@ -336,13 +339,6 @@ if(NOT OSQUERY_BUILD_SDK_ONLY)
|
||||
|
||||
install(DIRECTORY "${CMAKE_SOURCE_DIR}/packs/"
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/osquery/packs" COMPONENT main)
|
||||
- if(APPLE)
|
||||
- install(FILES "${CMAKE_SOURCE_DIR}/tools/deployment/com.facebook.osqueryd.plist"
|
||||
- DESTINATION "${CMAKE_INSTALL_PREFIX}/share/osquery/" COMPONENT main)
|
||||
- else()
|
||||
- install(PROGRAMS "${CMAKE_SOURCE_DIR}/tools/deployment/osqueryd.initd"
|
||||
- DESTINATION "/etc/init.d/" RENAME "osqueryd" COMPONENT main)
|
||||
- endif()
|
||||
endif()
|
||||
|
||||
if(NOT SKIP_TESTS)
|
||||
diff --git a/osquery/tables/system/linux/tests/md_tables_tests.cpp b/osquery/tables/system/linux/tests/md_tables_tests.cpp
|
||||
index 126be362..119d361d 100644
|
||||
--- a/osquery/tables/system/linux/tests/md_tables_tests.cpp
|
||||
+++ b/osquery/tables/system/linux/tests/md_tables_tests.cpp
|
||||
@@ -72,7 +72,7 @@ void GetDrivesForArrayTestHarness(std::string arrayName,
|
||||
EXPECT_CALL(md, getArrayInfo(arrayDevPath, _))
|
||||
.WillOnce(DoAll(SetArgReferee<1>(arrayInfo), Return(true)));
|
||||
|
||||
- Sequence::Sequence s1;
|
||||
+ Sequence s1;
|
||||
for (int i = 0; i < MD_SB_DISKS; i++) {
|
||||
mdu_disk_info_t diskInfo;
|
||||
diskInfo.number = i;
|
||||
diff --git a/specs/windows/services.table b/specs/windows/services.table
|
||||
index 4ac24ee9..657d8b99 100644
|
||||
--- a/specs/windows/services.table
|
||||
+++ b/specs/windows/services.table
|
||||
@@ -12,7 +12,7 @@ schema([
|
||||
Column("path", TEXT, "Path to Service Executable"),
|
||||
Column("module_path", TEXT, "Path to ServiceDll"),
|
||||
Column("description", TEXT, "Service Description"),
|
||||
- Column("user_account", TEXT, "The name of the account that the service process will be logged on as when it runs. This name can be of the form Domain\UserName. If the account belongs to the built-in domain, the name can be of the form .\UserName."),
|
||||
+ Column("user_account", TEXT, "The name of the account that the service process will be logged on as when it runs. This name can be of the form Domain\\UserName. If the account belongs to the built-in domain, the name can be of the form .\\UserName."),
|
||||
])
|
||||
implementation("system/windows/services@genServices")
|
||||
examples([
|
||||
@@ -0,0 +1,22 @@
|
||||
diff --git a/tools/get_platform.py b/tools/get_platform.py
|
||||
index 3dd34516..f53ca83a 100644
|
||||
--- a/tools/get_platform.py
|
||||
+++ b/tools/get_platform.py
|
||||
@@ -26,6 +26,8 @@ DEBIAN_VERSION = "/etc/debian_version"
|
||||
GENTOO_RELEASE = "/etc/gentoo-release"
|
||||
|
||||
def _platform():
|
||||
+ return ("nixos", "nixos")
|
||||
+
|
||||
osType, _, _, _, _, _ = platform.uname()
|
||||
|
||||
if osType == "Windows":
|
||||
@@ -75,6 +77,8 @@ def _platform():
|
||||
return (None, osType.lower())
|
||||
|
||||
def _distro(osType):
|
||||
+ return "unknown_version"
|
||||
+
|
||||
def getRedhatDistroVersion(pattern):
|
||||
with open(SYSTEM_RELEASE, "r") as fd:
|
||||
contents = fd.read()
|
||||
Reference in New Issue
Block a user