在Chef服务器上禁用SSL?

我在/etc/opscode/chef-server.rb文件中设置了nginx ['enable_non_ssl'] = true,并运行了chef-server-ctl reconfigure,但是当我尝试curl chef的http端口时,我仍然会被重定向,这有点违背了这个设置的目的。请查看以下错误。

我的chef-server.rb文件:

cat /etc/opscode/chef-server.rb

nginx['enable_non_ssl']=true
nginx['non_ssl_port']=80

运行重新配置:

chef-server-ctl reconfigure

Starting Chef Client, version 12.0.3
resolving cookbooks for run list: ["private-chef::default"]
[2015-05-25T13:12:26+00:00] WARN: Cookbook 'local-mode-cache' is empty or entirely chefignored at /opt/opscode/embedded/cookbooks/local-mode-cache
[2015-05-25T13:12:26+00:00] WARN: Cookbook 'local-mode-cache' is empty or entirely chefignored at /opt/opscode/embedded/cookbooks/local-mode-cache
[2015-05-25T13:12:26+00:00] WARN: Cookbook 'local-mode-cache' is empty or entirely chefignored at /opt/opscode/embedded/cookbooks/local-mode-cache
....

Curl命令显示我仍然被重定向:

curl http://chef-xxx.xxxxxx.com

<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>openresty/1.7.10.1</center>
</body>
</html>

如何使chef-server工作?

点赞
用户1985032
用户1985032

来自 Chef 的相关设置:

默认情况下,chef-server.rb 文件不存在。要修改 Chef server 的设置,请在 /etc/opscode/ 目录下创建名为 chef-server.rb 的文件。

Enterprise Chef 的早期版本中,此文件被命名为 private-chef.rb。从 Enterprise Chef 升级到 Chef server 12 后,private-chef.rb 文件被链接到 chef-server.rb。从 Chef server 12 开始,不再使用 private-chef.rb 文件。

nginx['enable_non_ssl']

用于允许将端口 80 的重定向到端口 443。当将此值设置为 false 时,允许前端硬件上的负载均衡器对 WebUI 和 API 进行 SSL 终止。默认值为 false。

nginx['non_ssl_port']

在没有 SSL 连接的情况下,WebUI 和 API 绑定的端口号。默认值为 80。使用 nginx['enable_non_ssl'] 来启用或禁用此端口号上的 SSL 重定向。将其设置为 false 可禁用非 SSL 连接。

根据上述信息,我认为您需要编辑/创建 /etc/opscode/ 目录下的 chef-server.rb 文件,然后运行 chef-server-ctl reconfigure

2015-05-23 04:56:28
用户6498545
用户6498545

将下面翻译成中文并且保留原本的 markdown 格式

`The change in the chef-server.rb file made the url as http but when I logged in prompted again for https login means; user login is twice once in http and once in https.

let me know if you had a chance to try this and any success in the configuration as HTTP Instance Thanks in advance.`

在 chef-server.rb 文件中更改了 URL 为 HTTP,但是当我登录时,又提示我进行 HTTPS 登录,这意味着用户登录了两次,一次是 HTTP,一次是 HTTPS。

如果您有机会尝试一下此配置,并且有成功的经验,请提前告诉我。谢谢!

2016-09-21 09:40:03
用户6653105
用户6653105

因此,我调查了这个问题并发现以下内容:

除了 Nginx 外,WebUI chef-manage 使用 Unicorn web 服务器,并且该应用程序具有属性 config.force_ssl=true,除非环境变量 ENV['NO_SSL']。

因此,要禁用 SSL,您需要将环境变量 export NO_SSL=true 传递给 WebUI 的运行命令或运行脚本。

2017-03-06 11:14:45