diff --git a/CMake/CMakeLibs.cmake b/CMake/CMakeLibs.cmake index ecf434ed..25e26c52 100644 --- a/CMake/CMakeLibs.cmake +++ b/CMake/CMakeLibs.cmake @@ -162,7 +162,7 @@ endmacro(ADD_OSQUERY_LIBRARY_ADDITIONAL) macro(ADD_OSQUERY_LIBRARY IS_CORE TARGET) if(${IS_CORE} OR NOT OSQUERY_BUILD_SDK_ONLY) add_library(${TARGET} OBJECT ${ARGN}) - add_dependencies(${TARGET} libglog osquery_extensions) + add_dependencies(${TARGET} osquery_extensions) SET_OSQUERY_COMPILE(${TARGET} "${CXX_COMPILE_FLAGS} -static") if(${IS_CORE}) list(APPEND OSQUERY_SOURCES $) @@ -188,7 +188,7 @@ endmacro(ADD_OSQUERY_OBJCXX_LIBRARY_ADDITIONAL) macro(ADD_OSQUERY_OBJCXX_LIBRARY IS_CORE TARGET) if(${IS_CORE} OR NOT OSQUERY_BUILD_SDK_ONLY) add_library(${TARGET} OBJECT ${ARGN}) - add_dependencies(${TARGET} libglog osquery_extensions) + add_dependencies(${TARGET} osquery_extensions) SET_OSQUERY_COMPILE(${TARGET} "${CXX_COMPILE_FLAGS} ${OBJCXX_COMPILE_FLAGS} -static") if(${IS_CORE}) list(APPEND OSQUERY_SOURCES $) @@ -212,7 +212,7 @@ macro(ADD_OSQUERY_MODULE TARGET) if(NOT FREEBSD) target_link_libraries(${TARGET} dl) endif() - add_dependencies(${TARGET} libglog libosquery) + add_dependencies(${TARGET} libosquery) if(APPLE) target_link_libraries(${TARGET} "-undefined dynamic_lookup") endif() diff --git a/CMake/FindGlog.cmake b/CMake/FindGlog.cmake deleted file mode 100644 index fca8f365..00000000 --- a/CMake/FindGlog.cmake +++ /dev/null @@ -1,38 +0,0 @@ -include(FindPackageHandleStandardArgs) -if(POLICY CMP0054) - cmake_policy(SET CMP0054 NEW) -endif() - -set(GLOG_ROOT_DIR "${CMAKE_BINARY_DIR}/third-party/glog") -set(GLOG_SOURCE_DIR "${CMAKE_SOURCE_DIR}/third-party/glog") - -set(GLOG_C_FLAGS "${CMAKE_C_FLAGS} ${C_COMPILE_FLAGS}") -if(APPLE) - set(GLOG_C_FLAGS "${GLOG_C_FLAGS} -mmacosx-version-min=${OSX_VERSION_MIN}") -endif() -set(GLOG_CXX_FLAGS "${GLOG_C_FLAGS} ${CMAKE_CXX_FLAGS} ${CXX_COMPILE_FLAGS}") -set(GLOG_CXX_FLAGS "${GLOG_CXX_FLAGS} -Wno-deprecated-register -Wno-unnamed-type-template-args -Wno-deprecated -Wno-error") - -set(GLOG_INCLUDE_DIR "${GLOG_ROOT_DIR}/include") -set(GLOG_INCLUDE_DIRS ${GLOG_INCLUDE_DIR}) - -set(GLOG_LIBRARY "${GLOG_ROOT_DIR}/lib/libglog.a") -set(GLOG_LIBRARIES ${GLOG_LIBRARY}) - -INCLUDE(ExternalProject) -ExternalProject_Add( - libglog - SOURCE_DIR ${GLOG_SOURCE_DIR} - INSTALL_DIR ${GLOG_ROOT_DIR} - CONFIGURE_COMMAND ${GLOG_SOURCE_DIR}/configure - CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} - CFLAGS=${GLOG_C_FLAGS} CXXFLAGS=${GLOG_CXX_FLAGS} - --enable-frame-pointers --enable-shared=no --prefix=${GLOG_ROOT_DIR} - BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} - INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install - LOG_CONFIGURE ON - LOG_INSTALL ON - LOG_BUILD ON -) - -LOG_LIBRARY(glog "${GLOG_LIBRARY}") diff --git a/CMakeLists.txt b/CMakeLists.txt index eccb733a..2660bd24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -354,7 +354,6 @@ endif() if(NOT DEFINED ENV{BUILD_LINK_SHARED}) set(CMAKE_FIND_LIBRARY_SUFFIXES .a .dylib .so) endif() -find_package(Glog REQUIRED) find_package(Gflags REQUIRED) find_package(Gtest REQUIRED) find_package(Thrift 0.9.3 REQUIRED) @@ -376,7 +375,6 @@ enable_testing() include(Packages) include(Thrift) -include_directories("${GLOG_INCLUDE_DIRS}") include_directories("${CMAKE_SOURCE_DIR}/third-party/sqlite3") include_directories("${CMAKE_SOURCE_DIR}/include") include_directories("${CMAKE_SOURCE_DIR}") diff --git a/osquery/CMakeLists.txt b/osquery/CMakeLists.txt index 13ff186b..a8af3381 100644 --- a/osquery/CMakeLists.txt +++ b/osquery/CMakeLists.txt @@ -25,7 +25,6 @@ add_compile_options( set(OSQUERY_LIBS # This includes librocksdb[_lite] and libsnappy. ${THRIFT_LIBRARY} - ${GLOG_LIBRARY} ${GFLAGS_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_SSL_LIBRARY} @@ -72,6 +71,7 @@ else() endif() # The remaining boost libraries are discovered with find_library. +ADD_OSQUERY_LINK_CORE("glog") ADD_OSQUERY_LINK_CORE("boost_system") ADD_OSQUERY_LINK_CORE("boost_filesystem") ADD_OSQUERY_LINK_CORE("boost_regex") diff --git a/osquery/logger/CMakeLists.txt b/osquery/logger/CMakeLists.txt index 0ad3a229..6799837e 100644 --- a/osquery/logger/CMakeLists.txt +++ b/osquery/logger/CMakeLists.txt @@ -1,8 +1,6 @@ file(GLOB OSQUERY_LOGGER "*.cpp") ADD_OSQUERY_LIBRARY(TRUE osquery_logger ${OSQUERY_LOGGER}) -add_dependencies(osquery_logger libglog) - file(GLOB OSQUERY_LOGGER_PLUGINS "plugins/*.cpp") ADD_OSQUERY_LIBRARY(FALSE osquery_logger_plugins ${OSQUERY_LOGGER_PLUGINS}) diff --git a/osquery/logger/plugins/filesystem.cpp b/osquery/logger/plugins/filesystem.cpp index ebd7a7a3..9f8e66ad 100644 --- a/osquery/logger/plugins/filesystem.cpp +++ b/osquery/logger/plugins/filesystem.cpp @@ -73,7 +73,8 @@ Status FilesystemLoggerPlugin::setUp() { log_path_ = fs::path(FLAGS_logger_path); // Ensure that the glog status logs use the same mode as our results log. - FLAGS_logfile_mode = FLAGS_logger_mode; + // Glog 0.3.4 does not support a logfile mode. + // FLAGS_logfile_mode = FLAGS_logger_mode; // Ensure that we create the results log here. return logStringToFile("", kFilesystemLoggerFilename, true); diff --git a/third-party b/third-party index 46791746..dcb73fe6 160000 --- a/third-party +++ b/third-party @@ -1 +1 @@ -Subproject commit 467917469b31f567f5f6a755641cfe8179a68394 +Subproject commit dcb73fe68dc7c114a71faf2c08465d63c4380bd8 diff --git a/tools/provision/amazon.sh b/tools/provision/amazon.sh index e1694020..f694b6a8 100755 --- a/tools/provision/amazon.sh +++ b/tools/provision/amazon.sh @@ -50,6 +50,7 @@ function main_amazon() { package cryptsetup-luks-devel install_gflags + install_glog install_iptables_dev package doxygen diff --git a/tools/provision/centos.sh b/tools/provision/centos.sh index 3ed75526..504ff825 100755 --- a/tools/provision/centos.sh +++ b/tools/provision/centos.sh @@ -70,6 +70,7 @@ function main_centos() { fi install_gflags + install_glog install_iptables_dev package doxygen diff --git a/tools/provision/darwin.sh b/tools/provision/darwin.sh index 35e1a8cf..1001f100 100755 --- a/tools/provision/darwin.sh +++ b/tools/provision/darwin.sh @@ -24,6 +24,7 @@ function main_darwin() { package doxygen package boost package gflags + package glog package lz4 package snappy package rocksdb diff --git a/tools/provision/debian.sh b/tools/provision/debian.sh index 8f199c64..8fd54adc 100755 --- a/tools/provision/debian.sh +++ b/tools/provision/debian.sh @@ -44,15 +44,9 @@ function main_debian() { package libdpkg-dev package libudev-dev package libblkid-dev - package libbz2-dev package libreadline-dev - package iptables-dev - - package libsnappy-dev - package libgflags-dev - package libaudit-dev package libmagic-dev @@ -74,11 +68,13 @@ function main_debian() { package rubygems gem_install fpm - install_thrift + install_gflags + install_glog + install_snappy install_rocksdb + install_thrift install_yara install_cppnetlib - install_gflags install_sleuthkit # Need headers and PC macros diff --git a/tools/provision/fedora.sh b/tools/provision/fedora.sh index d787c50a..eb8c261b 100644 --- a/tools/provision/fedora.sh +++ b/tools/provision/fedora.sh @@ -67,6 +67,7 @@ function main_fedora() { fi install_gflags + install_glog install_rocksdb install_yara install_cppnetlib diff --git a/tools/provision/freebsd.sh b/tools/provision/freebsd.sh index 554c2060..bff0517a 100755 --- a/tools/provision/freebsd.sh +++ b/tools/provision/freebsd.sh @@ -16,6 +16,7 @@ function main_freebsd() { package git package python package py27-pip + package glog package snappy package rocksdb package thrift diff --git a/tools/provision/lib.sh b/tools/provision/lib.sh index 3311c752..71c9f1ae 100755 --- a/tools/provision/lib.sh +++ b/tools/provision/lib.sh @@ -262,6 +262,21 @@ function install_boost() { fi } +function install_glog() { + SOURCE=glog-0.3.4 + TARBALL=$SOURCE.tar.gz + URL=$DEPS_URL/$TARBALL + + if provision glog /usr/local/lib/libglog.a; then + pushd $SOURCE + ./configure --disable-shared --prefix=/usr/local \ + CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" + CC="$CC" CXX="$CXX" make -j $THREADS + sudo make install + popd + fi +} + function install_gflags() { TARBALL=v2.1.1.tar.gz URL=$DEPS_URL/$TARBALL diff --git a/tools/provision/oracle.sh b/tools/provision/oracle.sh index dd829101..b5584094 100755 --- a/tools/provision/oracle.sh +++ b/tools/provision/oracle.sh @@ -84,6 +84,7 @@ function main_oracle() { fi install_gflags + install_glog install_iptables_dev package doxygen diff --git a/tools/provision/rhel.sh b/tools/provision/rhel.sh index a6b32570..bd7ad558 100755 --- a/tools/provision/rhel.sh +++ b/tools/provision/rhel.sh @@ -108,6 +108,7 @@ function main_rhel() { fi install_gflags + install_glog install_iptables_dev package doxygen diff --git a/tools/provision/ubuntu.sh b/tools/provision/ubuntu.sh index b0ad5b5e..0c1364d4 100755 --- a/tools/provision/ubuntu.sh +++ b/tools/provision/ubuntu.sh @@ -117,6 +117,7 @@ function main_ubuntu() { install_cmake install_gflags + install_glog install_iptables_dev if [[ $DISTRO = "lucid" ]]; then diff --git a/tools/tests/test_osqueryd.py b/tools/tests/test_osqueryd.py index 164b51b8..018079af 100755 --- a/tools/tests/test_osqueryd.py +++ b/tools/tests/test_osqueryd.py @@ -119,14 +119,16 @@ class DaemonTests(test_base.ProcessGenerator, unittest.TestCase): # Wait for the daemon to flush to GLOG. test_base.expectTrue(info_exists) - # Both log files should exist and have the given mode. + # Both log files should exist, the results should have the given mode. for fname in ['osqueryd.INFO', 'osqueryd.results.log']: pth = os.path.join(logger_path, fname) self.assertTrue(os.path.exists(pth)) - rpath = os.path.realpath(info_path) - mode = os.stat(rpath).st_mode & 0777 - self.assertEqual(mode, test_mode) + # Only apply the mode checks to .log files. + if fname.find('.log') > 0: + rpath = os.path.realpath(pth) + mode = os.stat(rpath).st_mode & 0777 + self.assertEqual(mode, test_mode) daemon.kill()