Featured image of post 使用cloudflared搭建webssh

使用cloudflared搭建webssh

使用cloudflared搭建webssh

下载

1
curl -L 'https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64' -o /usr/local/bin/cloudflared
  1. 登录认证
1
cloudflared tunnel login
  1. 创建域名,得到隧道ID
1
cloudflared tunnel route dns ssh awssgssh.543083.xyz
  1. 修改配置文件,添加 SSH 代理
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
cat > /root/.cloudflared/config.yml << EOF
tunnel: e7425241-3827-4e3a-830e-dde066ae6915
credentials-file: /root/.cloudflared/e7425241-3827-4e3a-830e-dde066ae6915.json
protocol: h2mux
ingress:
  # 第五个,反代 SSH 服务
  - hostname: awssgssh.543083.xyz
    service: ssh://localhost:1522
  # 最后记得添加一个默认 404
  - service: http_status:404
EOF
  1. 验证
1
2
cloudflared tunnel ingress validate
cloudflared tunnel ingress rule https://awssgssh.543083.xyz
  1. 启动测试
1
cloudflared tunnel --config ~/.cloudflared/config.yml run e7425241-3827-4e3a-830e-dde066ae6915
  1. 安装系统服务
1
cloudflared --config /root/.cloudflared/config.yml service install
  1. 配置页面 application 参考:使用 Cloudflare Tunnels 通过 Web SSH 访问服务器 参考:https://blog.hellowood.dev/posts/%E4%BD%BF%E7%94%A8cloudflare-tunnels%E9%80%9A%E8%BF%87web-ssh%E8%AE%BF%E9%97%AE%E6%9C%8D%E5%8A%A1%E5%99%A8/

Photo by Pawel Czerwinski on Unsplash

Licensed under CC BY-NC-SA 4.0
最后更新于 Sep 20, 2024 00:00 UTC
comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计