Skip to content

Instantly share code, notes, and snippets.

@PrintNow
Last active May 14, 2025 10:37
Show Gist options
  • Save PrintNow/56a7d4f199f65e9ad13d7056ce37f0aa to your computer and use it in GitHub Desktop.
Save PrintNow/56a7d4f199f65e9ad13d7056ce37f0aa to your computer and use it in GitHub Desktop.
基于 Docker 的 SSH Forward 转发服务
Host forward.service
User root
ProxyCommand websocat --binary -k wss://websocket-over-https.example.com
PreferredAuthentications publickey
IdentitiesOnly yes
RequestTTY no
ServerAliveInterval 10
ServerAliveCountMax 3
TCPKeepAlive yes
LocalForward 127.0.0.1:60000 172.6.6.6:22
services:
ssh-forward:
image: shine09/ssh-client-websocat:latest
restart: always
volumes:
- /home/user1/.ssh:/root/.ssh:ro
command: [ "ssh", "-vvv", "-N", "-o", "ExitOnForwardFailure=yes", "forward.service" ]
ports:
- "60000:60000"
- "60042:60042"
- "60043:60043"
- "60011:60011"
- "60012:60012"
- "60013:60013"
- "60014:60014"
- "60020:60020"
- "60030:60030"
- "60031:60031"
FROM alpine:3.21
ADD https://github.com/vi/websocat/releases/download/v1.14.0/websocat.x86_64-unknown-linux-musl /usr/bin/websocat
RUN chmod +x /usr/bin/websocat && \
apk add --no-cache \
openssh-client \
ca-certificates \
bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment