Skip to content

Commit ae4fb56

Browse files
authored
Merge pull request #804 from VultureProject/master
Add mmdarwin documentation
2 parents 9b855a5 + d9bbe2f commit ae4fb56

File tree

1 file changed

+183
-0
lines changed

1 file changed

+183
-0
lines changed
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
.. index:: ! mmdarwin
2+
3+
.. role:: json(code)
4+
:language: json
5+
6+
***************************
7+
Darwin connector (mmdarwin)
8+
***************************
9+
10+
================ ===========================================
11+
**Module Name:** **mmdarwin**
12+
**Author:** Guillaume Catto <[email protected]>
13+
================ ===========================================
14+
15+
Purpose
16+
=======
17+
18+
Darwin is an open source Artificial Intelligence Framework for CyberSecurity. The mmdarwin module allows us to call Darwin in order to enrich our JSON-parsed logs with a decision stored in a specific key.
19+
20+
How to build the module
21+
=======================
22+
23+
To compile Rsyslog with mmdarwin you'll need to:
24+
25+
* set *--enable-mmdarwin* on configure
26+
27+
Configuration Parameter
28+
=======================
29+
30+
Input Parameters
31+
----------------
32+
33+
key
34+
^^^
35+
36+
.. csv-table::
37+
:header: "type", "default", "mandatory", "|FmtObsoleteName| directive"
38+
:widths: auto
39+
:class: parameter-table
40+
41+
"word", "none", "yes", "none"
42+
43+
The key name used to enrich our logs.
44+
45+
For example, given the following log line:
46+
47+
.. code-block:: json
48+
49+
{
50+
"from": "192.168.1.42",
51+
"date": "2012-12-21 00:00:00",
52+
"status": "200",
53+
"data": {
54+
"status": true,
55+
"message": "Request processed correctly"
56+
}
57+
}
58+
59+
and the :json:`"certitude"` key, the enriched log line would be:
60+
61+
.. code-block:: json
62+
:emphasize-lines: 9
63+
64+
{
65+
"from": "192.168.1.42",
66+
"date": "2012-12-21 00:00:00",
67+
"status": "200",
68+
"data": {
69+
"status": true,
70+
"message": "Request processed correctly"
71+
},
72+
"certitude": 0
73+
}
74+
75+
where :json:`"certitude"` represents the score returned by Darwin.
76+
77+
78+
socketpath
79+
^^^^^^^^^^
80+
81+
.. csv-table::
82+
:header: "type", "default", "mandatory", "|FmtObsoleteName| directive"
83+
:widths: auto
84+
:class: parameter-table
85+
86+
"word", "none", "yes", "none"
87+
88+
The Darwin filter socket path to call.
89+
90+
91+
response
92+
^^^^^^^^
93+
94+
.. csv-table::
95+
:header: "type", "default", "mandatory", "|FmtObsoleteName| directive"
96+
:widths: auto
97+
:class: parameter-table
98+
99+
"word", "none", "yes", "none"
100+
101+
Tell the Darwin filter what to do with its decision:
102+
103+
* :json:`"no"`: no response will be sent
104+
* :json:`"back"`: Darwin will send its decision to the caller
105+
* :json:`"darwin"`: Darwin will send its decision to the next filter
106+
* :json:`"both"`: Darwin will send its decision to both the caller and the next filter
107+
108+
filtercode
109+
^^^^^^^^^^
110+
111+
.. csv-table::
112+
:header: "type", "default", "mandatory", "|FmtObsoleteName| directive"
113+
:widths: auto
114+
:class: parameter-table
115+
116+
"word", "none", "yes", "none"
117+
118+
Each Darwin module has a unique filter code. For example, the code of the injection filter is :json:`"0x696E6A65"`. You need to provide a code corresponding to the filter you want to use.
119+
120+
fields
121+
^^^^^^
122+
123+
.. csv-table::
124+
:header: "type", "default", "mandatory", "|FmtObsoleteName| directive"
125+
:widths: auto
126+
:class: parameter-table
127+
128+
"array", "none", "yes", "none"
129+
130+
Array containing values to be sent to Darwin as parameters.
131+
132+
Two types of values can be set:
133+
134+
* if it starts with a bang (:json:`"!"`), mmdarwin will search in the JSON-parsed log line the associated value. You can search in subkeys as well: just add a bang to go to a deeper level.
135+
* otherwise, the value is considered static, and will be forwarded directly to Darwin.
136+
137+
For example, given the following log line:
138+
139+
.. code-block:: json
140+
141+
{
142+
"from": "192.168.1.42",
143+
"date": "2012-12-21 00:00:00",
144+
"status": "200",
145+
"data": {
146+
"status": true,
147+
"message": "Request processed correctly"
148+
}
149+
}
150+
151+
and the :json:`"fields"` array:
152+
153+
.. code-block:: none
154+
155+
["!from", "!data!status", "rsyslog"]
156+
157+
The parameters sent to Darwin would be :json:`"192.168.1.42"`, :json:`true` and :json:`"rsyslog"`.
158+
159+
Note that the order of the parameters is important. Thus, you have to be careful when providing the fields in the array.
160+
161+
Configuration example
162+
=====================
163+
164+
This example shows a possible configuration of mmdarwin.
165+
166+
.. code-block:: none
167+
168+
module(load="imtcp")
169+
module(load="mmjsonparse")
170+
module(load="mmdarwin")
171+
172+
input(type="imtcp" port="8042" Ruleset="darwinruleset")
173+
174+
ruleset(name="darwinruleset") {
175+
action(type="mmjsonparse" cookie="")
176+
action(type="mmdarwin" socketpath="/path/to/reputation_1.sock" fields=["!srcip", "ATTACK;TOR"] key="reputation" response="back" filtercode="0x72657075")
177+
178+
call darwinoutput
179+
}
180+
181+
ruleset(name="darwinoutput") {
182+
action(type="omfile" file="/path/to/darwin_output.log")
183+
}

0 commit comments

Comments
 (0)