From: Sangwan Kwon Date: Fri, 24 Apr 2020 04:23:12 +0000 (+0900) Subject: Remove plugins X-Git-Tag: submit/tizen/20200810.073515~40 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1c5dd3f5e226c99da700370d3c1e6c9ac6850a71;p=platform%2Fcore%2Fsecurity%2Fvist.git Remove plugins Signed-off-by: Sangwan Kwon --- diff --git a/src/osquery/CMakeLists.txt b/src/osquery/CMakeLists.txt index b177d88..54a4dd5 100644 --- a/src/osquery/CMakeLists.txt +++ b/src/osquery/CMakeLists.txt @@ -46,7 +46,6 @@ ENDIF(DEFINED GBS_BUILD) ADD_SUBDIRECTORY(core) ADD_SUBDIRECTORY(filesystem) ADD_SUBDIRECTORY(logger) -ADD_SUBDIRECTORY(plugins) ADD_SUBDIRECTORY(registry) ADD_SUBDIRECTORY(sql) ADD_SUBDIRECTORY(tables) diff --git a/src/osquery/plugins/CMakeLists.txt b/src/osquery/plugins/CMakeLists.txt deleted file mode 100644 index e81b6bf..0000000 --- a/src/osquery/plugins/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2014-present, Facebook, Inc. -# All rights reserved. -# -# This source code is licensed in accordance with the terms specified in -# the LICENSE file found in the root directory of this source tree. - -ADD_OSQUERY_LIBRARY(osquery_pluing_logger logger/filesystem_logger.cpp) diff --git a/src/osquery/plugins/logger/filesystem_logger.cpp b/src/osquery/plugins/logger/filesystem_logger.cpp deleted file mode 100644 index 02c4da5..0000000 --- a/src/osquery/plugins/logger/filesystem_logger.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Copyright (c) 2014-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed in accordance with the terms specified in - * the LICENSE file found in the root directory of this source tree. - */ - -#include "filesystem_logger.h" - -#include - -#include -#include - -namespace fs = boost::filesystem; - -namespace osquery { - -const std::string kFilesystemLoggerFilename = "osqueryd.results.log"; -const std::string kFilesystemLoggerSnapshots = "osqueryd.snapshots.log"; - -Status FilesystemLoggerPlugin::setUp() { - // Ensure that we create the results log here. - return logStringToFile("", kFilesystemLoggerFilename, true); -} - -Status FilesystemLoggerPlugin::logString(const std::string& s) { - return logStringToFile(s, kFilesystemLoggerFilename); -} - -Status FilesystemLoggerPlugin::logStringToFile(const std::string& s, - const std::string& filename, - bool empty) { - return Status(1, "Not supported."); -} - -Status FilesystemLoggerPlugin::logStatus( - const std::vector& log) { - for (const auto& item : log) { - // Emit this intermediate log to the Glog filesystem logger. - google::LogMessage(item.filename.c_str(), - static_cast(item.line), - (google::LogSeverity)item.severity) - .stream() - << item.message; - } - - return Status(0, "OK"); -} - -Status FilesystemLoggerPlugin::logSnapshot(const std::string& s) { - // Send the snapshot data to a separate filename. - return logStringToFile(s, kFilesystemLoggerSnapshots); -} - -void FilesystemLoggerPlugin::init(const std::string& name, - const std::vector& log) { - // Stop the internal Glog facilities. - google::ShutdownGoogleLogging(); - - - google::InitGoogleLogging(name.c_str()); - - // We may violate Glog global object assumptions. So set names manually. - auto basename = (log_path_ / name).string(); - - google::SetLogDestination(google::GLOG_INFO, (basename + ".INFO.").c_str()); - google::SetLogDestination(google::GLOG_WARNING, - (basename + ".WARNING.").c_str()); - google::SetLogDestination(google::GLOG_ERROR, (basename + ".ERROR.").c_str()); - - // Now funnel the intermediate status logs provided to `init`. - logStatus(log); -} -} diff --git a/src/osquery/plugins/logger/filesystem_logger.h b/src/osquery/plugins/logger/filesystem_logger.h deleted file mode 100644 index c4b3c97..0000000 --- a/src/osquery/plugins/logger/filesystem_logger.h +++ /dev/null @@ -1,62 +0,0 @@ -#pragma once - -/** - * Copyright (c) 2014-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed in accordance with the terms specified in - * the LICENSE file found in the root directory of this source tree. - */ - -#include - -#include -#include -#include - -namespace osquery { - -class FilesystemLoggerPlugin : public LoggerPlugin { - public: - Status setUp() override; - - /// Log results (differential) to a distinct path. - Status logString(const std::string& s) override; - - /// Log snapshot data to a distinct path. - Status logSnapshot(const std::string& s) override; - - /** - * @brief Initialize the logger plugin after osquery has begun. - * - * The filesystem logger plugin is somewhat unique, it is the only logger - * that will return an error during initialization. This allows Glog to - * write directly to files. - */ - void init(const std::string& name, - const std::vector& log) override; - - /// Write a status to Glog. - Status logStatus(const std::vector& log) override; - - private: - /// The plugin-internal filesystem writer method. - Status logStringToFile(const std::string& s, - const std::string& filename, - bool empty = false); - - private: - /// The folder where Glog and the result/snapshot files are written. - boost::filesystem::path log_path_; - - /// Filesystem writer mutex. - Mutex mutex_; - - /* - private: - FRIEND_TEST(FilesystemLoggerTests, test_filesystem_init); - */ -}; - -REGISTER(FilesystemLoggerPlugin, "logger", "filesystem"); -}