waveterm icon indicating copy to clipboard operation
waveterm copied to clipboard

feat(ssh): add detailed SSH agent connection logging

Open andya1lan opened this issue 1 month ago • 1 comments

Problem

Following the Windows OpenSSH agent support feature attached issue #2643 , users reported connection failures without any useful diagnostic information in the logs when connecting with SSH agent. This made troubleshooting difficult as there was no visibility into:

  • SSH configuration being used
  • Agent connection attempts and results
  • Which keys were being tried
  • Why connections failed Additionally, when logs were shared for debugging, they exposed sensitive information including full usernames, hostnames, file paths, and IP addresses.

Implementation

  1. Enhanced SSH/Agent Logging
  • Add logSSHKeywords() helper to log SSH config details for debugging
  • Enhance agent connection/communication logging with blocklogger
  • Use INFO level for key events:
    • Agent connect success/failure
    • Number of signers retrieved
    • Connection attempts and results
  • Use DEBUG level for diagnostic details:
    • SSH config parameters
    • Key fingerprints
    • Config loading source
  • Add Windows-specific hint when agent connection fails
  1. Privacy Masking
  • Add MaskString() utility: shows first 3 + last 3 characters (e.g., ubuntu@server → ubu***ver)
  • Add maskIdentityFile(): masks usernames in paths while preserving structure
  • Apply masking to all sensitive log data:
    • Usernames and hostnames
    • Connection identifiers (remoteName, connection options)
    • Network addresses (IP:port)
    • Known hosts addresses
    • Key fingerprints
    • Shell paths

andya1lan avatar Jan 03 '26 17:01 andya1lan