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 -dPull the model on first run:
docker compose --profile ollama exec ollama ollama pull qwen3:8bThe 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:11434Or set the environment variable:
export INFRAGUARD_OLLAMA_URL=http://localhost:11434
infraguard run -c config.yamlThe 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#
| Variable | Default | Description |
|---|---|---|
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| Field | Type | Default | Description |
|---|---|---|---|
enabled | bool | false | Set automatically when INFRAGUARD_OLLAMA_URL is provided |
url | string | http://ollama:11434 | Ollama API base URL |
model | string | qwen3:8b | Model name for chat completions |
timeout | int | 120 | Request timeout in seconds |
Docker Resources#
The Ollama container is configured with resource limits:
| Resource | Limit | Reservation |
|---|---|---|
| CPU | 4.0 cores | 0.5 cores |
| Memory | 8 GB | 1 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.