Public
GoCTIOpenSearchOllamaLLMKEDAKubernetesMITRE ATT&CK

CTI Agent

A Go-based cyber threat intelligence pipeline running on a schedule inside a Kubernetes cluster. Pulls external threat bulletins, enriches IOCs in parallel against free threat intelligence feeds, triages findings against a live cluster asset inventory, uses a locally-hosted LLM for context-aware analysis, and generates OpenSearch detection rules written back to the SIEM.

View Source ↗

The Problem

Threat intelligence pipelines at production scale involve commercial platforms, paid feeds, and cloud infrastructure. Building one from scratch in a homelab — with free feeds, local inference, and self-hosted storage — requires making every architectural decision explicitly rather than accepting what a platform provides.

The problem this solves is also concrete: the CTI agent runs against the same OpenSearch instance that holds the cluster's asset inventory. When it processes a threat bulletin, it knows which cluster workloads are running the affected software and what their blast radius looks like. Triage isn't generic — it's against a specific, known environment.

Approach

External feeds (OTX, ThreatFox, URLhaus)
   └── Fetch + normalize bulletins
         └── Parallel IOC enrichment (goroutines per source)
               └── CMDB query — match affected assets
                     └── LLM triage (local model via Ollama / LiteLLM)
                           ├── Fact Card generation
                           ├── Risk assessment against CMDB
                           └── Executive summary
                                 └── Detection rules → OpenSearch monitors
                                       └── Enriched report → cti-reports index

Architecture

The agent is structured as a Go module with clear internal package boundaries. Enrichment runs concurrently — each source is called in a separate goroutine, results collected via channels. Total enrichment time is bounded by the slowest source, not their sum.

LLM calls route through the LiteLLM proxy in the llm-gateway namespace. The agent doesn't call Ollama directly — all traffic passes through the content sanitizer, TOON normalizer, and inline guards before reaching inference.

Key Design Decisions

KEDA Scale-to-Zero

GPU inference is resource-intensive if left running continuously between sparse batch jobs. KEDA scales the inference deployment to zero when idle; a CronJob warms the service before each pipeline run so the first LLM call is not cold-start chaos, then autoscaling releases accelerator memory for other workloads.

Direction

The current implementation uses three free enrichment sources. The architecture is designed to add sources by implementing the enricher interface — paid feeds like Recorded Future or ThreatStream would drop in without changing the pipeline logic. The CMDB-aware triage is also worth extending: richer matching on network exposure, RBAC blast radius, and historical incident context.

← All Development