aboutsummaryrefslogtreecommitdiffstats
path: root/doc/architecture.txt
blob: acc1a40c873b41eb529aedc53a22a549e730a612 (plain) (blame)
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ glouglou v3 architecture ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~


TODO
~~~~

modular
* start probes and viz client with a mode (link to module ID)
* handle modularity in processing server
* multiple rendering modes = not only graphstream for viz

If modularisation is too hard, do v3 on network viz only
* modular = nice design

see also "XXX IN PROGRESS"


===============================================================================
PRESENTATION
===============================================================================

Program for reporting and visualising real-time computer events.
For example:
* network traffic
* process activity

Fast UDP protocol for reporting
Standard TCP protocols for visualisation (graphstream)


===============================================================================
OVERVIEW
===============================================================================

===============
==== Probe ====
= sends packets / connections about nodes that are around
= sends informations about nodes that are around distance, path ...
= forwards informations about other probes
===============

 ^
 |
 | UDP glouglou
 |
 v

===========================
==== Processing server ====
=  probes server
=  ^
=  | redis write
=  v
=  redis
=  ^
=  | redis "keyspace notifications" (http://redis.io/topics/notifications)
=  v
=  viz clients server
============================

 ^
 |
 | TCP Graphstream (gs, http://graphstream-project.org/)
 |
 v

====================
==== Viz client ====
= web version: gs netstream, gs w3sink
= C version: egraph with graphstream support
====================


===============================================================================
PROBE
===============================================================================

root process
* fork "probe" process
* fork "relay" process

probe process
* open network interface (pcap.c)
* droppriv + chroot
* connect to processing server / relaying probe
* event loop
  * capture traffic and send summary using glouglou protocol

relay process
* droppriv + chroot
* event loop
  * accept connection (glouglou)
    * client auth (static password, encryption in the future)
  * perclient: receive probe traffic
    * send to processing server / relaying probe


===============================================================================
PROCESSING SERVER
===============================================================================

root process
* fork/connect redis
* fork "probes server"
* fork "viz clients server"
* wait childs

probes server
* listen UDP
* droppriv + chroot
* event loop
  * accept connection (glouglou)
    * client auth (static password, encryption in the future)
  * perclient: receive probes traffic
    * write to redis

viz clients server
* listen TCP
* droppriv + chroot
* event loop
  * accept connection
    * client auth (static password, TLS with EDH)
  * perclient: build network graph
    * read redis data
    * create internal graph
  * perclient: receive client configuration
  * perclient: send full graph
  * perclient loop: receive redis notifications and update internal graph
  * perclient loop: send graph updates
  * perclient loop: send graph updates
  * perclient loop: receive client configuration updates


===============================================================================
VIZ CLIENT
===============================================================================

* connect to processing server
* send configuration
* receive full graph
* event loop
  * receive graph updates
  * send configuration updates
  * render graph


===============================================================================
GLOUGLOU NEW MODULAR ARCHITECTURE (XXX IN PROGRESS)
===============================================================================

Probe [code]
* capture events
* send events
* glouglou protocol module ID
Network capture probe plugins
* callback for pcap fd event
* additional glouglou protocol module ID

^
| report with glouglou protocol
v

Processing server [code]
*
* glouglou protocol module ID
* redis db representation
* to viz client: depends on module ID and client configuration
  * per client internal representation
  * communication protocol to client

^
| publish with dedicated viz/data protocol [spec]
v

Viz client - visualise events [spec]
* different layouts, depends on module ID and client configuration
  * communication protocol from processing server
  * rendering method

Module structure
================

= NEW NEW

== gg_net_probe.[c,sh,py]
* main()
probe_callbacks->cb_event = cb_event;
gg = gg_probe_connect(server_ip, server_port, probe_callbacks)
gg_probe_send(gg, packet
* cb_event(struct gg)
gg_probe_send()

== gg_net_probe_mod_ss7.[c,sh,py]
* struct gg_net_probe_mod_conf
* cb_pcap(int fd)
  /* test ss7 layer */
  /* send MODULE_NETWORK_SS7 glouglou packets */

== glougloud.c
* main()
  fork

== glougloud_mod_net.[c,sh,py]
* cb_probes(struct gg_event)
    module ID
    redis_write()
    pipe_write()
* cb_redis(struct redis_notification)
    gs-netstream_send() / json_send() /* depends on client conf and Viz client protocol */
* cb_vizcli_config_change(struct myconfig)
    update_client_conf()

== gg_viz_client.[c,sh,py]
* module ID

= NEW

netviz_probe.[c,sh,py]
* cb_ggmod_init(struct gg)
  setup libevent callbacks
* cb_ggmod_event(struct gg)
    gg_send()

netviz_processing.[c,sh,py]
* cb_ggmod_probes_event(struct gg_event)
    redis_write()
* cb_vizcli_redis(struct redis_notification)
    /* depends on client conf and Viz client protocol */
    gs-netstream_send() / json_send()
* cb_vizcli_config_change(struct myconfig)
    update_client_conf()

netviz.ggspec
* Probes <-> Processing server
  * glouglou module ID

Viz clients are modulare separately
* base viz client graph (protocol=GraphStream)
* base viz client text (protocol=JSON)
* per module configuration, push via HTTP JSON POST

= OLD

* Publish
  * protocol choice (graphstream, json data [plugin])
  * redis record path -> publish update
  * filter redis records with client configuration spec
* Viz client
  * rendering method choice (graph, data text)

ggprobe.c / ggprobe.sh / ggprobe.py
  event_cb()
    gg_send()
proto_report.ggspec
processing.ggspec
  event
proto_publish.ggspec
viz.ggspec

Example: Network Viz
====================

netviz_probe.c
  capture = pcap code

netviz_processing.c

netviz.ggspec
  glouglou module ID = 0x01

Viz client
* web graph
* egraph
* Qt client


===============================================================================
GLOUGLOU PROTOCOL
===============================================================================

* version
  PACKET_VERSION = 0x03
* module ID
  MODULE_NETWORK = 0x00,
  MODULE_PROCESS = 0x01,
* message type
  MODULE_NETWORK:
    PACKET_NEWCONN = 0x01,
    PACKET_DELCONN = 0x02,
    PACKET_DATA    = 0x03,
    PACKET_NAME    = 0x04,
    PACKET_TRACE   = 0x05,
  MODULE_PROCESS:
    PACKET_FORK = 0x01,
    PACKET_EXEC = 0x02,
    PACKET_EXIT = 0x03,

MODULE_NETWORK:

PACKET_NEWCONN
	u_int32_t       src;
	u_int8_t        src_port;
	u_int32_t       dst;
	u_int8_t        dst_port;
PACKET_DELCONN
	u_int32_t       src;
	u_int8_t        src_port;
	u_int32_t       dst;
	u_int8_t        dst_port;
PACKET_DATA
	u_int32_t       src;
	u_int8_t        src_port;
	u_int32_t       dst;
	u_int8_t        dst_port;
	u_int8_t        size;
PACKET_NAME
PACKET_TRACE

===============================================================================
GLOUGLOU DATABASE
===============================================================================

n/10.0.0.1-router
n/10.0.0.2-
n/192.168.1.3-
n/192.168.1.254-internet gateway
c/10.0.0.1-1234-10.0.0.2-80
p/10.0.0.1-10.0.0.2
p/10.0.0.1-192.168.1.3-192.168.1.254
d/10.0.0.1-1234-10.0.0.2-80/3
d/10.0.0.1-1234-10.0.0.2-80/12