File size: 9,783 Bytes
7c89ed7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
---
version: '3.7'
services:
  elasticsearch:
    image: mozdef/mozdef_elasticsearch
    build:
      context: ../../
      dockerfile: docker/compose/elasticsearch/Dockerfile
      cache_from:
        - mozdef/mozdef_elasticsearch
        - mozdef_elasticsearch:latest
    healthcheck:
      test: ["CMD", "curl", "-f", "127.0.0.1:9200"]
      interval: 30s
      timeout: 3s
      retries: 10
    command: bin/elasticsearch
    restart: always
    volumes:
      - elasticsearch:/var/lib/elasticsearch
    # ports:
    #   - 9200:9200
    networks:
      - default
  rabbitmq:
    image: mozdef/mozdef_rabbitmq
    build:
      context: ../../
      dockerfile: docker/compose/rabbitmq/Dockerfile
      cache_from:
        - mozdef/mozdef_rabbitmq
        - mozdef_rabbitmq:latest
    healthcheck:
      test: ["CMD", "curl", "-f", "127.0.0.1:15672"]
      interval: 30s
      timeout: 3s
      retries: 10
    restart: always
    command: rabbitmq-server
    volumes:
      - rabbitmq:/var/lib/rabbitmq
    # ports:
    #   - 5672:5672
    #   - 15672:15672 # Admin interface
    networks:
      - default
  mongodb:
    image: mozdef/mozdef_mongodb
    build:
      context: ../../
      dockerfile: docker/compose/mongodb/Dockerfile
      cache_from:
        - mozdef/mozdef_mongodb
        - mozdef_mongodb:latest
    healthcheck:
      test: ["CMD", "curl", "-f", "127.0.0.1:3002"]
      interval: 30s
      timeout: 3s
      retries: 10
    restart: always
    command: /usr/bin/mongod --smallfiles --config /etc/mongod.conf
    volumes:
      - mongodb:/var/lib/mongo
    # ports:
    #   - 3002:3002
    networks:
      - default
  kibana:
    image: mozdef/mozdef_kibana
    build:
      context: ../../
      dockerfile: docker/compose/kibana/Dockerfile
      cache_from:
        - mozdef/mozdef_kibana
        - mozdef_kibana:latest
    healthcheck:
      test: ["CMD", "curl", "-f", "127.0.0.1:5601"]
      interval: 30s
      timeout: 3s
      retries: 10
    restart: always
    command: bin/kibana --elasticsearch=http://elasticsearch:9200
    depends_on:
      - elasticsearch
    networks:
      - default
  nginx:
    image: mozdef/mozdef_nginx
    build:
      context: ../../
      dockerfile: docker/compose/nginx/Dockerfile
      cache_from:
        - mozdef/mozdef_nginx
        - mozdef_nginx:latest
    healthcheck:
      test: ["CMD", "curl", "-f", "127.0.0.1"]
      interval: 30s
      timeout: 3s
      retries: 10
    restart: always
    command: /usr/sbin/nginx
    depends_on:
      - kibana
      - meteor
    ports:
      - "0.0.0.0:80:80"
      - "0.0.0.0:8080:8080"
      - "0.0.0.0:9090:9090"
      - "0.0.0.0:8081:8081"
    networks:
      - default

  # MozDef Specific Containers
  base:
    image: mozdef/mozdef_base
    build:
      context: ../../
      dockerfile: docker/compose/mozdef_base/Dockerfile
      cache_from:
        - mozdef/mozdef_base
        - mozdef_base:latest
  bootstrap:
    image: mozdef/mozdef_bootstrap
    build:
      context: ../../
      dockerfile: docker/compose/mozdef_bootstrap/Dockerfile
      cache_from:
        - mozdef/mozdef_bootstrap
        - mozdef_bootstrap:latest
    command: bash -c 'while ! timeout 1 bash -c "echo > /dev/tcp/elasticsearch/9200";do sleep 1;done && python initial_setup.py http://elasticsearch:9200 http://kibana:5601'
    depends_on:
      - base
      - elasticsearch
    environment:
      - ES_URL=http://localhost:9200
    networks:
      - default
  alertactions:
    image: mozdef/mozdef_alertactions
    build:
      context: ../../
      dockerfile: docker/compose/mozdef_alertactions/Dockerfile
      cache_from:
        - mozdef/mozdef_alertactions
        - mozdef_alertactions:latest
    healthcheck:
      test: "[[ $$(pgrep python | wc -l) -ge 1 ]]"
      interval: 30s
      timeout: 3s
      retries: 10
    restart: always
    command: bash -c 'while ! timeout 1 bash -c "echo > /dev/tcp/elasticsearch/9200";do sleep 1;done && python alert_actions_worker.py -c alert_actions_worker.conf'
    depends_on:
      - base
      - elasticsearch
      - rabbitmq
      - alerts
      - bootstrap
    networks:
      - default
  alerts:
    image: mozdef/mozdef_alerts
    build:
      context: ../../
      dockerfile: docker/compose/mozdef_alerts/Dockerfile
      cache_from:
        - mozdef/mozdef_alerts
        - mozdef_alerts:latest
    healthcheck:
      test: "celery inspect ping -A lib.tasks"
      interval: 30s
      timeout: 6s
      retries: 10
    restart: always
    command: bash -c 'while ! timeout 1 bash -c "echo > /dev/tcp/elasticsearch/9200";do sleep 1;done && celery -A lib.tasks worker --loglevel=info --beat'
    depends_on:
      - base
      - elasticsearch
      - rabbitmq
      - bootstrap
    networks:
      - default
  # bot:
  #   image: mozdef/mozdef_bot
  #   build:
  #     context: ../../
  #     dockerfile: docker/compose/mozdef_bot/Dockerfile
  #     cache_from:
  #       - mozdef/mozdef_bot
  #       - mozdef_bot:latest
  #     args:
  #       # This is either 'irc', or 'slack'
  #       BOT_TYPE: slack
  #   restart: always
  #   command: bash -c 'while ! timeout 1 bash -c "echo > /dev/tcp/rabbitmq/5672";do sleep 1;done && python mozdefbot.py -c mozdefbot.conf'
  #   depends_on:
  #     - base
  #     - rabbitmq
  #     - alerts
  #     - bootstrap
  #   networks:
  #     - default
  #   volumes:
  #     - geolite_db:/opt/mozdef/envs/mozdef/data/
  cron:
    image: mozdef/mozdef_cron
    build:
      context: ../../
      dockerfile: docker/compose/mozdef_cron/Dockerfile
      cache_from:
        - mozdef/mozdef_cron
        - mozdef_cron:latest
    healthcheck:
      test: "[[ $$(pgrep crond | wc -l) -eq 1 ]]"
      interval: 30s
      timeout: 3s
      retries: 10
    restart: always
    command: bash -c 'while ! timeout 1 bash -c "echo > /dev/tcp/elasticsearch/9200";do sleep 1;done && crond -n'
    volumes:
      - geolite_db:/opt/mozdef/envs/mozdef/data/
    depends_on:
      - base
      - rabbitmq
      - elasticsearch
      - mongodb
      - bootstrap
    networks:
      - default
  loginput:
    image: mozdef/mozdef_loginput
    build:
      context: ../../
      dockerfile: docker/compose/mozdef_loginput/Dockerfile
      cache_from:
        - mozdef/mozdef_loginput
        - mozdef_loginput:latest
    healthcheck:
      test: ["CMD", "curl", "-f", "127.0.0.1:8080/status"]
      interval: 30s
      timeout: 3s
      retries: 10
    restart: always
    command: bash -c 'while ! timeout 1 bash -c "echo > /dev/tcp/elasticsearch/9200";do sleep 1;done && python index.py -c index.conf'
    depends_on:
      - base
      - elasticsearch
      - rabbitmq
      - bootstrap
    networks:
      - default
  mq_worker:
    image: mozdef/mozdef_mq_worker
    build:
      context: ../../
      dockerfile: docker/compose/mozdef_mq_worker/Dockerfile
      cache_from:
        - mozdef/mozdef_mq_worker
        - mozdef_mq_worker:latest
    healthcheck:
      test: "[[ $$(pgrep python | wc -l) -ge 1 ]]"
      interval: 30s
      timeout: 3s
      retries: 10
    restart: always
    command: bash -c 'while ! timeout 1 bash -c "echo > /dev/tcp/elasticsearch/9200";do sleep 1;done && python esworker_eventtask.py -c esworker_eventtask.conf'
    depends_on:
      - base
      - rabbitmq
      - elasticsearch
      - loginput
      - bootstrap
    networks:
      - default
    volumes:
      - geolite_db:/opt/mozdef/envs/mozdef/data/
  meteor:
    image: mozdef/mozdef_meteor
    build:
      context: ../../
      dockerfile: docker/compose/mozdef_meteor/Dockerfile
      cache_from:
        - mozdef/mozdef_meteor
        - mozdef_meteor:latest
    healthcheck:
      test: ["CMD", "curl", "-f", "127.0.0.1:3000"]
      interval: 30s
      timeout: 3s
      retries: 10
    restart: always
    command: bash -c 'node bundle/main.js'
    depends_on:
      - mongodb
      - rest
    networks:
      - default
  rest:
    image: mozdef/mozdef_rest
    build:
      context: ../../
      dockerfile: docker/compose/mozdef_rest/Dockerfile
      cache_from:
        - mozdef/mozdef_rest
        - mozdef_rest:latest
    healthcheck:
      test: ["CMD", "curl", "-f", "127.0.0.1:8081/status"]
      interval: 30s
      timeout: 3s
      retries: 10
    restart: always
    command: bash -c 'while ! timeout 1 bash -c "echo > /dev/tcp/elasticsearch/9200";do sleep 1;done && python index.py -c index.conf'
    depends_on:
      - base
      - elasticsearch
      - mongodb
      - bootstrap
    networks:
      - default
  syslog:
    image: mozdef/mozdef_syslog
    build:
      context: ../../
      dockerfile: docker/compose/mozdef_syslog/Dockerfile
      cache_from:
        - mozdef/mozdef_syslog
        - mozdef_syslog:latest
    healthcheck:
      test: ["CMD-SHELL", "echo > /dev/tcp/localhost/514"]
      interval: 30s
      timeout: 3s
      retries: 10
    restart: always
    command: bash -c 'while ! timeout 1 bash -c "echo > /dev/tcp/rabbitmq/5672";do sleep 1;done && sleep 30 && /usr/sbin/syslog-ng --no-caps -F'
    depends_on:
      - loginput
    ports:
      - 514:514/udp
      - 514:514
    networks:
      - default
  tester:
    image: mozdef/mozdef_tester
    build:
      context: ../../
      dockerfile: docker/compose/tester/Dockerfile
      cache_from:
        - mozdef/mozdef_tester
        - mozdef_tester:latest
    networks:
      - default
  cognito_proxy:
    image: mozdef/mozdef_cognito_proxy
    build:
      context: ../../
      dockerfile: docker/compose/mozdef_cognito_proxy/Dockerfile
    healthcheck:
      test: ["CMD", "curl", "-f", "127.0.0.1"]
      interval: 30s
      timeout: 3s
      retries: 10
    command: bash -c 'exit 0'
    networks:
      - default
volumes:
  elasticsearch:
  rabbitmq:
  mongodb:
  geolite_db:

networks:
  default: