## 服务器安装frps后,是存在风险的
因类提供的服务方式,是由frpc配置的;因此,只要缩减frps的功能,即可以限制frpc的自由度,从而降低风险。
有如下几个步骤:
### 1、基于frps代码,裁掉其它模式,只保留tcp或者http
下载frp源码(哪个版本都可以,搭配好golang版本)
Release v0.37.1 · fatedier/frp · GitHub
使用任意文本编辑器进行编辑:
1、./server/proxy/ 下面的多个.go文件,只保留如图三个
2、./server/proxy/proxy.go 文件中,switch代码中的case,只保留TCP与HTTP的方式,其它都可删掉
### 2、frps的代码得自行编译
安装go 1.16环境
在源码根目录下输入指令:
```bash
make -f ./Makefile.cross-compiles
```
会自动生成可执行文件,存放在 ./release/ 目录下
### 3、frps启动前还可以通过frps.ini配置文件来加强安全性
打开frps.ini文件,找到allow_ports配置,限制住服务器端能启动的端口
#only allow frpc to bind ports you list, if you set nothing, there won't be any limit
allow_ports = 50000-50005