Skip to content

feat(portal): introduce portal-only execution mode and resolve pipeli… - #28

Merged
cheeseburden merged 7 commits into
cheeseburden:mainfrom
brijesh-shetty:main
Jun 20, 2026
Merged

feat(portal): introduce portal-only execution mode and resolve pipeli…#28
cheeseburden merged 7 commits into
cheeseburden:mainfrom
brijesh-shetty:main

Conversation

@brijesh-shetty

Copy link
Copy Markdown
Contributor

Key Features & Changes

1. Portal-Only Setup & Launchers (Main Intention)

  • docker-compose.portal.yml: Defines the services stack running in isolated portal mode with the PORTAL_ONLY_MODE=true environment flag enabled for the backend service.
  • run-portal.bat: Adds a launcher script to easily initialize the database models, start the container services, and open the dashboard.

2. Pipeline Reset & Clean Slate

  • Elasticsearch Index Wiping: Added zeek-conn-* index pattern deletion to the reset confirm endpoint in admin.py to ensure past connection logs are fully removed.
  • SQL User Reset: Resets user login metadata fields (failed_attempts, last_login, last_login_region, etc.) for all users to default/NULL values.
  • Cache Cleansing: Wipes all metrics, stats, user profiles, VPN lookups, and model rolling histories from Redis, and clears in-process dict caches.
  • Zeek Log Truncation: Truncates dataset/zeek-live/conn.log to empty.

3. Duplication & Ingestion Flow Fixes

  • Simulation Event Duplicates: Skips writing to the Zeek log file in /simulate when running in PORTAL_ONLY_MODE (which uses a case-insensitive check). This avoids double-processing simulated events.
  • Deduplication Hook: Preserves event.event_id inside the backend consumer/threat engine so the client's seenEventIdsRef can successfully filter out pipeline-delivered duplicates.
  • Vite StrictMode Removal: Removed StrictMode from main.jsx to prevent the browser from mounting components twice and initializing redundant WebSocket connections.

4. Frontend Visualization & UI Polish

  • ALLOW Event Logs & Animations: Restored safe ALLOW login events to the Pipeline Flow log, backed by a new green packet animation path.
  • IPv6 Address Formatting: Implemented formatIpShort() in AdminConsole and PipelineFlow to cleanly abbreviate long IPv6 addresses.
  • CSS Alignment: Added CSS word-break properties to detail panel IP values to prevent visual overflow.

Verification Checklist

  1. Launch the new environment using ./run-portal.bat.
  2. Verify that the 3D dashboard loads and is quiet (dataset streaming is disabled).
  3. Log in as USR-0005 (Admin) from the public gateway and confirm they are not immediately flagged as a threat for impossible travel.
  4. Verify that simulations on the dashboard register exactly once (no duplicates).
  5. Click Reset Pipeline in the admin panel and verify all dashboard metrics return to zero and no old logs are re-streamed from ES.

…ne bugs

- Add portal-only environment configs (docker-compose.portal.yml, run-portal.bat).
- Add zeek-conn-* ES index wiping to confirm_reset to clear connection logs.
- Conditionally skip write_zeek_log in /simulate when running in portal-only mode.
- Retain event.event_id to enable frontend-side deduplication.
- Restore ALLOW events to frontend pipeline logs and add green packet animations.
- Abbreviate IPv6 addresses in Alert Cards and Event Logs using formatIpShort.
- Remove StrictMode from main.jsx to prevent duplicate WS connections.
- Add PORTAL_ONLY_MODE environment variable configuration
- Guard Zeek log writing in auth routes to skip during portal-only mode
- Maintain WebSocket connection behavior in simulate routes based on portal flag
- Refactor Kafka client connectivity checks to gracefully handle portal-only environments
simulate.py: stream test_events during live-replay, 0.5s delay, heartbeat to stop zombie loops; threat_engine.py: real latencies for Kafka + Cred Rotation stages; Header.jsx + index.css: MODE Live Replay/Portal toggle; mode_switcher.py: host agent for compose down/up
…itch

- mode_switcher.py: catch ConnectionAborted/Reset/BrokenPipe in _json so
  browser-closed /status polls do not dump WinError 10053 tracebacks
- docker-compose.portal.yml: add restart: unless-stopped to ngrok so it
  self-recovers from the ERR_NGROK_334 endpoint race on fast down->up switches
…+ seek-latest

- simulate.py: single shared producer (was one per WS connection, so refresh compounded the event rate)

- kafka_client.py: consumer seeks to latest on connect and throttles the UI feed, not the consumer (no more stale-backlog draining)

- docker-compose.yml: gate zeek/filebeat behind the live-replay profile (raw Zeek events have no user identity)

- mode_switcher.py: plain 'up -d' switch, detect mode via hpe-es-to-kafka, live switch no longer starts the Zeek replay

- add generate_conn_log_from_test_events.py; document the mode switcher in README
@cheeseburden
cheeseburden merged commit 496535b into cheeseburden:main Jun 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants