Files
NeuroSploit/docker-compose.yml
T
Joas A SantosandClaude Opus 5 eaff7a7cf5 feat(docker): run the console on the Kali toolbox image, add .dockerignore
The console ran on debian-slim and reached tools by spawning a sibling Kali
container per command, through the mounted docker socket. Build the console
FROM the toolbox image instead: nmap, sqlmap, ffuf, nuclei, impacket, Ghidra
and the rest are on PATH in the same container the harness runs in. A run
set to sandbox "host" now executes tools in place; picking an image in the
UI still spawns an isolated sibling, so isolation stays available.

This makes build order load-bearing — the console image cannot resolve its
base until the toolbox image exists. install.sh builds kali-base first, then
neurosploit. Renamed the service from kali-worker to kali-base to say what it
is now: a base layer, not a worker pool.

Add .dockerignore. The build context was 19GB, 18GB of it neurosploit-rs/
target/, which the builder stage recompiles anyway; runs/ carried engagement
data into the context as well. agents_md/ is explicitly preserved.

Dropped NS_WORKER_IMAGE and NS_SANDBOX from the compose environment: neither
is read anywhere in the harness or the web server. The sandbox image comes
from the per-run --sandbox flag.

Also fixes install.sh printing a literal ${NS_PORT:-8787} in its closing
banner, and makes it wait for the console to answer before declaring success.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-12-04 11:09:31 -03:00

95 lines
3.1 KiB
YAML

# NeuroSploit — Docker Compose infrastructure
# Usage: ./install.sh (generates .env, builds in order, starts everything)
#
# Services:
# postgres — persistent storage (findings, runs, assets, skills)
# kali-base — the pentest toolbox image; builds only, never runs
# neurosploit — console + API + harness, running ON the Kali toolbox image
#
# neurosploit derives FROM kali-base, so kali-base must be built first.
# install.sh enforces that order; `docker compose build` alone does not.
x-logging: &default-logging
driver: json-file
options:
max-size: "10m"
max-file: "3"
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: ${POSTGRES_USER:-neurosploit}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
POSTGRES_DB: ${POSTGRES_DB:-neurosploit}
POSTGRES_HOST_AUTH_METHOD: scram-sha-256
volumes:
- pgdata:/var/lib/postgresql/data
- ./db/schema.sql:/docker-entrypoint-initdb.d/01-schema.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-neurosploit} -d ${POSTGRES_DB:-neurosploit}"]
interval: 5s
timeout: 3s
retries: 10
ports:
- "127.0.0.1:5432:5432"
logging: *default-logging
restart: unless-stopped
# The toolbox image. Built, never started — neurosploit derives from it, and
# `--sandbox` runs it directly when an engagement wants tools isolated.
kali-base:
build:
context: .
dockerfile: Dockerfile.kali
image: neurosploit-kali:local
profiles:
- build-only
logging: *default-logging
neurosploit:
build:
context: .
dockerfile: Dockerfile
image: neurosploit:local
depends_on:
postgres:
condition: service_healthy
environment:
NS_PG_HOST: postgres
NS_PG_PORT: "5432"
NS_PG_USER: ${POSTGRES_USER:-neurosploit}
NS_PG_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
NS_PG_DBNAME: ${POSTGRES_DB:-neurosploit}
NS_PG_SSLMODE: disable
# LLM providers
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}
OPENAI_API_KEY: ${OPENAI_API_KEY:-}
DEEPSEEK_API_KEY: ${DEEPSEEK_API_KEY:-}
GEMINI_API_KEY: ${GEMINI_API_KEY:-}
XAI_API_KEY: ${XAI_API_KEY:-}
GROQ_API_KEY: ${GROQ_API_KEY:-}
OPENROUTER_API_KEY: ${OPENROUTER_API_KEY:-}
# Auth
NS_JWT_SECRET: ${NS_JWT_SECRET:?Set NS_JWT_SECRET in .env}
NS_DEFAULT_USER: ${NS_DEFAULT_USER:-neurosploit}
NS_DEFAULT_PASSWORD: ${NS_DEFAULT_PASSWORD:-}
# The toolbox is on PATH in this image, so a run with sandbox "host"
# executes tools here. Picking an image in the UI still spawns an
# isolated sibling container via the mounted docker socket.
ports:
- "${NS_BIND_ADDR:-127.0.0.1}:${NS_PORT:-8787}:8787"
volumes:
- ./runs:/app/runs
- ./agents_md:/app/agents_md:ro
- /var/run/docker.sock:/var/run/docker.sock
networks:
- default
security_opt:
- "no-new-privileges:true"
logging: *default-logging
restart: unless-stopped
volumes:
pgdata: