-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathDefaultSecurity.cpp
More file actions
112 lines (96 loc) · 3.57 KB
/
DefaultSecurity.cpp
File metadata and controls
112 lines (96 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//----------------------------------------------------------------------
// WARNING: This file was generated by config2cpp-nocheck. Do not edit.
//----------------------------------------------------------------------
#include "DefaultSecurity.h"
namespace CONFIG4CPP_NAMESPACE {
DefaultSecurity::DefaultSecurity()
{
m_str << "#-------------------------------------------------";
m_str << "----------------------\n";
m_str << "# Default security checks for Config4*\n";
m_str << "# ------------------------------------\n";
m_str << "#\n";
m_str << "# allow_patterns is a list of wildcarded command l";
m_str << "ines that are allowed\n";
m_str << "# to be executed (if the command resides in a dire";
m_str << "ctory listed in\n";
m_str << "# trusted_directories).\n";
m_str << "#\n";
m_str << "# deny_patterns is a list of wildcarded command li";
m_str << "nes that are\n";
m_str << "# disallowed.\n";
m_str << "#\n";
m_str << "# The wildcarded command-lines can contain \"*\", wh";
m_str << "ich denotes zero or\n";
m_str << "# more characters.\n";
m_str << "#\n";
m_str << "# trusted_directories is a list of directories in ";
m_str << "which the commands\n";
m_str << "# listed in allow_patterns must be found.\n";
m_str << "#-------------------------------------------------";
m_str << "----------------------\n";
m_str << "\n";
m_str << "\n";
m_str << "@if (osType() == \"unix\") {\n";
m_str << "\t#--------\n";
m_str << "\t# Allow only a few commands that might be useful.";
m_str << "\n";
m_str << "\t#--------\n";
m_str << "\tallow_patterns = [\n";
m_str << "\t\t\"curl *\",\n";
m_str << "\t\t\"hostname\",\n";
m_str << "\t\t\"uname\",\n";
m_str << "\t\t\"uname *\",\n";
m_str << "\t\t\"ifconfig\"\n";
m_str << "\t];\n";
m_str << "\n";
m_str << "\t#--------\n";
m_str << "\t# Disallow `...` (nested commands) and piped comm";
m_str << "ands since we\n";
m_str << "\t# have no idea what they might contain.\n";
m_str << "\t#--------\n";
m_str << "\tdeny_patterns = [\"*`*\", \"*|*\", \"*>*\"];\n";
m_str << "\ttrusted_directories = [\"/bin\", \"/usr/bin\", \"/usr/";
m_str << "local/bin\",\n";
m_str << "\t\t\t\t\"/sbin\", \"/usr/sbin\"];\n";
m_str << "} @elseIf (osType() == \"windows\") {\n";
m_str << "\t#--------\n";
m_str << "\t# Cygwin (or some other collection of UNIX-like t";
m_str << "ools) might\n";
m_str << "\t# be installed on a Windows machine so the securi";
m_str << "ty\n";
m_str << "\t# configuration is written accordingly.\n";
m_str << "\t# The main difference from the UNIX settings is t";
m_str << "hat\n";
m_str << "\t# \"deny_patterns\" forbids the use of both UNIX an";
m_str << "d Windows-style\n";
m_str << "\t# environment variables, that is, $NAME and %NAME";
m_str << "%.\n";
m_str << "\t#--------\n";
m_str << "\tallow_patterns = [\n";
m_str << "\t\t\"curl *\",\n";
m_str << "\t\t\"hostname\",\n";
m_str << "\t\t\"uname\",\n";
m_str << "\t\t\"uname *\",\n";
m_str << "\t\t\"ipconfig\"\n";
m_str << "\t];\n";
m_str << "\tdeny_patterns = [\"*`*\", \"*|*\", \"*>*\"];\n";
m_str << "\ttrusted_directories = [getenv(\"SYSTEMROOT\") + \"\\s";
m_str << "ystem32\"];\n";
m_str << "} @else {\n";
m_str << "\t#--------\n";
m_str << "\t# If we don't know what operating system we are r";
m_str << "unning on then\n";
m_str << "\t# don't trust anything.\n";
m_str << "\t#--------\n";
m_str << "\tallow_patterns = [];\n";
m_str << "\tdeny_patterns = [\"*\"];\n";
m_str << "\ttrusted_directories = [];\n";
m_str << "};\n";
m_str << "";
}
DefaultSecurity::~DefaultSecurity()
{
// Nothing to do
}
}; // namespace CONFIG4CPP_NAMESPACE