Ramkumar2545/itfortress-cti
GitHub: Ramkumar2545/itfortress-cti
基于 OpenCTI GraphQL API 构建的实时威胁情报监控控制台,提供可视化仪表盘、Feed 性能监控及多级权限管理。
Stars: 0 | Forks: 0
# ITFORTRESS-CTI
封装 [OpenCTI](https://github.com/OpenCTI-Platform/opencti) 的实时威胁情报监控控制台。
每一个数字、图表、表格行和状态徽章都是通过 OpenCTI GraphQL API **实时**获取的 —— 没有任何硬编码或虚拟数据。
```
OpenCTI GraphQL API → FastAPI backend → Redis cache (15s TTL) → Next.js frontend
```
## 技术栈
| 层级 | 技术 |
|-------|-----------|
| Frontend | Next.js 15 (App Router), React 19, Tailwind CSS, Recharts, Zustand |
| Backend | FastAPI, httpx (GraphQL client), asyncio |
| Database | PostgreSQL 16(用户、会话、RBAC、审计日志) |
| Cache | Redis 7(所有仪表盘数据设置 15 秒 TTL) |
| Auth | JWT (HS256), TOTP MFA (pyotp), argon2id 密码, 4 级 RBAC |
| 基础设施 | Docker Compose, Nginx(端口 1442 上的 SSL 反向代理) |
## 快速开始
```
# Clone the repo
git clone https://github.com/Ramkumar2545/itfortress-cti.git
cd itfortress-cti
# 运行 installer(生成 secrets、SSL certificates,并启动所有服务)
chmod +x install.sh
./install.sh
```
安装程序将会:
1. 生成 JWT 密钥、PostgreSQL 密码以及 OpenCTI 管理员凭证
2. 创建自签名 SSL 证书
3. 构建并启动所有 Docker 容器
4. 等待 OpenCTI 变得健康可用
准备就绪后,请访问 **https://localhost:1442** 打开控制台。
## 手动设置
```
# 1. 复制并配置 environment
cp .env.example .env
# 使用您的值编辑 .env
# 2. 生成 SSL certificates
mkdir -p nginx/certs
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout nginx/certs/privkey.pem \
-out nginx/certs/fullchain.pem \
-subj "/CN=itfortress-cti"
# 3. 构建并启动
docker compose up -d --build
```
## 架构
```
┌──────────────┐ GraphQL ┌──────────────┐ Redis ┌──────────────┐ REST ┌──────────────┐
│ OpenCTI │ ─────────→ │ FastAPI │ ───────→ │ Redis cache │ ───────→ │ Next.js 15 │
│ :8080 │ (httpx) │ :8000 │ (15s) │ :6379 │ /api/* │ :3000 │
└──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘
│
PostgreSQL 16
(users, RBAC,
sessions, audit)
```
## 仪表盘组件
| 组件 | 数据源 |
|--------|-----------|
| 7 张汇总卡片 | Connectors、indicators、entities 和 observables 的统计数 |
| Feed 下载图表 | `stixCyberObservablesTimeSeries`(面积图,7/30/90 天) |
| 按类型分类的 Indicators | 每种类型的 observable 计数(环形图) |
| IOC 汇总网格 | 12 张卡片:IPs、domains、URLs、emails、hostnames、hashes、files、vulnerabilities、malware、ransomware、campaigns 和 threat actors |
| 热门 feeds 表格 | 按 EXTERNAL_IMPORT 过滤的 Connectors |
| Feed 性能 | 每个 feed 的成功率、记录数、持续时间 |
| Connector 健康 | 健康/警告/失败环形图 + 成功率条形图 |
| 最近活动 | 最新的报告和 connector 事件(时间线) |
| GitHub 分析 | OpenCTI 仓库的 Stars、forks、contributors |
| 系统资源 | CPU、RAM、磁盘仪表盘 (psutil) |
| 状态栏 | OpenCTI 版本,服务健康状态点 (ES、Redis、RabbitMQ、MinIO) |
## API Endpoints
| 分组 | Endpoints |
|-------|----------|
| **Auth** `/api/auth/` | `POST /login`, `/mfa/verify`, `/refresh`, `/logout`, `/mfa/enroll`, `/mfa/backup` |
| **Dashboard** `/api/dashboard/` | `GET /full`, `/summary`, `/observable-counts`, `/entity-counts`, `/indicators-by-type`, `/connectors`, `/feed-chart`, `/service-health`, `/recent-activity`, `/system-resources` |
| **Observables** `/api/observables/` | `GET /`, `/counts`, `/{id}` |
| **Feeds** `/api/feeds/` | `GET /`, `/{id}`, `/{id}/history` |
| **Connectors** `/api/connectors/` | `GET /`, `POST /{id}/reset`, `GET /{id}/logs` |
| **Users** `/api/users/` | `GET /`, `POST /`, `GET /me`, `PUT /me/preferences`, `PUT /{id}`, `DELETE /{id}` |
| **Settings** `/api/settings/` | `GET /`, `PUT /`, `GET /rbac`, `PUT /rbac`, `GET /audit-logs` |
## RBAC 角色
| 权限 | Super Admin | Admin | Analyst | Viewer |
|-----------|:-----------:|:-----:|:-------:|:------:|
| 查看仪表盘 | Y | Y | Y | Y |
| 查看 observables | Y | Y | Y | - |
| 管理 feeds | Y | Y | - | - |
| 管理用户 | Y | - | - | - |
| 系统设置 | Y | - | - | - |
| 审计日志 | Y | Y | - | - |
## 自动刷新
前端会在可配置的时间间隔(15秒 / 30秒 / 1分钟 / 5分钟 / 10分钟 / 关闭)内刷新仪表盘数据。Page Visibility API 会在浏览器标签页隐藏时暂停刷新。所有数据都会经过 15 秒的 Redis 缓存,以避免使 OpenCTI 负载过重。
## 项目结构
```
itfortress-cti/
├── docker-compose.yml # All services
├── .env.example # Environment template
├── install.sh # One-command installer
├── nginx/ # Nginx SSL reverse proxy
│ └── nginx.conf
├── frontend/ # Next.js 15 (App Router)
│ └── src/
│ ├── app/ # 13 pages
│ ├── components/ # 15 components (dashboard, layout, ui, auth)
│ ├── lib/ # API client, hooks, formatters
│ └── stores/ # Zustand (theme, auth, refresh)
└── backend/ # FastAPI
└── app/
├── auth/ # JWT, MFA, RBAC, dependencies
├── graphql_client/ # OpenCTI GraphQL client + Redis cache
├── routers/ # 7 API router modules
└── models/ # SQLAlchemy (user, session, audit)
```
## 许可证
私有仓库。
标签:AV绕过, Docker Compose, FastAPI, Redis, 威胁情报, 安全监控大屏, 开发者工具, 版权保护, 自动化攻击