mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 08:05:49 -06:00
[GH-ISSUE #3633] stcp优雅的使用方式应该是怎样的? #2897
Labels
No labels
In Progress
WIP
WaitingForInfo
bug
doc
duplicate
easy
enhancement
future
help wanted
invalid
lifecycle/stale
need-issue-template
need-usage-help
no plan
proposal
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/frp#2897
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @zhufeng on GitHub (Sep 28, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3633
Bug Description
目前的环境共有1个frps,2个frpc,分别为frpc1( linux/mips, v0.45.0) 以及frpc2( win/amd64, v0.51.2)。
在frpc1中开启了stcp,配置如下:
在frpc2中开启了visitor,配置如下:
最近把frps升级到了linux/amd64 v0.51.3,然后发现visitor这端无法正常访问stcp了,日志错误为:
最终发现原因是在frpc2的visitor的[common]里面没有写user=参数。
但是在frps升级至0.51.3版本之前,frpc2 visitor的写法,其实是上面注释掉的部分,即server_name = frpc1.web_http_stcp,也就是说新版不再支持用加user前缀这种方式来定义user了。即使是显式的在visitor里面再加上server_user = frpc1,仍然会由于没有在common里面定义user而继续报错,那么visitor的server_user的参数的意义在哪里呢?
那么就引申出了另外一个问题,stcp优雅的使用方式是怎么样的?
由于stcp visitor会解析[common]里面的user=字段当成用户,如果我需要在一个frpc上,同时访问2个不同机器的stcp,这样是否就需要开2个frpc的进程及2个单独的frpc.ini配置,分别在[common]里面定义不同stcp的user=字段?
另外就是,如果一个frpc同时需要既当成普通frpc客户端,也需要作为visitor访问stcp,那么现有的版本有没有办法只开一个frpc的进程来实现呢?(按照上面的方法测试发现是不行的,需要跑2个frpc进程,以及需要各自的frpc.ini配置)
https://github.com/fatedier/frp/issues/927#issuecomment-440503770
frpc Version
0.51.2 & 0.45.0
frps Version
0.51.3
System Architecture
linux/mips, windows/amd64
Configurations
Logs
Steps to reproduce
...
Affected area
@fatedier commented on GitHub (Sep 28, 2023):
先通过
allow_users指定允许哪些其他用户访问。docvisitor 中通过配置
server_user指定要访问的其他用户名称。doc@superzjg commented on GitHub (Sep 28, 2023):
是的,我也发现了,不都升级只能是在全局设置user
如果都升级了,按照楼上大大的方法,可达到你的要求。
@zhufeng commented on GitHub (Sep 28, 2023):
原来这个allow_users的stcp的参数是在v0.50版本引入的,需要更新frpc bin文件。
测试了一下确实是能解决这个问题,感谢。
@finallycc commented on GitHub (Sep 26, 2024):
版本0.60.0
各位好,我参考配置
在linux A系统使用
ssh -R :80:127.0.0.1:22 v0@192.168.1.10 -p 2200 stcp -t Pwd001 -u finallycc -n U001 --sk P001 --allow-users *创建stcp,这个* 号不生效
ssh -R :80:127.0.0.1:22 v0@192.168.1.10 -p 2200 stcp -t Pwd001 -u finallycc -n U001 --sk P001 --allow-users finallycc创建stcp,这个是生效的
在linux B系统使用
./frpc stcp visitor -s "192.168.1.10" -P 9000 -t Pwd001 --uc --ue -n V001 -u finallycc --server_name U001 --sk P001 --bind_addr "127.0.0.1" --bind_port 22能否给我一个例子能正确配置--allow-users 参数?
可以访问
@finallycc commented on GitHub (Sep 27, 2024):
您好,我发现--server_user 这个参数在命令模式下,还未支持,如果可以希望您增加以下
**Usage:
frpc stcp visitor [flags]
Flags:
--bind-addr string bind addr
--bind-port int bind port
-h, --help help for visitor
--server-name string server name
--sk string secret key
--uc use compression
--ue use encryption
-n, --visitor-name string visitor name**
@finallycc commented on GitHub (Sep 27, 2024):
经过测试 --allow-users U002 和--allow-users "*" 是可以的
但是我如果想设置多个用户呢
我测试了如下场景,都失败了
--allow-users U001 U002
--allow-users "U001" "U002"
--allow-users '["U001","U002"]'
--allow-users [U001,U002]
--allow-users ["U001","U002"]
请问我该如何配置U001 和U002