# Security Guidelines for fetch_ml Distributed Mode ## Token Management ### Quick Start (Recommended) ```bash # 1. Generate config with tokens scheduler -init -config scheduler.yaml # 2. Or generate a single token scheduler -generate-token ``` ### Generating Tokens **Option 1: Initialize full config (recommended)** ```bash # Generate config with 3 worker tokens scheduler -init -config /etc/fetch_ml/scheduler.yaml # Generate with more tokens scheduler -init -config /etc/fetch_ml/scheduler.yaml -tokens 5 ``` **Option 2: Generate single token** ```bash # Generate one token scheduler -generate-token # Output: wkr_abc123... ``` **Option 3: Using OpenSSL** ```bash openssl rand -hex 32 ``` ### Token Storage - **NEVER commit tokens to git** — config files with real tokens are gitignored - Store tokens in environment variables or secure secret management - Use `.env` files locally (already gitignored) - Rotate tokens periodically ### Config File Security ``` configs/ ├── scheduler/scheduler.yaml # ⛔ NEVER commit with real tokens ├── scheduler/scheduler.yaml.example # ✅ Safe to commit (placeholders) └── worker/distributed/worker.yaml # ⛔ NEVER commit with real tokens ``` All `*.yaml` files in `configs/` subdirectories are gitignored by default. ### Distribution Workflow ```bash # On scheduler host: $ scheduler -init -config /etc/fetch_ml/scheduler.yaml Config generated: /etc/fetch_ml/scheduler.yaml Generated 3 worker tokens. Copy the appropriate token to each worker's config. === Generated Worker Tokens === Copy these to your worker configs: Worker: worker-01 Token: wkr_abc123... Worker: worker-02 Token: wkr_def456... # On each worker host - copy the appropriate token: $ cat > /etc/fetch_ml/worker.yaml <