Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
402 lines (383 loc) · 12.1 KB
/
Copy pathdocker-compose.yml
File metadata and controls
402 lines (383 loc) · 12.1 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
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
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
x-environment: &default-env
ENVIRONMENT: ${ENVIRONMENT:-prod}
POSTGRES_HOSTNAME: ${POSTGRES_HOSTNAME:-postgres}
POSTGRES_PORT: ${POSTGRES_PORT:-5432}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB:-misp}
OPENSEARCH_HOSTNAME: ${OPENSEARCH_HOSTNAME:-opensearch}
OPENSEARCH_PORT: ${OPENSEARCH_PORT:-9200}
OPENSEARCH_INITIAL_ADMIN_PASSWORD: ${OPENSEARCH_INITIAL_ADMIN_PASSWORD}
OPENSEARCH_USERNAME: ${OPENSEARCH_USERNAME:-}
OPENSEARCH_PASSWORD: ${OPENSEARCH_PASSWORD:-}
OAUTH2_SECRET_KEY: ${OAUTH2_SECRET_KEY:-}
OAUTH2_REFRESH_SECRET_KEY: ${OAUTH2_REFRESH_SECRET_KEY:-}
OAUTH2_CREDS_FILE: ${OAUTH2_CREDS_FILE:-/var/lib/misp-workbench/oauth-creds/oauth2.json}
OAUTH2_ALGORITHM: ${OAUTH2_ALGORITHM:-HS256}
OAUTH2_ACCESS_TOKEN_EXPIRE_MINUTES: ${OAUTH2_ACCESS_TOKEN_EXPIRE_MINUTES:-30}
OAUTH2_REFRESH_TOKEN_EXPIRE_DAYS: ${OAUTH2_REFRESH_TOKEN_EXPIRE_DAYS:-7}
REDIS_HOSTNAME: ${REDIS_HOSTNAME:-redis}
REDIS_PORT: ${REDIS_PORT:-6379}
REDIS_CACHE_DB: ${REDIS_CACHE_DB:-0}
CELERY_BROKER_URL: redis://${REDIS_HOSTNAME:-redis}:${REDIS_PORT:-6379}/${REDIS_CELERY_DB:-0}
CELERY_RESULT_BACKEND: redis://${REDIS_HOSTNAME:-redis}:${REDIS_PORT:-6379}/${REDIS_CELERY_DB:-1}
MODULES_HOST: ${MODULES_HOST:-modules}
MODULES_PORT: ${MODULES_PORT:-6666}
MCP_AUTH_ENABLED: ${MCP_AUTH_ENABLED:-false}
STORAGE_ENGINE: ${STORAGE_ENGINE:-local}
S3_ENDPOINT: ${S3_ENDPOINT:-garage:3900}
S3_BUCKET: ${S3_BUCKET:-attachments}
S3_ACCESS_KEY: ${S3_ACCESS_KEY:-}
S3_SECRET_KEY: ${S3_SECRET_KEY:-}
S3_SECURE: ${S3_SECURE:-false}
GARAGE_ADMIN_URL: ${GARAGE_ADMIN_URL:-http://garage:3903}
GARAGE_ADMIN_TOKEN: ${GARAGE_ADMIN_TOKEN}
GARAGE_METRICS_TOKEN: ${GARAGE_METRICS_TOKEN}
FLOWER_BASIC_AUTH: ${FLOWER_BASIC_AUTH}
MAIL_USERNAME: ${MAIL_USERNAME}
MAIL_PASSWORD: ${MAIL_PASSWORD}
MAIL_PORT: ${MAIL_PORT}
MAIL_SERVER: ${MAIL_SERVER}
MAIL_FROM: ${MAIL_FROM:-}
LOG_LEVEL: ${LOG_LEVEL:-INFO}
CORS_ORIGINS: ${CORS_ORIGINS:-}
LAB_CODE_ROOT: ${LAB_CODE_ROOT:-/code}
services:
postgres:
image: postgres:16.3
restart: unless-stopped
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_DB: ${POSTGRES_DB:-misp}
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 10s
timeout: 5s
retries: 5
networks:
- backend
opensearch:
image: opensearchproject/opensearch:3.4.0
restart: unless-stopped
environment:
- cluster.name=opensearch-cluster
- node.name=opensearch-misp1
- discovery.type=single-node
- bootstrap.memory_lock=true
- "OPENSEARCH_JAVA_OPTS=-Xms2g -Xmx2g"
- OPENSEARCH_INITIAL_ADMIN_PASSWORD=${OPENSEARCH_INITIAL_ADMIN_PASSWORD}
- DISABLE_SECURITY_PLUGIN=false
- plugins.security.ssl.http.enabled=true
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
ports:
- "9200:9200"
- "9600:9600"
healthcheck:
test:
[
"CMD-SHELL",
"curl -s --user admin:$$OPENSEARCH_INITIAL_ADMIN_PASSWORD --cacert /usr/share/opensearch/config/root-ca.pem -X GET https://localhost:9200/_cluster/health?pretty | grep '\"status\" : \"green\"'"
]
interval: 10s
timeout: 10s
retries: 20
networks:
- backend
volumes:
- os_data:/usr/share/opensearch/data
- os_logs:/usr/share/opensearch/logs
setup-opensearch:
image: curlimages/curl:latest
depends_on:
opensearch:
condition: service_healthy
volumes:
- ./opensearch/mappings:/mappings
- ./opensearch/pipelines:/pipelines
- ./opensearch/index-patterns:/index-patterns
- ./opensearch/index-templates:/index-templates
- ./opensearch/visualizations:/visualizations
- ./opensearch/dashboards:/dashboards
- ./opensearch/entrypoint.sh:/entrypoint.sh
entrypoint: ["/bin/sh", "/entrypoint.sh"]
environment:
<<: *default-env
OPENSEARCH_INITIAL_ADMIN_PASSWORD: ${OPENSEARCH_INITIAL_ADMIN_PASSWORD}
OPENSEARCH_DASHBOARDS_PASSWORD: ${OPENSEARCH_DASHBOARDS_PASSWORD}
networks:
- backend
redis:
image: redis:7-alpine
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
networks:
- backend
garage:
image: dxflrs/garage:v2.2.0
restart: unless-stopped
ports:
- "3900:3900"
- "3903:3903"
volumes:
- garage-data:/var/lib/garage/data
- garage-meta:/var/lib/garage/meta
- ./garage.toml:/etc/garage.toml:ro
healthcheck:
# The image ships the garage binary alone (no shell, no curl): ask the
# node itself, which fails when it can't reach its own RPC.
test: ["CMD", "/garage", "status"]
interval: 10s
timeout: 5s
retries: 5
networks:
- backend
api:
build:
context: ./api
restart: unless-stopped
ports:
- "8080:80"
environment:
<<: *default-env
entrypoint: ["bash", "-c", "./entrypoint.sh"]
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
setup-opensearch:
condition: service_completed_successfully
volumes:
- attachments-data:/tmp/attachments
- garage-creds:/var/lib/misp-workbench/secrets
- oauth-creds:/var/lib/misp-workbench/oauth-creds
networks:
- backend
- frontend
worker:
build:
context: ./api
# User-triggered work (default ``celery`` queue) and frequent periodic
# jobs (``maintenance``).
command: poetry run celery -A app.worker.tasks worker --loglevel=info --hostname worker@%h --queues=celery,maintenance -E --autoscale=4,10
restart: unless-stopped
environment:
<<: *default-env
depends_on:
- api
- redis
- postgres
volumes:
- attachments-data:/tmp/attachments
- garage-creds:/var/lib/misp-workbench/secrets
- oauth-creds:/var/lib/misp-workbench/oauth-creds
networks:
- backend
ingest-worker:
build:
context: ./api
# Feed fetches and server pulls (and their correlation follow-ups) on the
# dedicated ``ingest`` queue, so a large feed can only take this worker's
# slots and never holds up user actions or periodic jobs. How many feeds
# ingest at once is the ``ingest.max_concurrent_runs`` runtime setting.
command: poetry run celery -A app.worker.tasks worker --loglevel=info --hostname ingest@%h --queues=ingest -E --concurrency=4
# A stop lets the batches in progress finish (a few minutes for large
# events) instead of killing them; killed ones are revived after a while.
stop_grace_period: 5m
restart: unless-stopped
environment:
<<: *default-env
depends_on:
- api
- redis
- postgres
volumes:
- attachments-data:/tmp/attachments
- garage-creds:/var/lib/misp-workbench/secrets
- oauth-creds:/var/lib/misp-workbench/oauth-creds
networks:
- backend
bulk-worker:
build:
context: ./api
# Rebuilds and reloads that walk everything (correlations, indicators,
# lookup cache, warninglists, galaxies, taxonomies, retention) on the
# ``bulk`` queue, so an hour-long rebuild never delays the frequent
# periodic jobs on ``maintenance``.
command: poetry run celery -A app.worker.tasks worker --loglevel=info --hostname bulk@%h --queues=bulk -E --concurrency=2
restart: unless-stopped
environment:
<<: *default-env
depends_on:
- api
- redis
- postgres
volumes:
- attachments-data:/tmp/attachments
- garage-creds:/var/lib/misp-workbench/secrets
- oauth-creds:/var/lib/misp-workbench/oauth-creds
networks:
- backend
reactor-worker:
build:
context: ./api
# Dedicated, isolated worker for Tech Lab reactor scripts. The
# ``reactor_sandbox`` queue is the only thing this consumer subscribes to.
command: poetry run celery -A app.worker.tasks worker --loglevel=info --hostname reactor@%h --queues=reactor_sandbox --concurrency=2 -E
restart: unless-stopped
environment:
<<: *default-env
depends_on:
- api
- redis
- postgres
# Resource limits for untrusted user code.
mem_limit: 256m
pids_limit: 64
volumes:
- garage-creds:/var/lib/misp-workbench/secrets
- oauth-creds:/var/lib/misp-workbench/oauth-creds
networks:
- backend
sinks-worker:
build:
context: ./api
# Delivers published indicators to outbound sinks (SIEMs, webhooks) on the
# dedicated ``sinks`` queue, so a slow or unreachable destination never
# ties up the workers that ingest and correlate. Network-bound, so threads.
command: poetry run celery -A app.worker.tasks worker --loglevel=info --hostname sinks@%h --queues=sinks --pool=threads --concurrency=4 -E
restart: unless-stopped
environment:
<<: *default-env
depends_on:
- api
- redis
- postgres
volumes:
- garage-creds:/var/lib/misp-workbench/secrets
- oauth-creds:/var/lib/misp-workbench/oauth-creds
networks:
- backend
lab-worker:
build:
context: ./api
args:
POETRY_GROUPS: lab
# Dedicated worker for Tech Lab notebook kernels. Threadpool — not
# prefork — because all kernels share one Python process; any thread
# must be able to drive any kernel via the in-memory KernelManager
# registry. Prefork would shard the registry across N subprocesses.
command: poetry run celery -A app.worker.tasks worker --loglevel=info --hostname lab@%h --queues=lab_kernel --pool=threads --concurrency=8 -E
restart: unless-stopped
environment:
<<: *default-env
depends_on:
- api
- redis
- postgres
mem_limit: 512m
pids_limit: 256
volumes:
- garage-creds:/var/lib/misp-workbench/secrets
- oauth-creds:/var/lib/misp-workbench/oauth-creds
networks:
- backend
beat:
build:
context: ./api
command: poetry run celery -A app.worker.tasks beat --loglevel=info --scheduler redbeat.RedBeatScheduler
restart: unless-stopped
environment:
<<: *default-env
depends_on:
- api
- redis
- postgres
volumes:
- attachments-data:/tmp/attachments
- garage-creds:/var/lib/misp-workbench/secrets
- oauth-creds:/var/lib/misp-workbench/oauth-creds
networks:
- backend
flower:
build:
context: ./api
command: poetry run celery -A app.worker.tasks flower --loglevel=info --persistent=True --auto_refresh=True --state_save_interval=30000
ports:
- "5555:5555"
environment:
<<: *default-env
depends_on:
- worker
volumes:
- oauth-creds:/var/lib/misp-workbench/oauth-creds
networks:
- backend
- frontend
frontend:
build:
context: ./frontend
restart: unless-stopped
ports:
- "3000:80"
environment:
API_HOST: api
depends_on:
- api
networks:
- frontend
dashboards:
image: opensearchproject/opensearch-dashboards:3.4.0
environment:
ENVIRONMENT: ${ENVIRONMENT:-prod}
OPENSEARCH_HOSTS: "https://${OPENSEARCH_HOSTNAME:-opensearch}:${OPENSEARCH_PORT:-9200}"
OPENSEARCH_DASHBOARDS_PASSWORD: ${OPENSEARCH_DASHBOARDS_PASSWORD}
ports:
- "5601:5601"
depends_on:
- opensearch
healthcheck:
test:
[
"CMD-SHELL",
"curl -s --user admin:$$OPENSEARCH_DASHBOARDS_PASSWORD -k -X GET https://localhost:5601/api/status | grep '\"state\":\"green\"'"
]
interval: 15s
timeout: 15s
retries: 40
start_period: 60s
networks:
- backend
- frontend
modules:
image: ghcr.io/misp/misp-docker/misp-modules:latest
environment:
REDIS_BACKEND: redis
depends_on:
redis:
condition: service_healthy
networks:
- backend
volumes:
opensearch-data:
postgres-data:
garage-data:
garage-meta:
attachments-data:
garage-creds:
oauth-creds:
os_data:
os_logs:
networks:
backend:
frontend: