Eunomia  0.1.0
A lightweight eBPF-based CloudNative Monitor tool for Container Security and Observability
config.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2  *
3  * Copyright (c) 2022, 郑昱笙,濮雯旭,张典典(牛校牛子队)
4  * All rights reserved.
5  */
6 
7 #ifndef EUNOMIA_CONFIG_H
8 #define EUNOMIA_CONFIG_H
9 
10 #include <set>
11 #include <string>
12 #include <vector>
13 
16 {
17  std::string rule_name;
18  std::string type;
19  std::string trigger;
20  std::string err_msg;
21 };
22 
25 {
27  std::vector<std::string> allow_syscall;
28 };
29 
32 {
33  std::string name;
34  std::vector<std::string> args;
35 };
36 
39 {
40  std::string name;
41  std::vector<handler_config_data> export_handlers;
42  std::vector<std::string> args;
43 
44  static tracker_config_data from_json_str(const std::string& json_str);
45 };
46 
49 {
50  std::string rule_name;
51  std::string type;
52  std::string trigger;
53  std::string err_msg;
54 
55  static rule_config_data from_json_str(const std::string& json_str);
56 };
57 
60 {
61  std::string container_id;
63  std::vector<std::string> allow_syscall;
64 
65  static seccomp_config_data from_json_str(const std::string& json_str);
66 };
67 
69 
72 {
74  std::string run_selected = "server";
75 
77  std::vector<tracker_config_data> enabled_trackers = {
78  { "process", {}, {} },
79  { "files", {}, {} },
80  { "tcpconnect", {}, {} },
81  };
83 
85  bool disable_other_configs = false;
86 
88  std::string tracing_selected = "all";
90  std::string tracing_target_id = "";
91 
93  int exit_after = 0;
94 
96 
98  std::set<std::string> enabled_export_types = { "prometheus", "stdout" };
99 
101 
103  std::string fmt = "plain_text";
104 
106 
110 
111  // TODO: this should be add to export config
112  std::string prometheus_listening_address = "127.0.0.1:8528";
113 
117 
119  std::vector<rule_config_data> security_rules;
120 
122  std::vector<seccomp_config_data> seccomp_data;
124  bool enable_seccomp_module = false;
125 
127  static eunomia_config_data from_toml_file(const std::string &file_path);
129  static eunomia_config_data from_json_file(const std::string &file_path);
130 
133 
135  int server_port = 8527;
136 };
137 
138 #endif
rule_config_data::rule_name
std::string rule_name
Definition: config.h:50
eunomia_config_data::enable_sec_rule_detect
bool enable_sec_rule_detect
enable sec rule analyzer and detect
Definition: config.h:115
handler_config_data::name
std::string name
Definition: config.h:33
eunomia_config_data::exit_after
int exit_after
auto exit mode
Definition: config.h:93
handler_config_data::args
std::vector< std::string > args
Definition: config.h:34
rule_config::trigger
std::string trigger
Definition: config.h:19
tracker_config_data::name
std::string name
Definition: config.h:40
eunomia_config_data::from_json_file
static eunomia_config_data from_json_file(const std::string &file_path)
parse config from json files
Definition: config.cpp:90
seccomp_config_data::allow_syscall
std::vector< std::string > allow_syscall
the syscalls name which is allowed
Definition: config.h:63
rule_config::rule_name
std::string rule_name
Definition: config.h:17
eunomia_config_data::enabled_trackers
std::vector< tracker_config_data > enabled_trackers
config for all enabled tracker
Definition: config.h:77
eunomia_config_data::tracing_selected
std::string tracing_selected
tracing config
Definition: config.h:88
eunomia_config_data::from_toml_file
static eunomia_config_data from_toml_file(const std::string &file_path)
parse config from toml files
Definition: config.cpp:71
seccomp_config_data::from_json_str
static seccomp_config_data from_json_str(const std::string &json_str)
tracker_config_data::from_json_str
static tracker_config_data from_json_str(const std::string &json_str)
Definition: config.cpp:98
eunomia_config_data::run_selected
std::string run_selected
global run mode
Definition: config.h:74
rule_config::type
std::string type
Definition: config.h:18
seccomp_config::allow_syscall
std::vector< std::string > allow_syscall
the syscalls name which is allowed
Definition: config.h:27
eunomia_config_data::server_port
int server_port
eunomia_http_server_port
Definition: config.h:135
eunomia_config_data::disable_other_configs
bool disable_other_configs
use the config data from enabled_trackers,
Definition: config.h:85
tracker_config_data::args
std::vector< std::string > args
Definition: config.h:42
rule_config_data
security rule config
Definition: config.h:48
seccomp_config_data::container_id
std::string container_id
Definition: config.h:61
tracker_config_data::export_handlers
std::vector< handler_config_data > export_handlers
Definition: config.h:41
rule_config_data::trigger
std::string trigger
Definition: config.h:52
eunomia_config_data::prometheus_listening_address
std::string prometheus_listening_address
Definition: config.h:112
eunomia_config_data::enable_container_manager
bool enable_container_manager
enable container tracing
Definition: config.h:109
rule_config_data::type
std::string type
Definition: config.h:51
rule_config::err_msg
std::string err_msg
Definition: config.h:20
eunomia_config_data
config for eunomia
Definition: config.h:71
eunomia_config_data::load_config_options_to_trackers
void load_config_options_to_trackers()
load config options to enable_trackers
Definition: config.cpp:134
seccomp_config
seccomp config
Definition: config.h:24
handler_config_data
handler config data
Definition: config.h:31
eunomia_config_data::fmt
std::string fmt
export format
Definition: config.h:103
rule_config_data::from_json_str
static rule_config_data from_json_str(const std::string &json_str)
Definition: config.cpp:112
rule_config_data::err_msg
std::string err_msg
Definition: config.h:53
eunomia_config_data::seccomp_data
std::vector< seccomp_config_data > seccomp_data
seccomp enabled syscalls
Definition: config.h:122
eunomia_config_data::enabled_export_types
std::set< std::string > enabled_export_types
export config
Definition: config.h:98
eunomia_config_data::security_rules
std::vector< rule_config_data > security_rules
security rule config
Definition: config.h:119
eunomia_config_data::tracing_target_id
std::string tracing_target_id
tracing targets
Definition: config.h:90
rule_config
sec rules config
Definition: config.h:15
tracker_config_data
tracker config data
Definition: config.h:38
seccomp_config_data
seccomp config data
Definition: config.h:59
eunomia_config_data::enable_seccomp_module
bool enable_seccomp_module
run container under seccomp
Definition: config.h:124