Overview
The etcd Server is ML Defender’s distributed coordination hub, providing centralized configuration management, automatic crypto seed exchange, and service discovery for all components. Implemented in C++ with the etcd v3 API, it ensures consistent state across the entire pipeline.Core Functions
- Distributed Configuration: Single source of truth
- Crypto Key Exchange: ChaCha20-Poly1305 seed distribution
- Service Registration: Component discovery
- Health Monitoring: Heartbeat tracking
Performance
- <50ms service registration latency
- <100ms crypto seed exchange
- 30-second heartbeat intervals
- 60-second lease TTL
Architecture
The etcd Server acts as the coordination layer between all ML Defender components:Key-Value Store Structure
- Crypto Keys
- Configuration
- Service Registry
Path: Purpose: Automatic encryption key distribution without manual key exchange.
/crypto/<component>/tokensCrypto Seed Exchange
The etcd Server automates ChaCha20-Poly1305 key distribution across the pipeline:Key Exchange Flow
1
Component Registration
Sniffer registers with etcd Server on startup:
2
etcd Generates Key
etcd Server generates a 256-bit ChaCha20-Poly1305 key:
3
Key Stored in etcd
Key persisted in etcd key-value store:
4
Downstream Components Retrieve
ML Detector and Firewall Agent retrieve the key:
Security: Keys are generated once at component registration and rotated every 24 hours automatically.
Service Registration & Heartbeats
Registration Protocol
- Registration Request
- Registration Response
- Heartbeat
Health Monitoring
C++ Implementation
The etcd Server is implemented in modern C++ using the httplib library for HTTP endpoints:- Server Core
- Component Registry
- Configuration Validation
Configuration
etcd Server Configuration
Client Configuration (per component)
Deployment
Prerequisites
Build
1
Navigate
2
Configure
3
Compile
Run
API Reference
REST Endpoints
POST /register - Register Component
POST /register - Register Component
Request:Response (200 OK):
PUT /heartbeat - Send Heartbeat
PUT /heartbeat - Send Heartbeat
Request:Response (200 OK):
GET /config/:component - Get Configuration
GET /config/:component - Get Configuration
Request:Response (200 OK):
PUT /config/:component/:path - Update Configuration
PUT /config/:component/:path - Update Configuration
Request:Response (200 OK):
GET /validate - Validate Configuration
GET /validate - Validate Configuration
Request:Response (200 OK):
Troubleshooting
Components Cannot Connect
Components Cannot Connect
Registration Fails
Registration Fails
Heartbeat Timeout
Heartbeat Timeout
Symptom: Components marked as unhealthy after 90 secondsSolution: Increase heartbeat frequency or TTL:
Next Steps
Sniffer
Configure network packet capture
ML Detector
Set up ML inference pipeline
Firewall Agent
Deploy autonomous blocking
Distributed Deployment
Multi-node etcd cluster setup