feat(ssh): support OpenSSH ProxyCommand for tunnel hosts

This commit is contained in:
zipg authored and GitHub committed 2026-10-04 09:51:35 +08:00
1 parent 53cd0c516e
commit a3a5f4f9bd
29 files changed
+413 -10

No files matched your search

@@ -508,6 +508,7 @@ function defaultSshTunnel(): SshTunnelConfig {
ssh_agent_sock_path: "",
auth_method: "password",
allow_exec_channel_proxy: false,
proxy_command: "",
};
}
@@ -528,6 +529,7 @@ function normalizeSshTunnel(hop: Partial<SshTunnelConfig>): SshTunnelConfig {
ssh_agent_sock_path: hop.ssh_agent_sock_path || "",
auth_method: hop.auth_method || inferSshAuthMethod(hop),
allow_exec_channel_proxy: !!hop.allow_exec_channel_proxy,
proxy_command: hop.proxy_command || "",
profile_id: hop.profile_id || undefined,
};
}
@@ -10533,6 +10535,13 @@ function openExternalUrl(url: string) {
<span class="text-xs text-muted-foreground">{{ t("connection.sshAllowExecChannelProxy") }}</span>
</label>
</div>
<div class="grid grid-cols-4 items-start gap-4">
<Label :class="connectionLabelSmallClass">{{ t("connection.sshProxyCommand") }}</Label>
<div class="col-span-3 space-y-1">
<Input v-model="selectedSshLayer.proxy_command" :placeholder="t('connection.sshProxyCommandPlaceholder')" :disabled="selectedSshLayer.enabled === false" />
<p class="text-xs text-muted-foreground">{{ t("connection.sshProxyCommandHint") }}</p>
</div>
</div>
<div class="grid grid-cols-4 items-center gap-4">
<Label :class="connectionLabelSmallClass">{{ t("connection.sshConnectTimeout") }}</Label>
<Input v-model.number="selectedSshLayer.connect_timeout_secs" type="number" min="1" max="300" step="1" class="col-span-3" :disabled="selectedSshLayer.enabled === false" />
+3
View File
@@ -1183,6 +1183,9 @@ export default withEnglishFallback({
sshKeyPathBrowse: "Gözdən keçir",
sshExposeLan: "Tuneli LAN üçün əlçatan et",
sshAllowExecChannelProxy: "SSH exec-channel ehtiyat üsulunu aktivləşdir (nc)",
sshProxyCommand: "ProxyCommand",
sshProxyCommandPlaceholder: "nc %h %p",
sshProxyCommandHint: "Bu hosta çatmaq üçün istəyə bağlı OpenSSH ProxyCommand, məsələn nc %h %p və ya cloudflared access ssh --hostname %h. İcazə verilən köməkçilər: nc, ncat, netcat, cloudflared, socat, connect, corkscrew, ssh.",
sshConnectTimeout: "SSH vaxt limiti (saniyə)",
sshHops: "Tunel / proksi qatları",
sshHopAdd: "SSH qatı əlavə et",
+3
View File
@@ -1480,6 +1480,9 @@ export default {
sshKeyPathBrowse: "Browse",
sshExposeLan: "Expose tunnel to LAN",
sshAllowExecChannelProxy: "Enable SSH exec-channel fallback (nc)",
sshProxyCommand: "ProxyCommand",
sshProxyCommandPlaceholder: "nc %h %p",
sshProxyCommandHint: "Optional OpenSSH ProxyCommand used to reach this host, for example nc %h %p or cloudflared access ssh --hostname %h. Accepted helpers: nc, ncat, netcat, cloudflared, socat, connect, corkscrew, ssh.",
sshConnectTimeout: "SSH Timeout (seconds)",
sshHops: "Tunnel / Proxy Layers",
sshHopAdd: "Add SSH layer",
+3
View File
@@ -1274,6 +1274,9 @@ export default withEnglishFallback({
sshKeyPathBrowse: "Examinar",
sshExposeLan: "Exponer túnel a la red local",
sshAllowExecChannelProxy: "Activar fallback del canal exec SSH (nc)",
sshProxyCommand: "ProxyCommand",
sshProxyCommandPlaceholder: "nc %h %p",
sshProxyCommandHint: "ProxyCommand OpenSSH opcional para llegar a este host, por ejemplo nc %h %p o cloudflared access ssh --hostname %h. Asistentes admitidos: nc, ncat, netcat, cloudflared, socat, connect, corkscrew, ssh.",
sshConnectTimeout: "Tiempo de espera SSH (segundos)",
sshHops: "Capas de túnel SSH / proxy",
sshHopAdd: "Agregar capa SSH",
+3
View File
@@ -1418,6 +1418,9 @@ export default withEnglishFallback({
sshKeyPathBrowse: "Jelajahi",
sshExposeLan: "Ekspos tunnel ke LAN",
sshAllowExecChannelProxy: "Aktifkan fallback exec-channel SSH (nc)",
sshProxyCommand: "ProxyCommand",
sshProxyCommandPlaceholder: "nc %h %p",
sshProxyCommandHint: "ProxyCommand OpenSSH opsional untuk menjangkau host ini, misalnya nc %h %p atau cloudflared access ssh --hostname %h. Helper yang diizinkan: nc, ncat, netcat, cloudflared, socat, connect, corkscrew, ssh.",
sshConnectTimeout: "Timeout SSH (detik)",
sshHops: "Lapisan Tunnel / Proxy",
sshHopAdd: "Tambah lapisan SSH",
+3
View File
@@ -1196,6 +1196,9 @@ export default withEnglishFallback({
sshKeyPathBrowse: "Sfoglia",
sshExposeLan: "Esponi tunnel alla LAN",
sshAllowExecChannelProxy: "Abilita il fallback del canale exec SSH (nc)",
sshProxyCommand: "ProxyCommand",
sshProxyCommandPlaceholder: "nc %h %p",
sshProxyCommandHint: "ProxyCommand OpenSSH opzionale per raggiungere questo host, ad esempio nc %h %p o cloudflared access ssh --hostname %h. Helper consentiti: nc, ncat, netcat, cloudflared, socat, connect, corkscrew, ssh.",
sshConnectTimeout: "Timeout SSH (secondi)",
sshHops: "Livelli tunnel SSH / proxy",
sshHopAdd: "Aggiungi livello SSH",
+3
View File
@@ -1166,6 +1166,9 @@ export default withEnglishFallback({
sshKeyPathBrowse: "参照",
sshExposeLan: "トンネルをLANに公開",
sshAllowExecChannelProxy: "SSH 実行チャネルのフォールバックを有効化(nc)",
sshProxyCommand: "ProxyCommand",
sshProxyCommandPlaceholder: "nc %h %p",
sshProxyCommandHint: "このホストへの接続に使う任意の OpenSSH ProxyCommand(例: nc %h %p、cloudflared access ssh --hostname %h)。使用できるヘルパー: nc、ncat、netcat、cloudflared、socat、connect、corkscrew、ssh。",
sshConnectTimeout: "SSHタイムアウト(秒)",
sshHops: "SSHトンネル / プロキシ階層",
sshHopAdd: "SSH階層を追加",
+3
View File
@@ -1301,6 +1301,9 @@ export default withEnglishFallback({
sshKeyPathBrowse: "찾아보기",
sshExposeLan: "터널을 LAN에 노출",
sshAllowExecChannelProxy: "SSH exec 채널 대체(nc) 활성화",
sshProxyCommand: "ProxyCommand",
sshProxyCommandPlaceholder: "nc %h %p",
sshProxyCommandHint: "이 호스트에 연결할 때 사용하는 선택적 OpenSSH ProxyCommand입니다(예: nc %h %p, cloudflared access ssh --hostname %h). 허용되는 도우미: nc, ncat, netcat, cloudflared, socat, connect, corkscrew, ssh.",
sshConnectTimeout: "SSH 제한 시간 (초)",
sshHops: "터널 / 프록시 계층",
sshHopAdd: "SSH 계층 추가",
+3
View File
@@ -1197,6 +1197,9 @@ export default withEnglishFallback({
sshKeyPathBrowse: "Procurar",
sshExposeLan: "Expor túnel à LAN",
sshAllowExecChannelProxy: "Ativar fallback do canal exec SSH (nc)",
sshProxyCommand: "ProxyCommand",
sshProxyCommandPlaceholder: "nc %h %p",
sshProxyCommandHint: "ProxyCommand OpenSSH opcional usado para alcançar este host, por exemplo nc %h %p ou cloudflared access ssh --hostname %h. Auxiliares aceitos: nc, ncat, netcat, cloudflared, socat, connect, corkscrew, ssh.",
sshConnectTimeout: "Timeout SSH (segundos)",
sshHops: "Camadas de túnel SSH / proxy",
sshHopAdd: "Adicionar camada SSH",
+3
View File
@@ -1391,6 +1391,9 @@ export default withEnglishFallback({
sshKeyPathBrowse: "Обзор",
sshExposeLan: "Открыть туннель для локальной сети",
sshAllowExecChannelProxy: "Включить резервный вариант SSH exec-channel (nc)",
sshProxyCommand: "ProxyCommand",
sshProxyCommandPlaceholder: "nc %h %p",
sshProxyCommandHint: "Необязательный OpenSSH ProxyCommand для подключения к этому узлу, например nc %h %p или cloudflared access ssh --hostname %h. Допустимые команды: nc, ncat, netcat, cloudflared, socat, connect, corkscrew, ssh.",
sshConnectTimeout: "Тайм-аут SSH (секунды)",
sshHops: "Слои туннеля / прокси",
sshHopAdd: "Добавить слой SSH",
+3
View File
@@ -1183,6 +1183,9 @@ export default withEnglishFallback({
sshKeyPathBrowse: "Gözat",
sshExposeLan: "Tüneli yerel ağa aç",
sshAllowExecChannelProxy: "SSH exec-channel yedeğini (nc) etkinleştir",
sshProxyCommand: "ProxyCommand",
sshProxyCommandPlaceholder: "nc %h %p",
sshProxyCommandHint: "Bu ana bilgisayara ulaşmak için isteğe bağlı OpenSSH ProxyCommand, örn. nc %h %p veya cloudflared access ssh --hostname %h. İzin verilen yardımcılar: nc, ncat, netcat, cloudflared, socat, connect, corkscrew, ssh.",
sshConnectTimeout: "SSH Zaman Aşımı (saniye)",
sshHops: "Tünel / Proxy Katmanları",
sshHopAdd: "SSH katmanı ekle",
+3
View File
@@ -1419,6 +1419,9 @@ export default withEnglishFallback({
sshKeyPathBrowse: "浏览",
sshExposeLan: "允许局域网访问隧道",
sshAllowExecChannelProxy: "启用 SSH 执行通道回退(nc)",
sshProxyCommand: "ProxyCommand",
sshProxyCommandPlaceholder: "nc %h %p",
sshProxyCommandHint: "可选的 OpenSSH ProxyCommand,用于通过代理命令连接该主机,例如 nc %h %p、cloudflared access ssh --hostname %h。支持的命令:nc、ncat、netcat、cloudflared、socat、connect、corkscrew、ssh。",
sshConnectTimeout: "SSH 超时时间(秒)",
sshHops: "隧道/代理层级",
sshHopAdd: "添加 SSH 层",
+3
View File
@@ -1208,6 +1208,9 @@ export default withEnglishFallback({
sshKeyPathBrowse: "瀏覽",
sshExposeLan: "允許區域網路存取隧道",
sshAllowExecChannelProxy: "啟用 SSH 執行通道回退(nc)",
sshProxyCommand: "ProxyCommand",
sshProxyCommandPlaceholder: "nc %h %p",
sshProxyCommandHint: "可選的 OpenSSH ProxyCommand,用於透過代理指令連接此主機,例如 nc %h %p、cloudflared access ssh --hostname %h。支援的指令:nc、ncat、netcat、cloudflared、socat、connect、corkscrew、ssh。",
sshConnectTimeout: "SSH 逾時時間(秒)",
sshHops: "SSH 隧道/代理層級",
sshHopAdd: "新增 SSH 層",
@@ -20,4 +20,5 @@ export function applySshConfigHostAliasPrefill(target: SshTunnelConfig, hosts: r
target.auth_method = "key";
}
}
if (!target.proxy_command && entry.proxy_command) target.proxy_command = entry.proxy_command;
}
+10
View File
@@ -255,6 +255,15 @@ export interface SshTunnelConfig {
auth_method?: "password" | "key" | "key+password" | "agent" | "none";
/** Allow `nc` through an SSH exec channel when direct-tcpip is prohibited. */
allow_exec_channel_proxy?: boolean;
/**
* OpenSSH-style `ProxyCommand` used to reach this host instead of a direct
* TCP connection, e.g. `nc %h %p` or
* `cloudflared access ssh --hostname %h`. `%h`/`%p`/`%r`/`%%` expand from
* the effective host, port and user. The executable must be one of the
* helpers the backend allowlists (`nc`, `ncat`, `netcat`, `cloudflared`,
* `socat`, `connect`, `corkscrew`, `ssh`). Empty means a direct connection.
*/
proxy_command?: string;
/**
* When set, this layer references a shared tunnel profile; the profile's
* configuration replaces this layer's fields at connect time (only `id`
@@ -269,6 +278,7 @@ export interface SshConfigHostEntry {
port?: number;
user?: string;
identity_file?: string;
proxy_command?: string | null;
}
export interface ProxyTunnelConfig {