How b0cal/miel works
Project type and purpose
• This is a full-stack, modular honeypot framework (“miel”) written in Rust (core engine) with a separate Web UI in JavaScript (src/webui).
• Purpose: expose configurable, containerized honeypot services (SSH, HTTP, etc.), dynamically adapt them to incoming attacker traffic, and record interactions in a database for analysis.
File structure
• Top-level directories/files:
• src/core: Rust binary (main.rs) and modules (Cargo.toml, .gitignore)
• src/webui: JavaScript single-page app, package.json, tests
• docs/: extensive design, UML, architecture, workflows, mockups
• scripts/: helper scripts to bootstrap Markdown, Node, Rust environments
• Makefile.toml & tasks.toml: cargo-make or similar task runner setups
• .github/workflows: CI/CD pipelines (lint, test, build, docs publish)
• Key config: .env.example (env vars for DB, ports), rust-toolchain.toml, systemd-nspawn references in docs.
Insights from README
• Core uses Tokio async runtime, Rust for safety & performance
• Containerization via systemd-nspawn
• Database to store packet traces, shells, metadata
• Highly modular: new services via config files
Main components and interactions
a. Components
1. External Actors: Attackers (network clients)
2. Miel Core (Rust)
– Network Listener(s) (TCP/HTTP/SSH)
– Request Classifier / Router
– Service Manager & Module Loader
– Container Orchestrator (systemd-nspawn)
– Data Layer (DB adapter, schema)
3. Service Containers (honeypot instances: SSH, HTTP, custom)
4. Database (PostgreSQL/MySQL/SQLite)
5. Web UI (frontend SPA)
6. CI/CD & Documentation pipelines (GitHub Actions)
b. Relationships & data flows
• Attackers → Miel Core (listeners)
• Miel Core → Service Manager → Spawn Container via systemd-nspawn
• Container ↔ Miel Core (proxy traffic, instrumentation)
• Miel Core → Database (store traces & metadata)
• Web UI ↔ Miel Core (REST/WebSocket API) → Database (read/write config & analytics)
c. Architectural patterns & principles
• Asynchronous, event-driven I/O (Tokio)
• Modular plugin/config-driven services
• Container orchestration delegated to systemd-nspawn (lightweight VMs)
• Clear separation: core engine vs. frontend vs. persistence
d. Key technologies/frameworks
• Rust & Tokio (core)
• systemd-nspawn (container runtime)
• PostgreSQL/MySQL/SQLite (DB)
• JavaScript (ESModules), Jest (tests), Prettier/ESLint (Web UI)
• cargo-make/Makefile.toml (build & task automation)
• GitHub Actions (CI/CD, docs deploy)