File tree 6 files changed +62
-3
lines changed
6 files changed +62
-3
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ AUTH_PASS=password
20
20
# ## Services
21
21
# # MISP
22
22
MISP_HOSTNAME = misp-sopoc.example.com
23
+ MISP_API_KEY = apikey
23
24
24
25
# # Netdata
25
26
NETDATA_HOSTNAME = netdata-sopoc.example.com
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ The host device needs to be reachable over the internet to acquire https certifi
27
27
28
28
### MISP
29
29
30
- MISP needs to know the external hostname. T
30
+ MISP needs to know the external hostname.
31
31
This is set in ` MISP_HOSTNAME ` , for example ` misp-sopoc.duckdns.org ` .
32
32
33
33
### Ntop
@@ -109,7 +109,8 @@ Misp starts with a default login:
109
109
- Open the "Edit my profile" page.
110
110
- Change email to "` AUTH_USER ` @` MISP_HOSTNAME ` ", both set earlier in ` .env ` .
111
111
- Go to the "My profile" page.
112
- - Copy the AuthKey, this is the api key used by securityonion-misp.
112
+ - Copy the AuthKey, change the ` MISP_API_KEY ` in ` .env ` to this key.
113
+ - This is also the api key used by securityonion-misp.
113
114
114
115
### Security Onion
115
116
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ services:
11
11
build : so-manager/react
12
12
so-manager-api :
13
13
build : so-manager/api
14
+ environment :
15
+ - MISP_API_KEY=${MISP_API_KEY}
14
16
so-manager-gotty-host :
15
17
build : so-manager/gotty
16
18
command : gotty -p 80 -w ssh debian@${DOCKER_GATEWAY}
Original file line number Diff line number Diff line change
1
+ module apis.misp ;
2
+
3
+ import vibe.data.json;
4
+ import vibe.web.rest;
5
+ import vibe.http.common : HTTPMethod;
6
+
7
+ import std.process : environment;
8
+ import std.exception : enforce;
9
+
10
+ import std.algorithm : map, uniq;
11
+ import std.array : array;
12
+
13
+ @safe :
14
+
15
+ @path(" /" )
16
+ interface IMispAPI
17
+ {
18
+ @headerParam(" auth" , " Authorization" )
19
+ {
20
+ // POST /attributes/restSearch
21
+ @path(" attributes/restSearch" )
22
+ @method(HTTPMethod.POST )
23
+ @bodyParam(" value" , " value" )
24
+ Json searchAttributes (string auth, string value);
25
+ }
26
+ }
27
+
28
+ auto getMispApi ()
29
+ {
30
+ return new RestInterfaceClient! IMispAPI(" http://misp-proxy/" );
31
+ }
32
+
33
+ void queryMisp (string value, ref Json result)
34
+ {
35
+ import vibe.core.log : logInfo;
36
+
37
+ Json response;
38
+ response = getMispApi().searchAttributes(environment[" MISP_API_KEY" ], value);
39
+
40
+ Json attributes = response[" response" ][" Attribute" ];
41
+ enforce(attributes.type == Json.Type.array);
42
+
43
+ if (attributes.length == 0 )
44
+ {
45
+ result[" errors" ] ~= " Host not found in MISP" ;
46
+ return ;
47
+ }
48
+
49
+ response[" mispMatches" ] = attributes.length;
50
+ response[" mispEvents" ] = attributes.get ! (Json[])
51
+ .map! (a => a[" Event" ][" uuid" ])
52
+ .uniq
53
+ .array;
54
+ }
Original file line number Diff line number Diff line change 1
1
module apis.ntop ;
2
2
3
- // import std.exception;
4
3
import std.datetime : SysTime;
5
4
6
5
import vibe.data.json;
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import std.exception;
14
14
import std.datetime ;
15
15
16
16
import apis.ntop;
17
+ import apis.misp;
17
18
18
19
@safe :
19
20
@@ -32,6 +33,7 @@ class RestAPI : IRestAPI
32
33
result[" errors" ] = Json.emptyArray;
33
34
34
35
queryNtopIP(_ip, result);
36
+ queryMisp(_ip, result);
35
37
36
38
return result;
37
39
}
You can’t perform that action at this time.
0 commit comments