Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.
Python agentic-aiai-securityalert-triageblue-teamcybersecuritydetection-engineeringincident-responselanggraphllm-agentsmcpmitre-attackmodel-context-protocolpurple-teamsecurity-operationsself-hostedsiemsoarsocthreat-detectionthreat-intelligence
feat(env): three-vars header in .env.example + POSTGRES_PASSWORD split (#108)
Beenu Arorad8397a0b2979
diff --git a/.env.example b/.env.exampleindex efee65017..c60d01a08 100644--- a/.env.example+++ b/.env.example@@ -1,5 +1,19 @@# AiSOC Environment Variables# Copy this file to .env and fill in your values+#+# ╔════════════════════════════════════════════════════════════════════════════╗+# ║ REQUIRED FOR LOCAL DEV — set these three before `aisoc serve`: ║+# ║ ║+# ║ 1. OPENAI_API_KEY your LLM provider API key (see "AI / LLM") ║+# ║ 2. POSTGRES_PASSWORD dev Postgres password (the default below works ║+# ║ out of the box; change for shared envs) ║+# ║ 3. AISOC_CREDENTIAL_KEY Fernet key for the connector credential vault. ║+# ║ A dev-only key is pre-filled below — generate ║+# ║ your own for any non-laptop deployment. ║+# ║ ║+# ║ Everything else has sensible defaults for `docker compose -f ║+# ║ docker-compose.dev.yml up -d`. ║+# ╚════════════════════════════════════════════════════════════════════════════╝# ─── Image Pinning ────────────────────────────────────────────────────────────# Tag pulled by every `image: ghcr.io/beenuar/aisoc-*:${AISOC_VERSION:-latest}`@@ -16,9 +30,9 @@ SECRET_KEY=change-this-to-a-random-secret-key-at-least-32-chars# Application-layer encryption key for connector credentials and other# secret payloads stored in Postgres. Generate with:# python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"-# Required outside development. Leave blank in development to auto-generate-# an ephemeral key (warning: connectors won't survive a process restart).-AISOC_CREDENTIAL_KEY=+# Required outside development. The value below is a DEV-ONLY key safe for+# local laptop usage; rotate it (and remove from any image) before deploying.+AISOC_CREDENTIAL_KEY=tpDDex4w7lO2lKbJ7O1uGoaGkfjQYvRBM3DrIESuXvI=# Comma-separated list of previous credential keys to support zero-downtime# rotation. Leave blank unless you are mid-rotation.AISOC_CREDENTIAL_KEY_ROTATION_FROM=@@ -32,7 +46,11 @@ CONNECTORS_SERVICE_URL=http://connectors:8003CONNECTORS_SERVICE_TIMEOUT_SECONDS=15# ─── Database ─────────────────────────────────────────────────────────────────-DATABASE_URL=postgresql+asyncpg://aisoc:aisoc_dev_secret@localhost:5432/aisoc+# POSTGRES_PASSWORD is the dev password for the bundled Postgres container.+# `docker-compose.yml` and the API both interpolate this value, so changing it+# here is enough to rotate the dev password across the stack.+POSTGRES_PASSWORD=aisoc_dev_secret+DATABASE_URL=postgresql+asyncpg://aisoc:${POSTGRES_PASSWORD}@localhost:5432/aisocREDIS_URL=redis://:redis_dev_secret@localhost:6379/0CLICKHOUSE_URL=http://aisoc:clickhouse_dev_secret@localhost:8123/aisocdiff --git a/docker-compose.yml b/docker-compose.ymlindex d2ec530d3..9c6701415 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -39,7 +39,7 @@ services:environment:POSTGRES_DB: aisocPOSTGRES_USER: aisoc- POSTGRES_PASSWORD: aisoc_dev_secret+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-aisoc_dev_secret}ports:- "127.0.0.1:5432:5432"volumes:@@ -229,7 +229,7 @@ services:ports:- "127.0.0.1:8000:8000"environment:- DATABASE_URL: postgresql+asyncpg://aisoc:aisoc_dev_secret@postgres:5432/aisoc+ DATABASE_URL: postgresql+asyncpg://aisoc:${POSTGRES_PASSWORD:-aisoc_dev_secret}@postgres:5432/aisocREDIS_URL: redis://:redis_dev_secret@redis:6379/0KAFKA_BOOTSTRAP_SERVERS: kafka:29092CLICKHOUSE_URL: http://aisoc:clickhouse_dev_secret@clickhouse:8123/aisoc@@ -313,7 +313,7 @@ services:environment:KAFKA_BOOTSTRAP_SERVERS: kafka:29092REDIS_URL: redis://:redis_dev_secret@redis:6379/3- DATABASE_URL: postgresql+asyncpg://aisoc:aisoc_dev_secret@postgres:5432/aisoc+ DATABASE_URL: postgresql+asyncpg://aisoc:${POSTGRES_PASSWORD:-aisoc_dev_secret}@postgres:5432/aisocnetworks:- aisocrestart: unless-stopped@@ -333,7 +333,7 @@ services:ports:- "127.0.0.1:8001:8084"environment:- DATABASE_URL: postgresql+asyncpg://aisoc:aisoc_dev_secret@postgres:5432/aisoc+ DATABASE_URL: postgresql+asyncpg://aisoc:${POSTGRES_PASSWORD:-aisoc_dev_secret}@postgres:5432/aisocREDIS_URL: redis://:redis_dev_secret@redis:6379/4CORE_API_URL: http://api:8000QDRANT_URL: http://qdrant:6333@@ -366,7 +366,7 @@ services:profiles:- osqueryenvironment:- DATABASE_URL: postgresql+asyncpg://aisoc:aisoc_dev_secret@postgres:5432/aisoc+ DATABASE_URL: postgresql+asyncpg://aisoc:${POSTGRES_PASSWORD:-aisoc_dev_secret}@postgres:5432/aisocAISOC_OSQUERY_TLS_ENROLL_SECRET: ${AISOC_OSQUERY_TLS_ENROLL_SECRET:-change-me-in-production}# The ingest service is registered as `ingest-worker` in this compose# file; the previous `http://ingest:8080` would not resolve via DNS.@@ -392,7 +392,7 @@ services:environment:KAFKA_BOOTSTRAP_SERVERS: kafka:29092REDIS_URL: redis://:redis_dev_secret@redis:6379/5- DATABASE_URL: postgresql+asyncpg://aisoc:aisoc_dev_secret@postgres:5432/aisoc+ DATABASE_URL: postgresql+asyncpg://aisoc:${POSTGRES_PASSWORD:-aisoc_dev_secret}@postgres:5432/aisocCORE_API_URL: http://api:8000networks:- aisoc@@ -417,7 +417,7 @@ services:environment:KAFKA_BOOTSTRAP_SERVERS: kafka:29092REDIS_URL: redis://:redis_dev_secret@redis:6379/6- DATABASE_URL: postgresql+asyncpg://aisoc:aisoc_dev_secret@postgres:5432/aisoc+ DATABASE_URL: postgresql+asyncpg://aisoc:${POSTGRES_PASSWORD:-aisoc_dev_secret}@postgres:5432/aisocCORE_API_URL: http://api:8000CROWDSTRIKE_CLIENT_ID: ${CROWDSTRIKE_CLIENT_ID:-}CROWDSTRIKE_CLIENT_SECRET: ${CROWDSTRIKE_CLIENT_SECRET:-}@@ -477,7 +477,7 @@ services:ports:- "127.0.0.1:8007:8004"environment:- DATABASE_URL: postgresql+asyncpg://aisoc:aisoc_dev_secret@postgres:5432/aisoc+ DATABASE_URL: postgresql+asyncpg://aisoc:${POSTGRES_PASSWORD:-aisoc_dev_secret}@postgres:5432/aisocREDIS_URL: redis://:redis_dev_secret@redis:6379/8KAFKA_BOOTSTRAP_SERVERS: kafka:29092CLICKHOUSE_URL: http://aisoc:clickhouse_dev_secret@clickhouse:8123/aisoc@@ -504,7 +504,7 @@ services:ports:- "127.0.0.1:8008:8005"environment:- DATABASE_URL: postgresql+asyncpg://aisoc:aisoc_dev_secret@postgres:5432/aisoc+ DATABASE_URL: postgresql+asyncpg://aisoc:${POSTGRES_PASSWORD:-aisoc_dev_secret}@postgres:5432/aisocREDIS_URL: redis://:redis_dev_secret@redis:6379/9KAFKA_BOOTSTRAP_SERVERS: kafka:29092CORE_API_URL: http://api:8000@@ -528,7 +528,7 @@ services:ports:- "127.0.0.1:8006:8006"environment:- DATABASE_URL: postgresql+asyncpg://aisoc:aisoc_dev_secret@postgres:5432/aisoc+ DATABASE_URL: postgresql+asyncpg://aisoc:${POSTGRES_PASSWORD:-aisoc_dev_secret}@postgres:5432/aisocREDIS_URL: redis://:redis_dev_secret@redis:6379/10CORE_API_URL: http://api:8000ATTCK_DATA_PATH: /app/data/enterprise-attack.jsondiff --git a/services/api/app/core/config.py b/services/api/app/core/config.pyindex 77ee5ff78..e3df0b541 100644--- a/services/api/app/core/config.py+++ b/services/api/app/core/config.py@@ -153,7 +153,12 @@ class Settings(BaseSettings):WEEKLY_DIGEST_POLL_INTERVAL_SECONDS: int = 3600# Database- DATABASE_URL: PostgresDsn = "postgresql+asyncpg://aisoc:aisoc@localhost:5432/aisoc" # type: ignore[assignment]+ # The default points at the bundled compose Postgres with its dev password.+ # In docker-compose.yml and .env.example the password is parameterised via+ # ``POSTGRES_PASSWORD`` so a single env var rotates it across the stack;+ # this default mirrors the compose default so ``aisoc serve`` works on a+ # fresh clone with zero configuration.+ DATABASE_URL: PostgresDsn = "postgresql+asyncpg://aisoc:aisoc_dev_secret@localhost:5432/aisoc" # type: ignore[assignment]DATABASE_POOL_SIZE: int = 20DATABASE_MAX_OVERFLOW: int = 10