Skip to content

siriusa51/sshproxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SSHProxy

An SSH proxy command proxy program implemented using WebSocket.

graph LR
    classDef startend fill:#F5EBFF,stroke:#BE8FED,stroke-width:2px
    classDef process fill:#E5F6FF,stroke:#73A6FF,stroke-width:2px
    
    A([Client]):::startend -->|ssh proxycommand by sshproxy| B(sshproxy - server):::process
    B --> C([SSH Server]):::startend
Loading

Usage

  1. Navigate to the release page to download the executable file corresponding to your system and then extract it.

  2. Launch the sshproxy proxy server.

    sshproxy server
  3. Use SSH to access the target SSH server via the proxy server.

  4. ssh -o ProxyCommand='sshproxy client --addr=%h:%p --ws=ws://localhost:8080/ --token=token' <user>@<host>:<port>

    Global commands:

    $ sshproxy -h
    
    sshproxy is a WebSocket proxy for SSH.
    
    Usage:
      sshproxy [flags]
      sshproxy [command]
    
    Available Commands:
      client      Run the sshproxy client.
      completion  Generate the autocompletion script for the specified shell.
      help        Get help about any command.
      server      Run the sshproxy server.
    
    Flags:
      -h, --help   Get help for sshproxy.
    
    Use "sshproxy [command] --help" for more information about a command.

    Client commands:

    $ sshproxy client -h
    
    The sshproxy client is a WebSocket-based client for sshproxy. It connects to a WebSocket server and forwards data to the SSH server. 
    For example: ssh -o ProxyCommand='sshproxy --addr=%h:%p --ws=ws://localhost:8080/' user@localhost:22
    
    Usage:
      sshproxy client [flags]
    
    Flags:
          --addr string    The target SSH address, e.g., --addr=%h:%p
      -h, --help           Get help for the client.
          --sid string     The session ID. If not provided, a random one will be generated.
          --token string   The token for authorization.
          --ws string      The WebSocket URL (e.g., ws://localhost:8080/).

    Server commands:

    $ sshproxy server -h
    
    The sshproxy server is a WebSocket-based server for sshproxy. It listens on a port and forwards data to the SSH server.
    
    Usage:
      sshproxy server [flags]
    
    Flags:
      -h, --help            Get help for the server.
          --host string     The host to listen on (default is "localhost").
          --port int        The port to listen on (default is 8080).
          --prefix string   The prefix path, e.g., /ssh.
          --token string    The token for authorization.

Building

The framework employed in the building process is: https://taskfile.dev/

The following command is used to build all binary packages:

task build

Troubleshooting

If you find that the SSH connection fails, you can add -v after the SSH command to view detailed logs.