﻿ccg.log viewer - VA companion agent
===================================

Run this on a machine that can reach the VA over SSH.

Quick start
-----------
1) Double-click start-agent.bat.
   - Portable zip: it uses the bundled Python (nothing to install).
   - Standard zip: it uses the Python already on the machine (3.10+).
2) First run: the agent asks for the VA host, SSH user, and the path to
   your SSH key file, and saves them to .env for next time.
3) It then opens the viewer in your browser automatically. Click Refresh
   or set an Auto interval to keep the log fresh.

SSH key (required)
------------------
The agent runs unattended, so it needs key authentication (a password
cannot be typed in for it). One-time setup from a terminal:

    ssh-keygen -t ed25519 -f "%USERPROFILE%\.ssh\va_key" -N ""
    type "%USERPROFILE%\.ssh\va_key.pub" | ssh <user>@<va-host> "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

(the second command asks for the VA password once; after that the key works)
Then give the agent the key path:  %USERPROFILE%\.ssh\va_key

Passphrase-protected key?
-------------------------
Supported. Because the agent runs unattended it cannot type your
passphrase, so the key must be held by the Windows ssh-agent. On startup
the agent detects a passphrase key and offers to load it (you enter the
passphrase once). If ssh-agent is disabled and needs admin to enable,
enable it once and load the key yourself:

    Set-Service ssh-agent -StartupType Automatic
    Start-Service ssh-agent
    ssh-add "%USERPROFILE%\.ssh\va_key"

Notes
-----
 - Needs the OpenSSH client (ssh.exe): standard on Windows 10 1809+.
 - The agent binds to localhost only and requires the printed token, so
   another web page cannot read your VA logs.
 - Open the agent's own http URL (not the https website) for the VA view;
   browsers block an https page from calling the http agent.
 - To reconfigure, delete .env and start the agent again.
