Skip to main content

Expose web services on internal servers through a cloud relay with a dashboard and reverse proxy over SSH tunnels.

Project description

Kite - SSH 隧道反向代理

将内网服务器上的 Web 服务通过云服务器暴露给外部访问。基于 SSH 端口转发,安全可靠。

架构

                        SSH -R tunnel
Client (内网)  ◄──────────────────────────►  Server X (云)
  localhost:3000  ──►  X:10001                  ┃
  localhost:8888  ──►  X:10002                  ┃
                                                ┃
Browser ──► X:34321 (Dashboard / Reverse Proxy) ┛

流程:

  1. Client 调用 /pre_connect 提交公钥,Server 验证 API Key 后返回 SSH 连接信息
  2. Client 建立 SSH 端口转发隧道(ssh -R
  3. Client 定期调用 /connect(默认 30s)上报映射信息和心跳
  4. 用户在 Dashboard 点击服务条目后获取 Cookie,后续请求自动转发到对应端口

安装

pip install kite-strings

使用

1. 在云服务器 X 上启动 Server

设置环境变量:

export KITE_APIKEY="your-secret-api-key"
export KITE_SSH_IP="x.example.com"
export KITE_SSH_PORT="22"                # 默认 22
export KITE_SSH_USER="kite"

启动服务:

kite-server --port 34321
参数 默认值 说明
--host 0.0.0.0 监听地址
--port 34321 Dashboard / 代理端口
环境变量 说明
KITE_APIKEY 客户端认证用 Bearer Token
KITE_SSH_IP 返回给客户端的 SSH 地址
KITE_SSH_PORT SSH 端口(默认 22)
KITE_SSH_USER 返回给客户端的 SSH 用户名

2. 在内网服务器上启动 Client

kite-client --server http://X:34321 \
            --apikey your-secret-api-key \
            --map 3000:my-api \
            --map 8888:jupyter
参数 必填 说明
--server Server 的 HTTP 地址
--apikey API Key(也可用 KITE_APIKEY 环境变量)
--map 本地端口:描述,可重复
--name 服务显示名称(默认 hostname)
--ttl 存活超时秒数(默认 60)
--heartbeat 心跳间隔秒数(默认 30)

3. 访问

  • Dashboardhttp://X:34321 查看服务列表和状态
  • 连接服务:在 Dashboard 点击 "Connect :PORT" 获取代理 Cookie
  • 断开代理:访问 http://X:34321/_deselect 清除 Cookie
  • 始终查看 Dashboard:访问 http://X:34321/_dashboard

API

端点 方法 说明
/pre_connect POST 提交公钥,获取 SSH 连接信息(需 Bearer)
/connect POST 上报端口映射和心跳(需 Bearer)
/_api/services GET 获取所有服务状态(JSON)
/_select/{id}/{port} GET 设置代理 Cookie 并跳转
/_deselect GET 清除代理 Cookie
/_dashboard GET 强制显示 Dashboard

防火墙要求

Server X 需要开放:

  • Dashboard 端口(默认 34321)
  • SSH 端口(默认 22)
  • 映射端口范围(默认从 10001 开始,取决于客户端数量)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kite_strings-0.3.2.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kite_strings-0.3.2-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file kite_strings-0.3.2.tar.gz.

File metadata

  • Download URL: kite_strings-0.3.2.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for kite_strings-0.3.2.tar.gz
Algorithm Hash digest
SHA256 8cc5d58fb667bb0db64abba225473f09c85bf6451e55dd2e0725eb7cfc6dc06b
MD5 784d8267dcb383bc08c749df85d4a60f
BLAKE2b-256 72e44ef72486cfe31ab085ebcf560c408bb5e992e6b8a7596d862cff24f82190

See more details on using hashes here.

File details

Details for the file kite_strings-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: kite_strings-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for kite_strings-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 06f92cd395c4b680b71162f4daff4ecafbbfe56cd18952a0a9387c8d26ca10ef
MD5 ce35f2297e2616f0d896be48deedd1c4
BLAKE2b-256 797de530819114a20f50dfa43333f556f16bac4915198af4e70970974065b318

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page