AI Assistant#

The dashboard has an optional AI chat panel powered by Ollama for help with C2 profile creation. It runs locally – no data leaves your network.

Setup#

Docker#

The docker-compose.yml includes an Ollama service gated behind the ollama Docker profile. Start it alongside InfraGuard:

docker compose --profile ollama up -d

Pull the model on first run:

docker compose --profile ollama exec ollama ollama pull qwen3:8b

The dashboard container picks up the Ollama URL from the INFRAGUARD_OLLAMA_URL environment variable, which is preset to http://infraguard-ollama:11434 in the compose file.

Local#

Install Ollama from ollama.com, pull the model, and point InfraGuard at it:

ollama pull qwen3:8b
infraguard run -c config.yaml --ollama-url http://localhost:11434

Or set the environment variable:

export INFRAGUARD_OLLAMA_URL=http://localhost:11434
infraguard run -c config.yaml

The same --ollama-url flag works on both infraguard run and infraguard dashboard.

Using the Chat Panel#

The AI Assistant button sits on the right edge of the dashboard. A colored dot shows status: green when Ollama is reachable, red when offline.

Click the button to open the chat panel. Type a question or pick one of the pre-built suggestions:

  • “Generate CS jQuery profile”
  • “Sliver WordPress URIs”
  • “Havoc OPSEC tips”
  • “Compare BRC4 vs Nighthawk”

Responses stream in token-by-token via SSE. When the AI returns a code block containing profile content, an “Apply to wizard” button appears that copies the content into the profile wizard’s import textarea.

The AI is prompted with knowledge of all 8 profile formats InfraGuard supports. It can help draft profiles, suggest URI patterns that blend with legitimate traffic, explain transform chains, and compare framework capabilities.

If Ollama is not running, the chat button still appears with a red dot. Messages get an error response explaining the assistant is offline.

Config#

Environment Variables#

VariableDefaultDescription
INFRAGUARD_OLLAMA_URL(empty)Ollama API URL. Empty disables the AI panel.

Config Schema#

The ollama block in config.yaml:

ollama:
  enabled: false
  url: "http://ollama:11434"
  model: "qwen3:8b"
  timeout: 120
FieldTypeDefaultDescription
enabledboolfalseSet automatically when INFRAGUARD_OLLAMA_URL is provided
urlstringhttp://ollama:11434Ollama API base URL
modelstringqwen3:8bModel name for chat completions
timeoutint120Request timeout in seconds

Docker Resources#

The Ollama container is configured with resource limits:

ResourceLimitReservation
CPU4.0 cores0.5 cores
Memory8 GB1 GB

Model data is persisted in the ollama-data volume.

API#

GET /api/ai/status#

Check if the AI assistant is available.

Response (available):

{
  "available": true,
  "model": "qwen3:8b",
  "model_loaded": true,
  "models": ["qwen3:8b", "llama3.1:8b"],
  "url": "http://ollama:11434"
}

Response (unavailable):

{
  "available": false,
  "reason": "Ollama is not configured"
}

POST /api/ai/chat#

Stream a chat response via Server-Sent Events.

Request:

{
  "messages": [
    {"role": "user", "content": "Generate a Cobalt Strike profile that mimics jQuery CDN traffic"}
  ]
}

SSE stream:

data: {"content": "Here", "done": false}
data: {"content": "'s a", "done": false}
data: {"content": " profile", "done": false}
...
data: {"content": "", "done": true}

Returns 503 if Ollama is not configured, 400 for empty or invalid messages.