|
| 1 | +# SSHProxy |
| 2 | +An SSH proxy command proxy program implemented using WebSocket. |
| 3 | + |
| 4 | +```mermaid |
| 5 | +graph LR |
| 6 | + classDef startend fill:#F5EBFF,stroke:#BE8FED,stroke-width:2px |
| 7 | + classDef process fill:#E5F6FF,stroke:#73A6FF,stroke-width:2px |
| 8 | + |
| 9 | + A([Client]):::startend -->|ssh proxycommand by sshproxy| B(sshproxy - server):::process |
| 10 | + B --> C([SSH Server]):::startend |
| 11 | +``` |
| 12 | + |
| 13 | +## Usage |
| 14 | + |
| 15 | +1. Navigate to the release page to download the executable file corresponding to your system and then extract it. |
| 16 | + |
| 17 | +2. Launch the sshproxy proxy server. |
| 18 | + |
| 19 | + ```shell |
| 20 | + sshproxy server |
| 21 | + ``` |
| 22 | + |
| 23 | +3. Use SSH to access the target SSH server via the proxy server. |
| 24 | + |
| 25 | +4. ```shell |
| 26 | + ssh -o ProxyCommand='sshproxy client --addr=%h:%p --ws=ws://localhost:8080/ --token=token' <user>@<host>:<port> |
| 27 | + ``` |
| 28 | + |
| 29 | + Global commands: |
| 30 | + |
| 31 | + ```shell |
| 32 | + $ sshproxy -h |
| 33 | + |
| 34 | + sshproxy is a WebSocket proxy for SSH. |
| 35 | + |
| 36 | + Usage: |
| 37 | + sshproxy [flags] |
| 38 | + sshproxy [command] |
| 39 | + |
| 40 | + Available Commands: |
| 41 | + client Run the sshproxy client. |
| 42 | + completion Generate the autocompletion script for the specified shell. |
| 43 | + help Get help about any command. |
| 44 | + server Run the sshproxy server. |
| 45 | + |
| 46 | + Flags: |
| 47 | + -h, --help Get help for sshproxy. |
| 48 | + |
| 49 | + Use "sshproxy [command] --help" for more information about a command. |
| 50 | + ``` |
| 51 | + |
| 52 | + Client commands: |
| 53 | + |
| 54 | + ```shell |
| 55 | + $ sshproxy client -h |
| 56 | + |
| 57 | + The sshproxy client is a WebSocket-based client for sshproxy. It connects to a WebSocket server and forwards data to the SSH server. |
| 58 | + For example: ssh -o ProxyCommand='sshproxy --addr=%h:%p --ws=ws://localhost:8080/' user@localhost:22 |
| 59 | + |
| 60 | + Usage: |
| 61 | + sshproxy client [flags] |
| 62 | + |
| 63 | + Flags: |
| 64 | + --addr string The target SSH address, e.g., --addr=%h:%p |
| 65 | + -h, --help Get help for the client. |
| 66 | + --sid string The session ID. If not provided, a random one will be generated. |
| 67 | + --token string The token for authorization. |
| 68 | + --ws string The WebSocket URL (e.g., ws://localhost:8080/). |
| 69 | + ``` |
| 70 | + |
| 71 | + Server commands: |
| 72 | + |
| 73 | + ```shell |
| 74 | + $ sshproxy server -h |
| 75 | + |
| 76 | + The sshproxy server is a WebSocket-based server for sshproxy. It listens on a port and forwards data to the SSH server. |
| 77 | + |
| 78 | + Usage: |
| 79 | + sshproxy server [flags] |
| 80 | + |
| 81 | + Flags: |
| 82 | + -h, --help Get help for the server. |
| 83 | + --host string The host to listen on (default is "localhost"). |
| 84 | + --port int The port to listen on (default is 8080). |
| 85 | + --prefix string The prefix path, e.g., /ssh. |
| 86 | + --token string The token for authorization. |
| 87 | + ``` |
| 88 | + |
| 89 | +## Building |
| 90 | +The framework employed in the building process is: https://taskfile.dev/ |
| 91 | + |
| 92 | +The following command is used to build all binary packages: |
| 93 | + |
| 94 | +```shell |
| 95 | +task build |
| 96 | +``` |
| 97 | + |
| 98 | +## Troubleshooting |
| 99 | + |
| 100 | +If you find that the SSH connection fails, you can add `-v` after the SSH command to view detailed logs. |
0 commit comments