VoidNxSEC/O.W.A.S.A.K.A.

GitHub: VoidNxSEC/O.W.A.S.A.K.A.

一款零信任、气隙隔离的企业级 SIEM 平台,在专用硬件上本地运行,为安全工程师提供网络情报、资产发现、威胁分析一体化的日常监控能力。

Stars: 0 | Forks: 0

# O.W.A.S.A.K.A. SIEM 一个零信任、气隙隔离的 SIEM 平台,专为精准监控和企业级安全而构建——在专用硬件上本地运行。 ## 理念 **核心原则:** - **隔离优先设计**:通过架构而非配置实现气隙隔离 - **纵深防御**:每一层都有严密的安全防护 - **优雅胜于复杂**:简洁的 UX,极小的资源占用,最大的洞察力 - **信噪比优先**:优化关键信息 ## 架构概述 ``` ┌─────────────────────────────────────────────────────────────────┐ │ O.W.A.S.A.K.A. SIEM │ ├─────────────────────────────────────────────────────────────────┤ │ │ │ ┌──────────────────┐ ┌──────────────────┐ │ │ │ Modern Web UI │───▶│ WebSocket API │ │ │ │ (Svelte + TS) │ │ (Real-time) │ │ │ └──────────────────┘ └──────────────────┘ │ │ │ │ │ ┌────────────────────────────────▼─────────────────────────┐ │ │ │ Golang Core Engine │ │ │ ├──────────────────────────────────────────────────────────┤ │ │ │ Network Intelligence │ Discovery Engine │ Analytics │ │ │ │ • DNS Resolver │ • Physical │ • Correlation │ │ │ │ • Proxy/DPI │ • Virtual │ • ML Anomaly │ │ │ │ • Topology Map │ • Attack Surface│ • Alerting │ │ │ └──────────────────────────────────────────────────────────┘ │ │ │ │ │ ┌────────────────────────────────▼─────────────────────────┐ │ │ │ Secure Storage Layer (NAS Integration) │ │ │ │ • Encrypted at rest (AES-256-GCM) │ │ │ │ • Immutable audit logs │ │ │ │ • Integrity verification (Merkle trees) │ │ │ └──────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────┘ │ │ │ ▼ ▼ ▼ [Physical] [Virtual/Containers] [Network] Devices Docker/VMs Services ``` ## 功能 ### 网络情报 - **自定义 DNS 解析器**:具备查询日志记录和异常检测功能 - **透明代理**:具备 mTLS 检测和协议识别功能 - **网络拓扑映射器**:支持主动/被动发现 - **深度包检测 (Deep Packet Inspection)**:用于流量分析 ### 资产发现 - **多层发现**:物理、虚拟和容器化资产 - **攻击面映射**:所有端口 (0-65535),包括休眠服务 - **持续一致性检查**:实时检测变更与状态偏移 - **幽灵端口检测**:发现开发/调试 endpoint ### 安全性 - **气隙隔离架构**:设计上消除外部网络暴露 - **自托管 Firefox**:强制执行安全策略 - **加密存储**:使用 AES-256-GCM 与 Argon2id 密钥派生 - **不可变审计日志**:防篡改的事件记录 ### 用户体验 - **现代、简洁的界面**:默认采用暗黑模式 - **实时更新**:基于 WebSocket 的实时数据 - **可定制的仪表板**:基于组件的布局 - **低资源占用**:<500MB 内存占用 (空闲时) ## 项目结构 ``` O.W.A.S.A.K.A./ ├── cmd/ │ └── oswaka/ # Application entry point ├── internal/ # Private application logic │ ├── network/ # Network intelligence layer │ │ ├── dns/ # DNS resolver & logging │ │ ├── proxy/ # Transparent proxy & DPI │ │ ├── discovery/ # Network scanning │ │ └── topology/ # Network graph │ ├── discovery/ # Asset discovery engine │ │ ├── physical/ # Physical device enumeration │ │ ├── virtual/ # VM/container scanning │ │ ├── attack_surface/# Attack surface mapper │ │ └── reconciler/ # Change detection │ ├── browser/ # Firefox integration │ │ ├── firefox/ # Browser launcher │ │ ├── policies/ # Security policy enforcer │ │ └── automation/ # WebDriver integration │ ├── storage/ # Data persistence │ │ ├── nas/ # NAS connector │ │ ├── crypto/ # Encryption/decryption │ │ └── integrity/ # Verification & checksums │ └── analytics/ # Intelligence engine │ ├── stream/ # Event processing │ ├── correlation/ # Rule engine │ └── ml/ # Anomaly detection ├── pkg/ # Public libraries │ ├── config/ # Configuration management │ ├── logging/ # Structured logging │ └── metrics/ # Prometheus metrics ├── web/ # Frontend application │ ├── src/ │ │ ├── components/ # Svelte components │ │ ├── stores/ # State management │ │ └── lib/ # Utilities │ └── public/ # Static assets ├── configs/ # Configuration files │ ├── examples/ # Example configurations │ └── policies/ # Security policies └── frontend/ # React frontend experiments └── react/ # Vite + React console ``` 文档现已移至同级仓库 `../owasaka-docs` 中。 ## 快速开始 ### 前置条件 **选项 1:Nix Flakes(推荐用于开发)** - **带 Flakes 的 Nix** - 可重现的开发环境 - 自动管理所有依赖项 - 请参阅 `../owasaka-docs/docs/development/NIX_GUIDE.md` 中的 Nix 开发指南 **选项 2:手动安装** - **Go 1.22+**(已在 1.24.7 版本上测试) - **Node.js 18+**(用于 Web UI) - **专用硬件**(无共享环境) - **NAS 集群**(用于持久化存储) - **Firefox ESR**(用于浏览器集成) ### 使用 Nix 安装(推荐) ``` # Clone the repository git clone https://github.com/marcosfpina/O.W.A.S.A.K.A.git cd O.W.A.S.A.K.A # 进入开发环境(自动安装所有依赖) nix develop # 你将看到 O.W.A.S.A.K.A. 欢迎横幅! # 现在你可以访问所有工具:Go、Node.js、network tools 等 # Build the project oswaka-dev build # 或直接使用 make make build # 运行 SIEM oswaka-dev run # Hot reload 开发模式 oswaka-dev watch # 显示所有可用命令 oswaka-dev help ``` **Nix 环境包含内容:** - Go 1.22+, Node.js 20, Firefox ESR - 网络工具:nmap, tcpdump, tshark, dig - Go 工具:gopls, delve, golangci-lint, air - 开发实用程序:jq, ripgrep, bat, htop - 自定义脚本和别名 有关高级用法,请参阅 `../owasaka-docs/docs/development/NIX_GUIDE.md` 中的完整 Nix 指南。 ### 安装(手动) ``` # Clone the repository git clone https://github.com/marcosfpina/O.W.A.S.A.K.A.git cd O.W.A.S.A.K.A # Build the project make build # Run tests make test # 启动 SIEM ./bin/oswaka --config configs/examples/default.yaml ``` ### 开发 ``` # Install dependencies make deps # 在开发模式下运行 make dev # Run linters make lint # 生成文档 make docs ``` ## 配置 示例配置 (`configs/examples/default.yaml`): ``` # Server server: host: "127.0.0.1" port: 8080 websocket: enabled: true path: "/ws" max_connections: 1000 # Logging logging: level: "info" # debug, info, warn, error format: "json" output: "stdout" # Network intelligence network: dns: enabled: true listen_address: "127.0.0.1:8053" upstream_servers: ["1.1.1.1:53", "8.8.8.8:53"] threat_detection: true discovery: enabled: true scan_interval_minutes: 60 methods: [arp, icmp, mdns] # Attack surface mapping discovery: attack_surface: enabled: true port_range: { start: 1, end: 65535 } banner_grabbing: true # Analytics analytics: stream: enabled: true workers: 4 correlation: enabled: true sigma_rules_enabled: true # Metrics metrics: prometheus: enabled: true listen_address: "127.0.0.1:9090" # Spectre Fleet event bus nats_url: "nats://localhost:4222" ``` 完整参考:[`configs/examples/default.yaml`](configs/examples/default.yaml) ## 开发状态 ### 阶段 0:基础与环境搭建 ✅ - [x] 仓库结构 + Go module - [x] 构建系统 (Makefile + 包含 `nix develop` shell 的 Nix flake) - [x] 配置模板与验证 (`pkg/config/`) - [x] 架构文档 ### 阶段 1:网络情报层 ✅ - [x] 高性能 DNS 解析器 (`internal/network/dns/`) — miekg/dns、上游转发、查询日志记录 - [x] 透明代理 (`internal/network/proxy/`) — HTTP/HTTPS MITM、DPI 元数据提取、TLS 证书生成 - [x] 网络拓扑映射器 (`internal/network/topology/`) — ARP + mDNS,D3.js 图形导出 - [x] BoltDB 事件持久化 (`internal/storage/db/`) — bbolt 嵌入式 KV 存储 ### 阶段 2:资产发现 ✅ - [x] 虚拟/容器发现 — Docker socket 扫描器 + Libvirt XML-RPC + 容器统计信息 - [x] 攻击面映射器 (`internal/discovery/attack_surface/`) — 全 TCP 0-65535,banner 抓取,兼容 IPv6 - [x] 物理设备枚举 (`internal/discovery/physical/`) — sysfs USB + PCI 扫描 - [x] 持续一致性检查 (`internal/discovery/reconciliation/`) — 资产状态偏移检测 + 报警 ### 阶段 3:浏览器集成 ✅ - [x] 加固版 Firefox 启动器 (`internal/browser/firefox/`) — 配置文件隔离,企业级策略强制执行 - [x] 浏览器自动化 (`internal/browser/automation/`) — CDP 客户端、屏幕截图、HAR 捕获、导航历史 ### 阶段 4:现代前端 ✅ - [x] SvelteKit 仪表板 (Crimson Red / Glassmorphism 设计系统) - [x] 实时 WebSocket pipeline (gorilla/websocket + Go 事件总线) - [x] D3.js 网络拓扑可视化 (力导向图,实时更新) - [x] 具备严重性分类的威胁警报 HUD ### 阶段 5:分析引擎 ✅ - [x] 内存事件 Pipeline — 带有滑动窗口计数器 (1m/5m/15m) 的 Pub/Sub - [x] 关联分析引擎 — 基于规则的威胁检测框架 - [x] ML 异常检测 — 孤立森林 (100 棵树) + 7 天行为基线 ### 阶段 6:SPECTRE 集群集成 ✅ - [x] NATS 发布者 (`internal/events/publisher.go`) — Spectre 事件 schema - [x] Rust 代理桥接 — 通过 Axum 实现 NATS EventBus (ADR-0050) - [x] JWT 认证与速率限制 ### 所有 19 个服务已在 `app.go` 中接通 上述每个模块都已初始化、启动并连接到中央事件 pipeline。系统作为一个统一的进程启动。 ## 生产就绪 — 已解决的差距 | 差距 | 过去 | 现在 | 提交 | |---|---|---|---| | 测试覆盖率 | <5% (2 个测试) | 跨 6 个包的 **35 个测试** | `394f9b6` | | 关联规则 | 1 个硬编码规则 | **YAML 规则引擎 + 10 个基线规则** | `394f9b6` | | DNS 缓存 | 无缓存 (TODO) | **内存 TTL 缓存 + 后台清除器** | `394f9b6` | | ML 持久化 | 从零开始重新训练 | **gob 序列化,自动保存/加载** | `394f9b6` | | 扫描器目标 | 硬编码本地主机 | **从 BoltDB 资产列表中动态获取** | `394f9b6` | | CI/CD | 无 | **GitHub Actions (build+vet+test -race)** | `394f9b6` | ### 剩余问题 | 差距 | 严重程度 | 详情 | |---|---|---| | OpenTelemetry | 低 | Spectre 集成通过 NATS 工作;OTel 是锦上添花的功能 | | 规则热重载 | 低 | 规则在启动时加载;更改需要重启 | | 事件 pipeline 测试 | 中 | Pipeline + API + 拓扑包仍未测试 | ## 冲刺日志 (Sprint Log) ### 冲刺 1:生产环境强化 (2026-03-28) — 完成 - **P1** 测试覆盖率:35 个测试 (关联、ML、流、BoltDB、攻击面) - **P2** YAML 规则引擎 + 10 条检测规则 (端口扫描、DNS 隧道、暴力破解、ARP 欺骗、横向移动、服务枚举、恶意 TLD、可疑代理、虚拟机逃逸、异常流量) - **P3** DNS 缓存、ML 模型持久化 (gob)、扫描器从资产 DB 获取动态目标 - **P4** GitHub Actions CI,`make release` 目标 ## 性能目标 - **UI 响应时间**:<100ms (p95) - **内存占用**:<500MB (空闲) - **网络开销**:<5% 带宽 - **发现扫描**:扫描 1000 个资产 <60 秒 ## 安全模型 ### 威胁假设 - 物理访问受控 - NAS 处于受信任的网络段 - 操作员无恶意(内部威胁不在考虑范围内) ### 防护措施 - 内存安全语言 (Golang) - 全方位输入验证 - 运行时无外部依赖 - 可重现构建 - 静态数据加密 - 不可变的审计日志 ## 许可证 **专有** - 个人安全基础设施 未授权用于商业用途或分发。 ## 联系方式 项目维护者:Marcos Pina 仓库:https://github.com/marcosfpina/O.W.A.S.A.K.A **状态**:🚀 预生产阶段 — 核心模块已集成,强化冲刺已完成 最后更新:2026-03-28
标签:EVTX分析, Golang, JSONLines, SBOM分析, SIEM系统, Svelte, 安全编程, 安全运营, 扫描框架, 日志审计, 本地部署, 自定义请求头, 零信任