4daa6bdbac4378edd2a76ec9eea5740a667e8613
SSH 隧道管理器
跨平台 SSH 本地端口转发工具:Windows 图形界面,Linux/macOS 命令行。
一键安装
Windows(图形界面,自动装好依赖、建快捷方式并启动):
powershell -c "irm https://gitea.xbay.cc/leefer/ssh-e2e/raw/branch/main/install.ps1 | iex"
Linux / macOS(命令行版,安装到 ~/ssh-e2e,提供 ssh-tunnel 命令):
curl -fsSL https://gitea.xbay.cc/leefer/ssh-e2e/raw/branch/main/install.sh | bash
典型场景
远程主机上有个服务只监听它自己的 127.0.0.1:3000,公网访问不到。
建一条隧道后,在本机打开 http://127.0.0.1:3000 即可直接访问该服务。
命令行用法(Linux/macOS,Windows 亦可 python cli.py)
ssh-tunnel host add 我的服务器 root@1.2.3.4 # 添加主机(交互输入密码;私钥加 --key ~/.ssh/id_rsa)
ssh-tunnel test 我的服务器 # 测试连通与认证
ssh-tunnel tunnel add web --host 我的服务器 --lp 3000 --rp 3000
ssh-tunnel start web # 前台运行,Ctrl+C 断开
ssh-tunnel list # 查看全部
ssh-tunnel remove tunnel web
图形界面(Windows)
双击仓库里的 启动.bat,或用上面的一键安装命令。
- 主机:添加 SSH 主机(密码/私钥认证,可「测试连接」)。
- 隧道:选主机,填远程地址(一般
127.0.0.1)、远程端口、本地端口,点「启动」。 - 本机访问
127.0.0.1:本地端口即等于远程服务;点「最小化/关闭」驻留系统托盘,隧道后台保持。
数据与安全
配置文件位置:Windows %APPDATA%\SshTunnelManager\、Linux ~/ssh-e2e/.config/、
macOS ~/ssh-e2e/Library/。密码与私钥口令:Windows 经 DPAPI 加密;Linux/macOS
在装有 keyring 时经 AES-GCM 加密(keyring 派生密钥),否则明文保存并在运行时提示。
主机公钥记录在配置目录 known_hosts,主机密钥变更时拒绝连接。
开发
main.py GUI 入口(pywebview + WebView2,仅 Windows)
cli.py 命令行入口(跨平台)
engine.py 隧道引擎:paramiko 转发、保活、自动重连
storage.py 配置存储:JSON + 平台加密
ui/ 图形界面(HTML/CSS/JS)
install.sh / install.ps1 一键安装脚本
test_sshd.py / test_e2e.py 本地自测(见下)
自测:
.venv/Scripts/python test_sshd.py # 窗口1:本地测试 SSH 服务端
.venv/Scripts/python test_e2e.py # 窗口2:端到端隧道验证
.venv/Scripts/python cli.py list # CLI 冒烟
Languages
Python
53.7%
JavaScript
23.7%
CSS
11.6%
HTML
4%
Shell
3.5%
Other
3.5%