From 66165824ee84bbc22b500ff1f6800f2ec6ed5805 Mon Sep 17 00:00:00 2001 From: chenjh356 <2551655933@qq.com> Date: Thu, 1 Aug 2024 21:48:41 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(=E4=BF=AE=E6=94=B9=E4=BA=86a?= =?UTF-8?q?pps=E4=B8=8B=E9=9D=A2=E7=9A=84frps=E7=9A=84scripts):=20?= =?UTF-8?q?=E8=A7=A3=E5=86=B3frps=E4=BD=BF=E7=94=A8tcp=E6=97=B6=E7=9A=84?= =?UTF-8?q?=E7=AB=AF=E5=8F=A3=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加允许端口范围的配置,以避免端口滥用,而且配置该项目,及时调用openport函数开启对应端口,确保tcp的frp转发正常运作 之前的版本因为没有配置tcp的转发的iptables导致tcp不能正常转发,需要登陆路由器手动添加的问题:https://github.com/fatedier/frp/issues/2407 --- apps/frps/scripts/config.sh | 1 + apps/frps/scripts/frps.sh | 2 ++ 2 files changed, 3 insertions(+) diff --git a/apps/frps/scripts/config.sh b/apps/frps/scripts/config.sh index 2e671fa..d6d9e5f 100644 --- a/apps/frps/scripts/config.sh +++ b/apps/frps/scripts/config.sh @@ -18,6 +18,7 @@ if [ "$enable" == '1' ]; then readsh "请输入${appname}的kcp配置[1/0]" "kcp" "1" readsh "请输入${appname}用于http穿透的端口号" "http_port" "90" readsh "请输入${appname}用于https穿透的端口号" "https_port" "91" + readsh "请输入${appname}用于tcp的端口号" "allow_tcp_ports" "10001-11000" readsh "请输入${appname}访问密钥" "token" "12345678" readsh "请输入${appname}子域名" "subdomain" read -p "是否启用${appname}的web控制面板?[1/0] " res diff --git a/apps/frps/scripts/frps.sh b/apps/frps/scripts/frps.sh index 1f50f33..1d1ef35 100644 --- a/apps/frps/scripts/frps.sh +++ b/apps/frps/scripts/frps.sh @@ -9,6 +9,7 @@ open_ports() { [ -n "$http_port" ] && open_port $http_port [ -n "$https_port" ] && open_port $https_port [ -n "$dashboard_port" ] && open_port $dashboard_port + [ -n "$allow_tcp_ports" ] && open_port ${allow_tcp_ports//-/:} } start() { @@ -39,6 +40,7 @@ token = $token #max_ports_per_client = 0 #authentication_timeout = 900 `[ -n "$subdomain" ] && echo "subdomain_host = $subdomain"` +`[ -n "$allow_tcp_ports" ] && echo "allow_ports = $allow_tcp_ports"` tcp_mux = true EOF daemon ${mbroot}/apps/${appname}/bin/${appname} -c ${mbroot}/apps/${appname}/config/${appname}.conf