BastionGuard/thirdparty/bastionguard-secure-connection/daemon/include/bsc/config/Config.hpp
specialworld83 f0f913a209 Release 2.0
2026-07-15 10:52:22 +02:00

71 lines
2.1 KiB
C++

#pragma once
#include <cstdint>
#include <string>
namespace bsc::config {
struct Config {
struct ServerTLSOptions {
std::string cacert;
std::string server_cert;
std::string server_key;
std::string client_cert;
std::string client_key;
std::string client_auth_type{"no-client-cert"};
bool skip_verify{false};
};
struct ServerAuth {
std::string type{"simple"};
ServerTLSOptions tls;
};
struct ServerConfig {
std::string address{"unix:///tmp/bsd-daemon.sock"};
ServerAuth authentication;
std::string log_file{"/var/log/bastionguard-secure-connectiond.log"};
};
struct RulesOptions {
std::string path{"/etc/bastionguard-secure-connectiond/rules/"};
bool enable_checksums{false};
};
struct FwOptions {
std::string config_path{"/etc/bastionguard-secure-connectiond/system-fw.json"};
std::string monitor_interval{"15s"};
std::uint16_t queue_num{0};
bool queue_bypass{true};
};
struct StatsOptions {
std::uint32_t max_events{250};
std::uint32_t max_stats{25};
std::uint32_t workers{6};
};
struct InternalOptions {
int gc_percent{100};
bool flush_conns_on_start{true};
};
struct TasksOptions {
std::string config_path{"/etc/bastionguard-secure-connectiond/tasks/"};
};
std::string source_path;
std::int32_t log_level{1};
std::string firewall{"nftables"};
std::string default_action{"allow"};
std::string default_duration{"once"};
std::string proc_monitor_method{"proc"};
std::string ebpf_obj_path{}; // percorso bsc_ebpf.o; "" = default di sistema
FwOptions fw_options;
ServerConfig server;
RulesOptions rules;
InternalOptions internal;
StatsOptions stats;
TasksOptions tasks;
bool intercept_unknown{false};
bool log_utc{true};
bool log_micro{false};
};
Config load_file(const std::string& path);
bool save_file(const Config& cfg, const std::string& path);
std::string read_file(const std::string& path);
} // namespace bsc::config