Commit Graph

7 Commits

Author SHA1 Message Date
Andrew Pease 3c21bd7d14 Fix Detection Engine timeouts and standardize command output
Detection Engine improvements (kibana_manager.py):
- Increase prepackaged rules installation timeout: 60s → 180s
- Increase bulk enable rules timeout: 60s → 120s
- Fixes timeout errors when installing ~1400 prebuilt detection rules
- Rules install successfully even with previous timeout, this eliminates warnings

Output formatting improvements (docker_manager.py):
- Remove bash-style separators (##### lines)
- Standardize all command output to match 'start' command style
- Use consistent cyan for actions, green for success
- Add blank lines before final success messages
- Commands affected: stop, destroy, restart, stage
2025-12-01 13:40:08 -06:00
Andrew Pease 567ade6158 Add cross-platform IP detection with WSL support
- Add _is_wsl() helper function to detect Windows Subsystem for Linux
  - Checks /proc/version for microsoft/wsl keywords
  - Checks WSL environment variables (WSL_DISTRO_NAME, WSL_INTEROP)

- Enhance get_host_ip() to support all platforms:
  - Native Linux: hostname -I (unchanged)
  - WSL: Automatically detected, uses hostname -I
  - macOS: ifconfig en0 (unchanged)
  - Native Windows: Parse ipconfig output for IPv4 address
  - Fallback: 0.0.0.0 for local Docker (unchanged)

- No changes to existing Linux/macOS behavior
- Script now automatically adapts to environment
- Tested and working on macOS and Ubuntu
2025-11-25 12:45:04 -06:00
Andrew Pease b2807465cd Phase 6: Add intelligent container state detection
- Add check_containers_exist() method to DockerManager
  - Detects if containers exist and if they're running
  - Returns tuple (containers_exist, containers_running)

- Enhance start command with smart behavior:
  - Already running: instant exit (no-op)
  - Stopped: quick start without reconfiguration (~30 sec)
  - Not exist: full setup with Detection Engine and Fleet (~5 min)
  - Add --force-setup flag to force reconfiguration

- Enhance stop command:
  - Already stopped: instant exit (no-op)
  - Not exist: helpful error message

- Enhance restart command:
  - Not exist: error with guidance to run start
  - Stopped: starts containers instead of restarting
  - Running: normal restart behavior

- Major improvement: subsequent starts are 10x faster
- Better user experience with clear status messages
- Idempotent operations - safe to run multiple times
2025-11-24 14:24:15 -06:00
Andrew Pease 5af2203103 Phase 4: Add Kibana and Fleet configuration module
- Create KibanaManager class for Detection Engine and Fleet setup
  - configure_detection_engine() method:
    - Wait for Kibana to be ready with retry logic
    - Enable Detection Engine API
    - Install prepackaged detection rules
    - Bulk enable rules by OS (Linux/Windows/macOS)

  - setup_fleet() method:
    - Check if Fleet is already initialized
    - Extract and configure CA certificate fingerprint
    - Configure Fleet Server host URLs
    - Set up Elasticsearch output with SSL verification
    - Create default agent policy with monitoring
    - Install Elastic Defend integration with EDRComplete preset

- Full API integration with Kibana Fleet and Detection Engine APIs
- Comprehensive error handling with helpful messages
- Support for verbose logging mode
- 475 lines implementing bash script parity
2025-11-24 12:52:03 -06:00
Andrew Pease 27001122eb Phase 3: Add Docker and utility modules
- Create DockerManager class for all container operations
  - Auto-detect docker compose vs docker-compose
  - Implement stage, start, stop, destroy, restart, status
  - Add clear_documents() for data stream clearing
  - Extract CA fingerprint for Fleet configuration
  - Comprehensive error handling and validation

- Create utility functions module
  - get_host_ip() for Linux/macOS IP detection
  - check_python_version() requiring 3.10+
  - run_command() helper with verbose support
  - show_docker_error() for formatted error messages
  - check_prerequisites() for system validation
2025-11-24 12:49:26 -06:00
Andrew Pease 1981c72e19 Phase 2: Add configuration management module
- Create Config class to load and validate .env file
- Validate passwords are changed from default 'changeme'
- Provide type-safe access to all configuration values
- Support detection rule flags (Linux/Windows/macOS)
- Helpful error messages for missing or invalid config
2025-11-20 08:42:04 -06:00
Andrew Pease 31800837a5 Phase 1: Add Python project foundation
- Add requirements.txt with click, requests, python-dotenv
- Create lib/ package structure with __init__.py
2025-11-20 08:39:03 -06:00