mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-07 18:08:53 +00:00
62 lines
1.4 KiB
C++
62 lines
1.4 KiB
C++
/*
|
|
* Copyright (c) 2014-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <boost/noncopyable.hpp>
|
|
|
|
#include <osquery/core.h>
|
|
#include <osquery/filesystem.h>
|
|
|
|
#include "osquery/core/process.h"
|
|
|
|
namespace osquery {
|
|
|
|
class TLSServerRunner : private boost::noncopyable {
|
|
public:
|
|
/// Create a singleton TLS server runner.
|
|
static TLSServerRunner& instance() {
|
|
static TLSServerRunner instance;
|
|
return instance;
|
|
}
|
|
|
|
/// Set associated flags for testing client TLS usage.
|
|
static void setClientConfig();
|
|
|
|
/// Unset or restore associated flags for testing client TLS usage.
|
|
static void unsetClientConfig();
|
|
|
|
/// TCP port accessor.
|
|
static const std::string& port() {
|
|
return instance().port_;
|
|
}
|
|
|
|
/// Start the server if it hasn't started already.
|
|
static void start();
|
|
|
|
/// Stop the service when the process exits.
|
|
static void stop();
|
|
|
|
private:
|
|
/// Current server handle.
|
|
std::shared_ptr<PlatformProcess> server_{nullptr};
|
|
|
|
/// Current server TLS port.
|
|
std::string port_;
|
|
|
|
private:
|
|
std::string tls_hostname_;
|
|
std::string enroll_tls_endpoint_;
|
|
std::string tls_server_certs_;
|
|
std::string enroll_secret_path_;
|
|
};
|
|
} |