本文使用FRP远程推送发布!

前言

马上就要去哈尔滨辣!

在外也不能停止办公!只能把小主机放家里然后内网穿透了。之前薅的阿里云学生服务器还没过期,狠狠用。直接自建FRP服务。

环境

  • 客户端:Ubuntu 22.04.5 LTS / 4c4g@500M
  • 服务端: Debian 12 / 2c2g@20M

部署

文件下载

fatedier/frp: A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet

服务端

参考官方文档:多个 SSH 服务复用同一端口 - GoFRP

之前的版本是0.58.1,当时还支持ini作为配置文件。新版本已经废除了,全部更换为TOMLTOML不赖,因此还需要将老配置修改一下。看官方文档自己改下对应的键和值就行了。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frps.toml
bindAddr = "0.0.0.0"
bindPort = 7000

tcpmuxHTTPConnectPort = 7002

webServer.addr = "0.0.0.0"
webServer.port = 7005
webServer.user = "YDGLM"
webServer.password = "114514"

log.to = "./frps.log"
log.level = "info"
log.maxDays = 7

auth.method = "token"
auth.token = "1919810"

配置完后可以用设定的用户名和密码访问GUI面板,比如http://11.4.51.4:7005

客户端

同样下载好文件解压,修改配置文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
# frpc.toml
serverAddr = "11.4.51.4"
serverPort = 7000
auth.token = "1919810"

[[proxies]]
name = "littlebox_ssh"
type = "tcpmux"
multiplexer = "httpconnect"

customDomains = ["frpbox.local"]
localIP = "127.0.0.1"
localPort = 22

似乎还可以使用secret的方式来进行鉴权。懒得折腾了。能跑就不动。

Windows下连接

官方文档中提到,连接命令为:

1
ssh -o 'proxycommand socat - PROXY:x.x.x.x:%h:%p,proxyport=5002' test@machine-a.example.com

但是Windows下并没有socat。因此,先安装Cygwin,再去手动下载Unix导出后的socat相关文件放到path中。