Remove plugins
authorSangwan Kwon <sangwan.kwon@samsung.com>
Fri, 24 Apr 2020 04:23:12 +0000 (13:23 +0900)
committer권상완/Security 2Lab(SR)/Engineer/삼성전자 <sangwan.kwon@samsung.com>
Tue, 28 Apr 2020 07:13:55 +0000 (16:13 +0900)
Signed-off-by: Sangwan Kwon <sangwan.kwon@samsung.com>
src/osquery/CMakeLists.txt
src/osquery/plugins/CMakeLists.txt [deleted file]
src/osquery/plugins/logger/filesystem_logger.cpp [deleted file]
src/osquery/plugins/logger/filesystem_logger.h [deleted file]

index b177d88..54a4dd5 100644 (file)
@@ -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 (file)
index e81b6bf..0000000
+++ /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 (file)
index 02c4da5..0000000
+++ /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 <exception>
-
-#include <osquery/logger.h>
-#include <osquery/utils/config/default_paths.h>
-
-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<StatusLogLine>& log) {
-  for (const auto& item : log) {
-    // Emit this intermediate log to the Glog filesystem logger.
-    google::LogMessage(item.filename.c_str(),
-                       static_cast<int>(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<StatusLogLine>& 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 (file)
index c4b3c97..0000000
+++ /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 <exception>
-
-#include <osquery/filesystem/filesystem.h>
-#include <osquery/registry_factory.h>
-#include <osquery/plugins/logger.h>
-
-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<StatusLogLine>& log) override;
-
-  /// Write a status to Glog.
-  Status logStatus(const std::vector<StatusLogLine>& 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");
-}