Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bfe 容器版无法通过 web-monitor 热加载配置 #1075

Open
AFreeCoder opened this issue Oct 6, 2022 · 4 comments
Open

bfe 容器版无法通过 web-monitor 热加载配置 #1075

AFreeCoder opened this issue Oct 6, 2022 · 4 comments
Assignees
Labels
good first issue Good for newcomers
Projects
Milestone

Comments

@AFreeCoder
Copy link

AFreeCoder commented Oct 6, 2022

bug描述
bfe docker 版本 bfenetworks/bfe:v-1.5.0 无法通过web-monitor 对配置进行热加载,提示:

{
    "error": "reload is not allowed from [xxx.xxx.xxx.xxx:xxxx]"
}

复现
docker run --name bfe -p 8080:8080 -p 8443:8443 -p 8421:8421 -v /home/work/data/bfe/log:/bfe/log -v /home/work/data/bfe/conf:/bfe/conf -d bfenetworks/bfe:v-1.5.0

推测
监控机制的热加载有安全要求(仅允许从同服务器访问):

// source ip address allowed to do reload
var RELOAD_SRC_ALLOWED = map[string]bool{
	"127.0.0.1": true,
	"::1":       true,
}

而从容器外访问无法满足同服务器的要求,另外容器中并未安装 curl 等工具,所以容器版bfe无法完成实现配置热加载。

@mileszhang2016
Copy link
Member

从安全角度考虑,BFE对发起reload的客户端来源地址确实做了限制,只允许从同机发起。

一种可能的解决方案是对于web-monitor端口的访问增加认证控制机制,从而允许远程触发reload。
如果哪位同学有兴趣,也欢迎贡献这方面的功能代码。

@kwanhur
Copy link
Contributor

kwanhur commented Oct 9, 2022

建议先将允许的来源地址转移至bfe_server.conf配置文件,而非硬编码在代码中。

@iyangsj iyangsj added the good first issue Good for newcomers label Oct 10, 2022
@iyangsj iyangsj added this to To do in BFE 1.0 via automation Oct 10, 2022
@iyangsj iyangsj added this to the Proposal milestone Oct 10, 2022
@iyangsj
Copy link
Member

iyangsj commented Oct 10, 2022

1 这个功能内部版本BFE是支持的,可以考虑将这个功能开源出来

  • 如果基于开源版本直接实现,可以调用 web_monitor库的 InitReloadACL() 来定制允许的源地址

2 一些外部用户采用了如下方案来解决这类问题,供参考: @AFreeCoder

  • Step1 配置一个特殊的Product及Cluster,Cluster仅包含一个后端实例,指向了“127.0.0.1:<monitor_port>”
  • Step2 配置特殊的路由规则,将热加载请求转发到相应Prodcut及Cluster
    (例如:热加载请求使用约定的Host及特殊Header)
  • Step3 配置访问控制规则,仅允许受限的访问
    (例如:基于访问源地址、基于请求认证等)

@bhavyastar
Copy link

Can I work on this issue? @iyangsj @mileszhang2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
BFE 1.0
  
To do
Development

No branches or pull requests

5 participants