Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
843 lines (819 loc) · 38.7 KB
/
Copy pathdocker-compose.yml
File metadata and controls
843 lines (819 loc) · 38.7 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
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
# Shared log-rotation policy. Docker's default json-file driver ships NO
# rotation, so container logs grow unbounded until the host disk fills and
# the whole stack crashes. Cap every long-running service at 3×10MB.
# Compose has no top-level logging default, so this anchor is applied
# per-service via ``logging: *default-logging`` below.
x-logging: &default-logging
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
services:
# LiteLLM Proxy — LLM API Gateway
# Handles model routing, authentication, usage tracking, billing
litellm:
image: ghcr.io/bittersecurity/decepticon-litellm:${DECEPTICON_VERSION:-latest}
build:
context: .
dockerfile: containers/litellm.Dockerfile
# #216: parameterize via DECEPTICON_STACK_NAME. Unset → ``decepticon-litellm``
# (today's name verbatim). ``DECEPTICON_STACK_NAME=stack2`` →
# ``decepticon-stack2-litellm``. The ``${VAR:+-${VAR}}`` form emits the
# dash prefix only when the variable is set so the default stays stable.
# Using a Decepticon-scoped var instead of COMPOSE_PROJECT_NAME because
# Compose auto-populates COMPOSE_PROJECT_NAME from the project directory
# (``Decepticon`` → ``decepticon``), which would produce
# ``decepticon-decepticon-litellm`` on every default run.
container_name: decepticon${DECEPTICON_STACK_NAME:+-${DECEPTICON_STACK_NAME}}-litellm
volumes:
- ./config/litellm.yaml:/app/config.yaml:ro
- ${CLAUDE_CREDENTIALS_VOLUME:-/dev/null}:/root/.claude/.credentials.json
- ${CODEX_AUTH_VOLUME:-/dev/null}:/root/.codex/auth.json
entrypoint: ["python", "/app/litellm_startup.py"]
command: ["--config", "/app/config.yaml", "--port", "4000"]
ports:
- "127.0.0.1:${LITELLM_PORT:-4000}:4000"
env_file: .env
environment:
- LITELLM_MASTER_KEY=${LITELLM_MASTER_KEY:-sk-decepticon-master}
- LITELLM_SALT_KEY=${LITELLM_SALT_KEY:-sk-decepticon-salt-change-me}
- CODEX_AUTH_PATH=/root/.codex/auth.json
- DATABASE_URL=postgresql://decepticon:${POSTGRES_PASSWORD:-decepticon}@postgres:5432/litellm
depends_on:
postgres:
condition: service_healthy
# Cold-start cost (prisma migrate + model-routing load + uvicorn bind):
# measured 136s on a fresh PostgreSQL volume; varies with disk speed.
# start_period absorbs environment variability — failures during this
# window don't count toward retries. test success at any moment flips
# healthy immediately, so the cushion costs no time on fast hosts.
# retries is the post-cushion grace for transient failures only;
# the launcher's --wait-timeout (DECEPTICON_STARTUP_TIMEOUT_SECONDS)
# is the single user-facing patience knob.
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:4000/health/readiness')"]
interval: 5s
timeout: 3s
retries: 12
start_period: ${DECEPTICON_STARTUP_TIMEOUT_SECONDS:-600}s
extra_hosts:
- "host.docker.internal:host-gateway"
networks:
- decepticon-net
restart: unless-stopped
logging: *default-logging
# PostgreSQL — Persistent storage for LiteLLM
# Stores: virtual keys, spend logs, user budgets, rate limits
postgres:
image: postgres:17-alpine
container_name: decepticon${DECEPTICON_STACK_NAME:+-${DECEPTICON_STACK_NAME}}-postgres
# Working set is tiny (LiteLLM spend logs, shared_buffers=32MB).
# Cap so a runaway query can't starve the host; 2g leaves ample headroom.
mem_limit: 2g
environment:
POSTGRES_DB: litellm
POSTGRES_USER: decepticon
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-decepticon}
# Keep shared_buffers small — Decepticon stores only LiteLLM spend
# logs here; the working set fits in 32MB.
# Default (128MB) wastes RAM in this context. work_mem is lowered
# from the 4MB default because queries are simple key-value lookups.
POSTGRES_INITDB_ARGS: "--data-checksums"
command:
- "postgres"
- "-c"
- "shared_buffers=32MB"
- "-c"
- "work_mem=2MB"
- "-c"
- "effective_cache_size=128MB"
- "-c"
- "maintenance_work_mem=32MB"
volumes:
- postgres_data:/var/lib/postgresql/data
# Init scripts run on first startup only (empty data volume).
- ./containers/postgres-init:/docker-entrypoint-initdb.d:ro
ports:
- "127.0.0.1:${POSTGRES_PORT:-5432}:5432"
networks:
- decepticon-net
restart: unless-stopped
logging: *default-logging
healthcheck:
test: ["CMD-SHELL", "pg_isready -U decepticon -d litellm"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
# Neo4j — Attack Chain Graph (the agent's persistent working memory)
# On sandbox-net so cypher-shell from inside sandbox reaches bolt://neo4j:7687
neo4j:
# Pin the patch release: the mutable 5.26 tag currently resolves to
# 5.26.29, whose JVM exits with SIGBUS during startup on WSL2.
image: neo4j:5.26.28-community
container_name: decepticon${DECEPTICON_STACK_NAME:+-${DECEPTICON_STACK_NAME}}-neo4j
# heap_max 256m + pagecache 64m + JVM/APOC off-heap ≈ <1g nominal.
# 2g caps the JVM so a large attack-graph scan can't swap-thrash the host.
mem_limit: 2g
environment:
NEO4J_AUTH: neo4j/${NEO4J_PASSWORD:-decepticon-graph}
NEO4J_server_memory_heap_initial__size: 64m
NEO4J_server_memory_heap_max__size: 256m
NEO4J_server_memory_pagecache_size: 64m
NEO4J_PLUGINS: '["apoc"]'
# ──────────────────────────────────────────────────────────────────
# APOC hardening - see docs/security/neo4j-hardening.md.
#
# PRIOR CONFIG (REMOVED, do NOT re-add):
# NEO4J_dbms_security_procedures_unrestricted: apoc.*
# NEO4J_apoc_export_file_enabled: "true"
# NEO4J_apoc_import_file_enabled: "true"
#
# Neo4j is dual-homed across sandbox-net AND decepticon-net to let
# the orchestrator on management read findings written from inside
# the sandbox. Allowing arbitrary APOC procedures - especially the
# file-I/O family - turns that bridge into a sandbox→management
# pivot path: a prompt-injection-driven Cypher payload can issue
# CALL apoc.cypher.runFile('file:///proc/self/environ')
# or
# CALL apoc.export.csv.query(..., 'file:///root/.config/...')
# and exfiltrate management-plane secrets.
#
# The new posture is allowlist-only. File-I/O, cross-database, and
# trigger procedures are unreachable from Cypher. Safe query
# builders (collection / text / path / merge / refactor / periodic)
# remain available for the kg_add_node / kg_add_edge tool surface.
NEO4J_dbms_security_procedures_allowlist: >-
apoc.coll.*,apoc.text.*,apoc.path.*,apoc.create.*,
apoc.merge.*,apoc.refactor.*,apoc.periodic.iterate,
apoc.lock.*,apoc.case,apoc.do.case,apoc.do.when,apoc.when,
apoc.help,apoc.version,apoc.diff.*,apoc.label.*,
apoc.node.*,apoc.nodes.*,apoc.rel.*,apoc.util.*
# Strict config validation - refuse to boot on unknown / misspelled
# config keys so accidental re-introduction of `_unrestricted`
# under a typo (e.g. `unrestricted`) cannot silently re-open the
# sandbox→management bridge.
NEO4J_server_config_strict__validation_enabled: "true"
# Lock HTTP API access to localhost (the orchestrator talks to
# Neo4j over Bolt, not HTTP). The Neo4j browser binding lives on
# 127.0.0.1 below; this disables the HTTP API for
# any other origin.
NEO4J_server_http_listen__address: "0.0.0.0:7474"
NEO4J_dbms_security_http__access__control__allow__origin: ""
volumes:
- neo4j_data:/data
- neo4j_logs:/logs
ports:
- "127.0.0.1:${NEO4J_HTTP_PORT:-7474}:7474"
- "127.0.0.1:${NEO4J_BOLT_PORT:-7687}:7687"
networks:
- sandbox-net
- decepticon-net
healthcheck:
test: ["CMD-SHELL", "wget -q --spider http://localhost:7474 || exit 1"]
interval: 5s
timeout: 5s
retries: 12
start_period: 90s
restart: unless-stopped
logging: *default-logging
# Evasive Red Team Sandbox
# Isolated container for executing red-team tools (nmap, whois, etc.)
# Runs on sandbox-net only — NO access to infra (litellm, postgres).
# LangGraph reaches sandbox over HTTP at http://sandbox:9999 (FastAPI
# daemon baked into the image). The previous ``docker exec`` transport
# via ``/var/run/docker.sock`` was removed in the HTTP-only migration —
# see decepticon/backends/factory.py for the rationale.
sandbox:
image: ghcr.io/bittersecurity/decepticon-sandbox:${DECEPTICON_VERSION:-latest}
extra_hosts:
- "host.docker.internal:host-gateway"
# Multi-arch image — linux/amd64 + linux/arm64. Apple Silicon and
# Linux arm64 hosts pull the native manifest; no Rosetta needed.
# On an unusual arch the manifest list won't match — force a
# fallback by adding `platform: linux/amd64` to this service.
build:
context: .
dockerfile: containers/sandbox.Dockerfile
args:
# Opt out of the ~1 GB Chromium WAF-escalation tier for lean
# CI / release-verify builds:
# INSTALL_BROWSER=false docker compose build sandbox
INSTALL_BROWSER: ${INSTALL_BROWSER:-true}
# Opt out of the ~290 MB Exploit-DB corpus the same way:
# INSTALL_EXPLOITDB=false docker compose build sandbox
INSTALL_EXPLOITDB: ${INSTALL_EXPLOITDB:-true}
container_name: decepticon${DECEPTICON_STACK_NAME:+-${DECEPTICON_STACK_NAME}}-sandbox
networks:
- sandbox-net
# ──────────────────────────────────────────────────────────────────
# Sandbox hardening - see docs/security/sandbox-isolation.md.
#
# The Kali sandbox runs root inside the container because raw sockets
# (nmap SYN scans, packet capture) require root and the container
# boundary IS the security boundary, not the user boundary. To keep
# that boundary tight:
#
# - cap_drop ALL, then re-add the minimum set the offensive
# toolset actually needs (NET_RAW for SYN scans,
# NET_BIND_SERVICE for low ports, SYS_PTRACE for
# frida/gdb in the Reverser path, SETUID/SETGID for tools like
# msfconsole that drop privileges internally). NET_ADMIN was
# retired with the nftables egress path — OpenShell is the only
# network-boundary authority now.
# - no-new-privileges blocks setuid escalation within the
# container even if a tool ships with a setuid binary.
# - mem_limit caps a runaway scan / fuzzer at 4G so it can't
# starve the management plane.
# - pids_limit was already 1024; kept.
# - read_only: NOT set. The Kali toolset writes to /tmp, /var,
# /root, /workspace. A read_only root with tmpfs everywhere
# would break ~30 tools. Per-engagement container isolation
# (sandbox-isolation.md) is the right structural fix.
cap_drop:
- ALL
cap_add:
- NET_RAW
- NET_BIND_SERVICE
- SYS_PTRACE
- SETUID
- SETGID
- CHOWN
- DAC_OVERRIDE
- FOWNER
- KILL
security_opt:
- no-new-privileges:true
mem_limit: 4g
environment:
# SANDBOX_DAEMON=1 makes containers/sandbox-entrypoint.sh run the
# FastAPI daemon on port 9999 instead of the legacy
# ``tail -f /dev/null`` keep-alive. The entrypoint default is 1
# since the HTTP-only migration; this stanza pins it explicitly so
# ``docker compose config`` shows intent.
- SANDBOX_DAEMON=1
- NEO4J_URI=bolt://neo4j:7687
- NEO4J_USER=neo4j
- NEO4J_PASSWORD=${NEO4J_PASSWORD:-decepticon-graph}
- GHIDRA_INSTALL_DIR=/opt/ghidra
- GHIDRA_MCP_URL=http://127.0.0.1:8089
volumes:
# Bind is engagement-scoped. The launcher sets DECEPTICON_ENGAGEMENT_WORKSPACE
# to <home>/workspace/<slug> after the engagement picker, so the agent only
# ever sees its own engagement at /workspace. When the launcher is not in
# play (raw `make dev`, benchmark harness, dev workflows), the fallback is
# the whole tree under <home>/workspace.
- ${DECEPTICON_ENGAGEMENT_WORKSPACE:-${DECEPTICON_HOME:-~/.decepticon}/workspace}:/workspace
# Skills are no longer baked into this image — they live at
# ``/app/skills/`` in the LANGGRAPH container (see
# ``containers/langgraph.Dockerfile``) and are read in-process by
# ``FilesystemBackend`` via ``CompositeBackend``. The sandbox only
# owns ``/workspace/`` from here on.
pids_limit: 4096
# Run an init process (tini) as PID 1 inside the container. The
# daemon spawns tmux servers and bash shells; when a tmux server
# exits, its bash grandchildren are reparented to PID 1. tini reaps
# those orphans, preventing the <defunct> zombie accumulation that
# eventually exhausts the PID table (fork() -> EAGAIN). This replaces
# an in-process SIGCHLD reaper that raced with the daemon's own
# ``subprocess.run`` calls and clobbered command exit codes to 0.
init: true
depends_on:
neo4j:
condition: service_healthy
restart: unless-stopped
logging: *default-logging
# ── OpenShell gateway (profile: openshell) ──────────────────────────
# Stands up the standing OpenShell gateway so the default sandbox provider
# (openshell, #1178) can admit engagements out of the box. Without it,
# `docker compose` / `make dogfood` never brings up a gateway and the
# openshell resolver stays unbound. See docs/deploy/openshell-gateway.md.
#
# One service definition, both engines, selected by env (default = Docker):
# DECEPTICON_COMPUTE_ENGINE=docker (default; gateway holds the Docker
# socket — rootful is threat A, run the daemon rootless or use podman)
# DECEPTICON_COMPUTE_ENGINE=podman (recommended rootless boundary)
# The engine-specific env (OPENSHELL_* below) is set by
# `make openshell-up ENGINE=...` or the launcher; the Docker defaults here
# make the plain `--profile openshell` path work unchanged.
#
# Data dir /var/lib/openshell is bind-mounted at the SAME absolute path on
# host and container: the gateway extracts the supervisor binary there and
# passes that path to the compute daemon as a host-side bind source, so the
# two paths must match (named volumes can't satisfy this).
openshell-gateway-init:
image: ghcr.io/nvidia/openshell/gateway:${OPENSHELL_GATEWAY_TAG:-latest}
container_name: decepticon${DECEPTICON_STACK_NAME:+-${DECEPTICON_STACK_NAME}}-openshell-init
# One-shot: generate the sandbox JWT signing keys (idempotent; kept if present).
command: ["generate-certs", "--output-dir", "${OPENSHELL_DATA_DIR:-/var/lib/openshell}/tls"]
user: "${OPENSHELL_GATEWAY_USER:-0}"
userns_mode: "${OPENSHELL_GATEWAY_USERNS:-host}"
environment:
HOME: ${OPENSHELL_DATA_DIR:-/var/lib/openshell}
volumes:
- type: bind
source: ${OPENSHELL_DATA_DIR:-/var/lib/openshell}
target: ${OPENSHELL_DATA_DIR:-/var/lib/openshell}
bind:
create_host_path: true
restart: "no"
profiles:
- openshell
openshell-gateway:
image: ghcr.io/nvidia/openshell/gateway:${OPENSHELL_GATEWAY_TAG:-latest}
container_name: decepticon${DECEPTICON_STACK_NAME:+-${DECEPTICON_STACK_NAME}}-openshell-gateway
depends_on:
openshell-gateway-init:
condition: service_completed_successfully
command: ["--config", "/etc/openshell/gateway.toml"]
# host networking is required: the compute driver pins the sandbox
# supervisor to host-net and reaches the gateway at 127.0.0.1:8080, so the
# gateway must share the host loopback. The control plane reaches it via
# host.docker.internal / host.containers.internal (see langgraph below).
network_mode: host
user: "${OPENSHELL_GATEWAY_USER:-0}"
userns_mode: "${OPENSHELL_GATEWAY_USERNS:-host}"
environment:
OPENSHELL_GATEWAY_CONFIG: /etc/openshell/gateway.toml
# DB URL cannot live in the TOML (upstream blocks it to keep credential
# DSNs out of VCS); a plain SQLite path carries no secret.
OPENSHELL_DB_URL: "sqlite:${OPENSHELL_DATA_DIR:-/var/lib/openshell}/gateway.db?mode=rwc"
# Podman driver only; harmless/empty for the Docker driver.
OPENSHELL_PODMAN_SOCKET: "${OPENSHELL_PODMAN_SOCKET:-}"
XDG_DATA_HOME: ${OPENSHELL_DATA_DIR:-/var/lib/openshell}
HOME: ${OPENSHELL_DATA_DIR:-/var/lib/openshell}
volumes:
- type: bind
source: ${OPENSHELL_DATA_DIR:-/var/lib/openshell}
target: ${OPENSHELL_DATA_DIR:-/var/lib/openshell}
# Compute socket — Docker (/var/run/docker.sock) or the user Podman
# socket; same path host↔container so bind sources resolve.
- ${OPENSHELL_COMPUTE_SOCK:-/var/run/docker.sock}:${OPENSHELL_COMPUTE_SOCK:-/var/run/docker.sock}
# Engine-specific gateway.toml (docker default; podman via env).
- ${OPENSHELL_GATEWAY_TOML:-./containers/openshell/gateway.docker.toml}:/etc/openshell/gateway.toml:ro
restart: unless-stopped
logging: *default-logging
profiles:
- openshell
rea-mcp:
build:
context: .
dockerfile: containers/rea.Dockerfile
image: ghcr.io/bittersecurity/decepticon-rea:${DECEPTICON_VERSION:-latest}
platform: linux/amd64
container_name: decepticon${DECEPTICON_STACK_NAME:+-${DECEPTICON_STACK_NAME}}-rea-mcp
volumes:
- ${DECEPTICON_ENGAGEMENT_WORKSPACE:-${DECEPTICON_HOME:-~/.decepticon}/workspace}:/workspace
networks:
- sandbox-net
mem_limit: 4g
cpus: 2.0
restart: unless-stopped
logging: *default-logging
profiles:
- reversing
# LangGraph Platform — Agent API Server
# Exposes all agents (decepticon, soundwave, recon, exploit, postexploit)
# as a streaming API on port 2024. Ink CLI connects here.
langgraph:
image: ghcr.io/bittersecurity/decepticon-langgraph:${DECEPTICON_VERSION:-latest}
# Append --allow-blocking by default so blockbuster doesn't fatally
# abort runs on sync I/O in third-party deps (e.g. deepagents'
# subagents.py uses a sync httpx send in its atask path). Decepticon's
# own sync calls have been structurally fixed (see #325), but the
# third-party calls remain. Set LANGGRAPH_STRICT_ASYNC=1 in .env to
# opt out and reinstate the fatal-on-sync behavior (useful for
# debugging async issues in your own code).
# Note: $$ escapes compose interpolation so the literal $LANGGRAPH_STRICT_ASYNC
# reaches the shell — the env var is set on the container via env_file:.env,
# and the if/else decision happens at container start, not at compose render.
command:
- sh
- -c
- >
if [ "$${DECEPTICON_ENABLE_BLUE:-0}" = "1" ]; then
echo "blue capability: installing AutoBot (bs-autobot)…";
uv pip install --python /app/.venv/bin/python "bs-autobot>=0.1.0" &&
export LANGSERVE_GRAPHS="$$(python -m decepticon.graph_registry 2>/dev/null || echo '{}')";
fi;
if [ -z "$${LANGGRAPH_STRICT_ASYNC:-}" ]; then
exec langgraph dev --host 0.0.0.0 --port 2024 --no-browser --n-jobs-per-worker 10 --allow-blocking;
else
exec langgraph dev --host 0.0.0.0 --port 2024 --no-browser --n-jobs-per-worker 10;
fi
build:
context: .
dockerfile: containers/langgraph.Dockerfile
args:
# Stamps pyproject.toml's version field at build time. Independent
# of the image tag selector above — VERSION can be unset locally
# (defaults to 0.0.0 sentinel) while the tag is still ":dev".
VERSION: ${VERSION:-0.0.0}
container_name: decepticon${DECEPTICON_STACK_NAME:+-${DECEPTICON_STACK_NAME}}-langgraph
# Resolve the host-net OpenShell gateway from this bridge container. Docker
# maps host.docker.internal → host-gateway; Podman also aliases
# host.containers.internal to the same, so DECEPTICON_OPENSHELL_ENDPOINT
# works for both engines. Harmless when the openshell profile is off.
extra_hosts:
- "host.docker.internal:host-gateway"
ports:
- "127.0.0.1:${LANGGRAPH_PORT:-2024}:2024"
env_file: .env
environment:
- DECEPTICON_RUNTIME_ENGAGEMENT=${DECEPTICON_RUNTIME_ENGAGEMENT:-}
- DECEPTICON_LLM__PROXY_URL=http://litellm:4000
- DECEPTICON_LLM__PROXY_API_KEY=${LITELLM_MASTER_KEY:-sk-decepticon-master}
# HTTPSandbox transport target. ``sandbox`` is the compose service
# name (resolves via the shared ``sandbox-net`` network below). Port
# 9999 is the FastAPI daemon baked into the sandbox image (see
# ``containers/sandbox-entrypoint.sh`` — daemon mode is the default).
- SANDBOX_URL=http://sandbox:9999
# OpenShell admission endpoint (host:port, no scheme — the SDK's
# SandboxClient takes host:port and runs plaintext when the gateway has
# disable_tls). Empty by default so a stack without the `openshell`
# profile falls back to the graceful unbound resolver instead of dialling
# a missing gateway. With `--profile openshell`, point it at the host-net
# gateway — host.docker.internal:8080 works for both engines (Podman
# aliases host.docker.internal). `make openshell-up` sets it.
- DECEPTICON_OPENSHELL_ENDPOINT=${DECEPTICON_OPENSHELL_ENDPOINT:-}
# Engagement browser provider run inside the sandbox by the agent
# browser_* tools (docs/design/browser-providers.md). `none` removes
# the tools; a host/plugin that ships browser_* tools replaces them.
- DECEPTICON_BROWSER_PROVIDER=${DECEPTICON_BROWSER_PROVIDER:-obscura}
- DECEPTICON_REA_URL=http://rea-mcp:8082
- DECEPTICON_NEO4J_URI=bolt://neo4j:7687
- DECEPTICON_NEO4J_USER=neo4j
- DECEPTICON_NEO4J_PASSWORD=${NEO4J_PASSWORD:-decepticon-graph}
# Skillogy is the canonical skill-retrieval backend (Neo4j-backed,
# phase-scoped retrieval). The in-process file-system
# ``SkillsMiddleware`` stays available as an explicit opt-out via
# ``DECEPTICON_USE_SKILLOGY=0`` for standalone library use and
# pytest where the skillogy container isn't running.
- DECEPTICON_USE_SKILLOGY=${DECEPTICON_USE_SKILLOGY:-1}
- DECEPTICON_SKILLOGY_URL=http://skillogy:9100
- BLUE_SENSOR_URL=http://blue-receiver:8082
- BLUE_MONITOR_URL=http://blue-monitor:8085
# Neo4j is the sole KG backend (no DECEPTICON_KG_BACKEND needed)
# BENCHMARK_MODE flows in via `env_file: .env` above — no need to
# re-declare it here. Set BENCHMARK_MODE=1 in .env to engage CTF/XBOW
# benchmark mode (rule overrides + challenge context inject).
volumes:
- langgraph_data:/app/.langgraph_api
# Mount the OAuth credential files read-only so the LLM factory can
# check file presence + valid JSON before adding a method to the
# fallback chain. Without this the factory would trust the
# ``DECEPTICON_AUTH_*`` boolean alone and a stale flag
# (e.g. ``codex logout`` after onboard) would generate a 401-fallback
# storm. Read-only because langgraph never refreshes tokens — that's
# the LiteLLM container's job.
- ${CLAUDE_CREDENTIALS_VOLUME:-/dev/null}:/root/.claude/.credentials.json:ro
- ${CODEX_AUTH_VOLUME:-/dev/null}:/root/.codex/auth.json:ro
# Telemetry identity. The anonymous install_id is minted under
# $DECEPTICON_HOME/telemetry; without this mount it lived only in the
# container's writable layer, so every image update minted a NEW id
# (measured: 95% of "installs" survived a single day). Persisting it here
# also makes the agent and the host CLI agree on one id.
- ${DECEPTICON_HOME:-~/.decepticon}/telemetry:/root/.decepticon/telemetry
- ${DECEPTICON_ENGAGEMENT_WORKSPACE:-${DECEPTICON_HOME:-~/.decepticon}/workspace}:/workspace
# Wait for litellm to be healthy: langgraph has retry logic but the launcher
# uses `compose up --wait` and needs healthy as the single readiness signal.
depends_on:
litellm:
condition: service_healthy
sandbox:
condition: service_started
neo4j:
condition: service_healthy
# python urllib — same pattern as the litellm healthcheck. Runs entirely
# inside the container so host OS (Linux / macOS / Windows) is irrelevant;
# avoids relying on curl/wget being present in the langgraph base image.
# Honor the launcher's startup budget for cold FastAPI + all-graph imports.
# Readiness success still marks healthy immediately; failures after startup
# retain the normal retry budget. The launcher bounds the overall wait.
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:2024/ok')"]
interval: 5s
timeout: 3s
retries: 12
start_period: ${DECEPTICON_STARTUP_TIMEOUT_SECONDS:-600}s
networks:
# decepticon-net: reach litellm, postgres, neo4j (infra plane).
# sandbox-net: reach the sandbox container's HTTP daemon
# (HTTPSandbox transport) on the same bridge neo4j uses, while
# keeping the sandbox itself isolated from the infra plane.
- decepticon-net
- sandbox-net
mem_limit: 2g
memswap_limit: 4g
restart: unless-stopped
logging: *default-logging
# Ink CLI — Interactive terminal UI
# Runs via: docker compose run --rm cli
# Resumes engagement runs that TimeWindowMiddleware paused outside their RoE
# authorized time window, once the window opens (docs/security/roe-machine-enforcement.md).
time-window-resumer:
image: ghcr.io/bittersecurity/decepticon-langgraph:${DECEPTICON_VERSION:-latest}
command: ["python", "-m", "decepticon.cli", "time-window-resume", "--watch", "--url", "http://langgraph:2024"]
environment:
- DECEPTICON_SKIP_BOOT=1
depends_on:
langgraph:
condition: service_healthy
networks:
- decepticon-net
restart: unless-stopped
cli:
image: ghcr.io/bittersecurity/decepticon-cli:${DECEPTICON_VERSION:-latest}
build:
context: .
dockerfile: containers/cli.Dockerfile
args:
VERSION: ${VERSION:-0.0.0}
container_name: decepticon${DECEPTICON_STACK_NAME:+-${DECEPTICON_STACK_NAME}}-cli
stdin_open: true
tty: true
# `/blue` slash command: the CLI shells out to `docker compose` for the
# local Blue sensor against the host docker daemon. To do that it
# needs (a) the docker.sock so commands reach the host daemon and
# (b) the on-host Decepticon home mounted at a known in-container path
# so `--env-file` resolves.
#
# OSS scope: user == host owner. Multi-tenant deployments never
# expose the docker socket to a tenant CLI — those deployments
# override this service's volumes via a compose overlay.
environment:
- DECEPTICON_RUNTIME_ENGAGEMENT=${DECEPTICON_RUNTIME_ENGAGEMENT:-}
- DECEPTICON_API_URL=http://langgraph:2024
- BLUE_SENSOR_URL=http://blue-receiver:8082
- BLUE_MONITOR_URL=http://blue-monitor:8085
- TERM=xterm-256color
- COLORTERM=truecolor
- DECEPTICON_VERSION=${DECEPTICON_VERSION:-}
- DECEPTICON_STACK_NAME=${DECEPTICON_STACK_NAME:-}
- DECEPTICON_HOME=/decepticon-home
- DECEPTICON_HOST_HOME=${DECEPTICON_HOME:-}
- DECEPTICON_COMPOSE_ENV_FILE=/decepticon-home/.env
- DECEPTICON_COMPOSE_PROJECT=decepticon${DECEPTICON_STACK_NAME:+-${DECEPTICON_STACK_NAME}}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ${DECEPTICON_HOME:-~/.decepticon}:/decepticon-home
- ${DECEPTICON_ENGAGEMENT_WORKSPACE:-${DECEPTICON_HOME:-~/.decepticon}/workspace}:/workspace
# Do NOT override WORKDIR — the cli image's entrypoint is
# `node dist/index.js` resolved relative to /app (set by
# containers/cli.Dockerfile). The slash command resolves the
# compose project via the DECEPTICON_COMPOSE_FILE / _ENV_FILE
# env vars above, so working_dir on this container is irrelevant.
depends_on:
langgraph:
condition: service_healthy
networks:
- decepticon-net
profiles:
- cli
# ── C2 Infrastructure (profile-based, default: c2-sliver) ───────────
# Each C2 framework runs as a profile-based service on sandbox-net.
# ADR-0006 (v1.1.8+): C2 frameworks are opt-in workloads spawned by
# the orchestrator agent through opscontrol — the orchestrator calls
# `ops_start("c2-sliver")` after gaining a foothold. Default
# `decepticon start` keeps the C2 plane cold.
# Swap framework: change `ops_start("c2-sliver")` to
# `ops_start("c2-havoc")` once that workload ships.
# Agent connects via: sliver-client (pre-installed in sandbox)
c2-sliver:
image: ghcr.io/bittersecurity/decepticon-c2-sliver:${DECEPTICON_VERSION:-latest}
# Multi-arch image — see decepticon-sandbox above for the same notes.
build:
context: .
dockerfile: containers/c2-sliver.Dockerfile
container_name: decepticon${DECEPTICON_STACK_NAME:+-${DECEPTICON_STACK_NAME}}-c2-sliver
networks:
- sandbox-net
cap_add:
- NET_BIND_SERVICE
volumes:
- sliver_data:/home/sliver/.sliver
pids_limit: 512
restart: unless-stopped
logging: *default-logging
profiles:
- c2-sliver
# ─── Optional: OpenTelemetry collector for self-hosted traces ──────────
# Uncomment to receive Decepticon spans locally (Jaeger all-in-one).
# Decepticon stays default-off; set OTEL_ENABLED=1 plus the env vars below
# in the langgraph service to actually emit spans.
#
# jaeger:
# image: jaegertracing/all-in-one:1.60
# container_name: decepticon${DECEPTICON_STACK_NAME:+-${DECEPTICON_STACK_NAME}}-jaeger
# environment:
# - COLLECTOR_OTLP_ENABLED=true
# ports:
# - "127.0.0.1:${JAEGER_UI_PORT:-16686}:16686"
# - "127.0.0.1:${OTEL_HTTP_PORT:-4318}:4318"
# networks:
# - decepticon-net
#
# To export Decepticon spans to this service, set on the langgraph service:
# - OTEL_ENABLED=1
# - OTEL_EXPORTER_OTLP_ENDPOINT=http://jaeger:4318/v1/traces
# - OTEL_SERVICE_NAME=decepticon
skillogy:
image: ghcr.io/bittersecurity/decepticon-skillogy:${DECEPTICON_VERSION:-latest}
build:
context: .
dockerfile: containers/skillogy.Dockerfile
container_name: decepticon${DECEPTICON_STACK_NAME:+-${DECEPTICON_STACK_NAME}}-skillogy
depends_on:
neo4j:
condition: service_healthy
# Boot-time embedding backfill (ADR-0011) calls the litellm proxy.
# Wait for it to be healthy so the first ingest can embed the corpus;
# if it were absent the ingest degrades to substring-only retrieval.
litellm:
condition: service_healthy
ports:
- "127.0.0.1:${SKILLOGY_REST_PORT:-9100}:9100"
environment:
- SKILLOGY_REST_PORT=9100
- SKILLOGY_NEO4J_URI=bolt://neo4j:7687
- SKILLOGY_NEO4J_USER=neo4j
- SKILLOGY_NEO4J_PASSWORD=${NEO4J_PASSWORD:-decepticon-graph}
# Hybrid retrieval embeds skills + queries through the same litellm
# proxy the agents use (ADR-0011 §"Skillogy↔litellm coupling").
# Unset → find_skill falls back to substring search.
- DECEPTICON_LLM__PROXY_URL=http://litellm:4000
- DECEPTICON_LLM__PROXY_API_KEY=${LITELLM_MASTER_KEY:-sk-decepticon-master}
- DECEPTICON_SKILLOGY_EMBED_MODEL=${DECEPTICON_SKILLOGY_EMBED_MODEL:-openai/text-embedding-3-small}
# Only Skillogy receives this credential signal. It is used to skip
# the default OpenAI embedding route when no OpenAI key is configured;
# embeddings still travel through LiteLLM, not directly to OpenAI.
- DECEPTICON_SKILLOGY_OPENAI_API_KEY=${OPENAI_API_KEY:-}
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:9100/v1/health')"]
interval: 10s
timeout: 3s
retries: 6
start_period: 30s
networks:
- decepticon-net
restart: unless-stopped
logging: *default-logging
# ── BloodHound Community Edition (BHCE) sidecar ────────────────────
#
# Provides the AD attack-graph layer for the agent. Replaces the
# in-house tools/ad/* ingest + ADCS post-process (PR #560..#578),
# which are deprecated by ADR-0005. The agent calls BHCE v9.2.2
# over its official REST API via decepticon.tools.ad.bhce_client.
#
# Why a dedicated Neo4j: Neo4j Community Edition only allows one
# user database per server, and our KGStore already occupies the
# `neo4j` database on the `neo4j` container. BHCE writes its own
# ADCS / AD label schema via its `dawgs` driver, so it gets its
# own Neo4j instance to avoid label/constraint collisions.
# See docs/adr/0005-bloodhound-via-bhce-rest-client.md §Context.
#
# Why reuse Postgres: BHCE only needs one Postgres database
# (`bloodhound`) with the `pg_trgm` extension. The idempotent
# `bhce-postgres-init` sidecar below creates/repairs that state on
# both fresh installs and upgrades with an existing `postgres_data`
# volume, so users do not have to delete data after BHCE is added.
bhce-postgres-init:
image: postgres:17-alpine
container_name: decepticon${DECEPTICON_STACK_NAME:+-${DECEPTICON_STACK_NAME}}-bhce-postgres-init
environment:
POSTGRES_USER: decepticon
POSTGRES_DB: litellm
PGPASSWORD: ${POSTGRES_PASSWORD:-decepticon}
PGHOST: postgres
BHCE_POSTGRES_DB: ${BHCE_POSTGRES_DB:-bloodhound}
BHCE_POSTGRES_USER: ${BHCE_POSTGRES_USER:-bloodhound}
BHCE_POSTGRES_PASSWORD: ${BHCE_POSTGRES_PASSWORD:-bhce-decepticon-local}
volumes:
- ./containers/postgres-init/02-bloodhound-db.sh:/decepticon/ensure-bloodhound-db.sh:ro
command:
- bash
- -c
- |
bash /decepticon/ensure-bloodhound-db.sh
exec sleep 2147483647
depends_on:
postgres:
condition: service_healthy
healthcheck:
test:
- CMD-SHELL
- >-
test "$$(psql -v ON_ERROR_STOP=1 --username "$${POSTGRES_USER}" --dbname "$${BHCE_POSTGRES_DB}" -tAc "SELECT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'pg_trgm')")" = "t"
interval: 10s
timeout: 5s
retries: 6
start_period: 5s
networks:
- decepticon-net
# ADR-0006 §3 — workload is opt-in via the opscontrol daemon.
# Default `decepticon start` does NOT bring this up; the agent
# spawns it on demand via `ops_start("ad")`.
profiles:
- ad
bhce-neo4j:
image: neo4j:4.4.48-community
container_name: decepticon${DECEPTICON_STACK_NAME:+-${DECEPTICON_STACK_NAME}}-bhce-neo4j
environment:
NEO4J_AUTH: neo4j/${BHCE_NEO4J_PASSWORD:-decepticon-bhce-graph}
NEO4J_dbms_allow__upgrade: "true"
volumes:
- bhce_neo4j_data:/data
- bhce_neo4j_logs:/logs
networks:
- decepticon-net
# No host port exposure: only the BHCE API container needs bolt.
# `docker exec` into this container for cypher-shell debugging.
healthcheck:
test: ["CMD-SHELL", "wget -O /dev/null -q http://localhost:7474 || exit 1"]
interval: 10s
timeout: 5s
retries: 12
start_period: 60s
restart: unless-stopped
logging: *default-logging
# ADR-0006 §3 — opt-in via `ops_start("ad")`. Default
# `decepticon start` does not spin up the AD graph DB.
profiles:
- ad
bhce:
# SpecterOps does not publish semver tags on Docker Hub — every
# build is `edge` or `sha-<commit>[-<timestamp>]`. Default below
# pins the v9.2.2 release commit (1a7b3df, 2026-06-01). Verify
# against https://github.com/SpecterOps/BloodHound/releases/tag/v9.2.2
# when bumping; tags are immutable on Hub but `edge` is not.
image: docker.io/specterops/bloodhound:${BHCE_TAG:-sha-1a7b3df18a836051643ea3dcb777d20abdb469de}
container_name: decepticon${DECEPTICON_STACK_NAME:+-${DECEPTICON_STACK_NAME}}-bhce
environment:
# Cypher policy: keep the v9.2.2 defaults — complexity limit on,
# mutations disabled. Flip via env if a red-team scenario
# demands write-cypher (rare; tracked in ADR-0005 follow-up).
bhe_disable_cypher_complexity_limit: "false"
bhe_enable_cypher_mutations: "false"
bhe_graph_query_memory_limit: "2"
# External Postgres — our existing `postgres` container, with
# the `bloodhound` DB + `pg_trgm` ensured by the idempotent
# `bhce-postgres-init` sidecar above.
bhe_database_connection: >-
user=${BHCE_POSTGRES_USER:-bloodhound}
password=${BHCE_POSTGRES_PASSWORD:-bhce-decepticon-local}
dbname=${BHCE_POSTGRES_DB:-bloodhound}
host=postgres
sslmode=disable
# External Neo4j — dedicated `bhce-neo4j` container.
bhe_neo4j_connection: "neo4j://neo4j:${BHCE_NEO4J_PASSWORD:-decepticon-bhce-graph}@bhce-neo4j:7687/"
bhe_graph_driver: "neo4j"
bhe_recreate_default_admin: "${BHCE_RECREATE_DEFAULT_ADMIN:-false}"
bhe_default_admin_email: "${BHCE_DEFAULT_ADMIN_EMAIL:-admin@decepticon.local}"
bhe_default_admin_password: "${BHCE_DEFAULT_ADMIN_PASSWORD:-DecepticonBhceLocal2026!}"
bhe_default_admin_principal_name: "${BHCE_DEFAULT_ADMIN_USERNAME:-admin}"
# JWT signing key — pin this to a persisted secret in any
# non-dev deployment; default value is for local dogfood only.
bhe_crypto_jwt_signing_key: "${BHCE_JWT_SIGNING_KEY:-decepticon-bhce-jwt-signing-key-do-not-use-in-prod-do-not-use-in-prod}"
ports:
- "127.0.0.1:${BHCE_PORT:-8081}:8080"
networks:
- decepticon-net
depends_on:
postgres:
condition: service_healthy
bhce-postgres-init:
condition: service_healthy
bhce-neo4j:
condition: service_healthy
# The upstream image is distroless: no `/bin/sh`, curl, wget, or Python.
# Docker Compose `up --wait` rejects services with no healthcheck, so use
# the only executable the image provides as a liveness check. API clients
# still perform the real readiness probe/retry against `/api/v2/spec`;
# this check exists to keep compose wait semantics from failing before the
# client-level readiness loop can run.
healthcheck:
test: ["CMD", "/bloodhound", "-version"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
restart: unless-stopped
logging: *default-logging
# ADR-0006 §3 — workload is opt-in. The orchestrator agent calls
# `ops_start("ad")` after recon identifies an AD environment;
# default `decepticon start` keeps the BHCE plane cold.
profiles:
- ad
volumes:
langgraph_data:
postgres_data:
sliver_data:
neo4j_data:
neo4j_logs:
bhce_neo4j_data:
bhce_neo4j_logs:
networks:
decepticon-net:
driver: bridge
sandbox-net:
driver: bridge