Chef infra 在Chef服务器上禁用ssl?

Chef infra 在Chef服务器上禁用ssl?,chef-infra,chef-recipe,Chef Infra,Chef Recipe,我在/etc/opscode/chef server.rb文件中设置了nginx['enable_non_ssl']=true,并运行chef server ctl reconfigure,但当我尝试为chef卷曲http端口时,仍然会得到重定向,这与此设置的目的背道而驰。请参阅下面的错误 我的chef server.rb文件: cat/etc/opscode/chef-server.rb 正在运行重新配置: chef服务器ctl重新配置 Curl命令显示我仍然被重定向: 卷曲 301永久搬迁

我在
/etc/opscode/chef server.rb
文件中设置了
nginx['enable_non_ssl']=true
,并运行
chef server ctl reconfigure
,但当我尝试为chef卷曲http端口时,仍然会得到重定向,这与此设置的目的背道而驰。请参阅下面的错误

我的
chef server.rb
文件:

cat/etc/opscode/chef-server.rb

正在运行重新配置:

chef服务器ctl重新配置

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

卷曲


301永久搬迁
301永久搬迁

openresty/1.7.10.1
我怎样才能让厨师服务台正常工作

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

注意 在早期版本的Enterprise chef中,此文件名为private-chef.rb。从Enterprise Chef升级到Chef server 12后,private-Chef.rb文件将符号链接到Chef-server.rb。private-chef.rb文件已弃用,从chef服务器12开始

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

为非SSL连接绑定WebUI和API的端口。默认值:80。使用nginx['enable_non_ssl']启用或禁用此端口号上的ssl重定向。设置为false以禁用非SSL连接


因此,根据上述内容,我相信您需要在
/etc/opscode/
目录中编辑/创建
chef server.rb
文件,然后运行
chef server ctl reconfigure

chef-server.rb文件中的更改使url变为http,但当我再次登录时,提示使用https登录方式;用户登录两次,一次在http中,一次在https中


请告诉我您是否有机会尝试此配置以及作为HTTP实例的配置是否成功,提前感谢。

因此,我调查了此问题,发现了下一个问题:

除Nginx外,WebUI chef manage使用Unicorn web服务器,并且应用程序具有属性config.force_ssl=true,除非ENV['NO_ssl']

所以,要禁用SSL,您需要传递env变量
export NO_SSL=true
来运行命令或WebUI的脚本

我也有同样的问题,已经解决了 最近安装Chef Server时,我遇到了同样的问题(
Chef manage v2.4.4

您可以通过读取部署的Chef服务器的更改日志来查看Chef管理版本:http(s)://your-Chef-server.com/changelog

我们想要什么 在专用服务器上安装my chef server实例后,它确实可以正确使用SSL

但我们的生产服务器部署在专用VLAN中的专用主机上,用户通过作为反向代理运行的nginx web服务器访问服务或web应用程序

因此,要将chef服务器置于生产模式,我必须配置反向代理来代理请求:

以下是正确的请求/响应路由模式:

请求:

client    443 >> 443 chef.company.com (DNS: rev-proxy)
rev-proxy  80 >> 80  chef.vlan
答复:

rev-proxy  80 << 80  chef.vlan
client    443 << 443 chef.company.com
以及(因为这已经是默认值)以下选项:

nginx['non_ssl_port']=80
因此,我们需要重新配置chef服务器:

# chef-server-ctl reconfigure
# chef-server-ctl reconfigure
但是chef服务器中有一个bug 但用于生成nginx confi文件的chef模板配方中有一个bug。因此,当我们重新配置chef服务器时,前面的指令被忽略

所以无限循环就在那里

错误通知单:

此外,您还可以看到以下其他资源:

解决问题 为了解决这个问题,我不得不修改错误通知单中提出的解决方案

在chef主机上查找nginx配置文件 最后一个是嵌入的nginx conf文件。它包含以下集团代码,问题来源:

# We support three options: serve nothing on non_ssl_port (80),
# redirect to https, or actually serve the API.
      server {
        listen 80;
        access_log /var/log/opscode/nginx/rewrite-port-80.log;
        return 301 https://$host$request_uri;
      }
查找源于嵌入式nginx配置的nginx配置配方 第三个是生成嵌入式nginx配置的模板:

/opt/opscode/embedded/cookbooks/private-chef/recipes/nginx.rb
  === > /var/opt/opscode/nginx/etc/nginx.conf
修改食谱 我们必须通过以下几行来修复它:

node.default['private\u chef']['nginx']['enable\u non\u ssl']=true

我们应该将其附加到以下块中:

# Save node attributes back for use in config template generation
node.default['private_chef']['nginx']['ssl_certificate'] ||= ssl_crtfile
node.default['private_chef']['nginx']['ssl_certificate_key'] ||= ssl_keyfile
node.default['private_chef']['nginx']['ssl_dhparam'] ||= ssl_dhparam
因此,最终的块代码如下所示:

# nano /opt/opscode/embedded/cookbooks/private-chef/recipes/nginx.rb
:

应用更改 最后,我们必须通过重新配置chef服务器,从配方模板重新生成nginx配置文件:

# chef-server-ctl reconfigure
# chef-server-ctl reconfigure
然后,路由模式按预期工作


享受吧

不,我仍然得到重定向,请参阅上面更新的问题。我已经有了所有这些步骤,我只是使用了/etc/chef-server/chef-server.rb而不是/etc/opscode/chef-server.rb。但是,移动文件并不能解决任何问题。@UsmanIsmail您运行的是社区版还是企业版?如果您正在运行社区,我将启动AWS EC2系统进行测试。如果是enterprise,我建议您提交一张罚单。@UsmanIsmail只是为了快速检查您是否正在运行ubuntu/red hat/centos?AWS AMI,我认为这是red hat variantAny的更新?我在Chef Server 11.1.0-1上看到了相同的问题…尝试在Chef节点上禁用SSL,以便能够管理外部F5上的SSL终止。嵌入式nginx配置配方中存在错误。看看如何在我的回答中解决这个问题:你能接受一个答案吗?
root@chef-srv:~# find / -name nginx.conf
/opt/chef-manage/embedded/service/gem/ruby/2.2.0/gems/unicorn-4.9.0/examples/nginx.conf
/opt/opscode/embedded/service/gem/ruby/2.2.0/gems/unicorn-5.1.0/examples/nginx.conf
/opt/opscode/embedded/conf/nginx.conf
/var/opt/opscode/nginx/etc/nginx.conf
# We support three options: serve nothing on non_ssl_port (80),
# redirect to https, or actually serve the API.
      server {
        listen 80;
        access_log /var/log/opscode/nginx/rewrite-port-80.log;
        return 301 https://$host$request_uri;
      }
root@chef-srv:~# find / -name nginx.rb
/opt/chef-manage/embedded/cookbooks/omnibus-chef-manage/recipes/nginx.rb
/opt/chef-manage/embedded/cookbooks/cache/cookbooks/omnibus-chef-manage/recipes/nginx.rb
/opt/opscode/embedded/cookbooks/private-chef/recipes/nginx.rb
/var/opt/opscode/local-mode-cache/cookbooks/private-chef/recipes/nginx.rb
/opt/opscode/embedded/cookbooks/private-chef/recipes/nginx.rb
  === > /var/opt/opscode/nginx/etc/nginx.conf
# Save node attributes back for use in config template generation
node.default['private_chef']['nginx']['ssl_certificate'] ||= ssl_crtfile
node.default['private_chef']['nginx']['ssl_certificate_key'] ||= ssl_keyfile
node.default['private_chef']['nginx']['ssl_dhparam'] ||= ssl_dhparam
# nano /opt/opscode/embedded/cookbooks/private-chef/recipes/nginx.rb
# Save node attributes back for use in config template generation
node.default['private_chef']['nginx']['ssl_certificate'] ||= ssl_crtfile
node.default['private_chef']['nginx']['ssl_certificate_key'] ||= ssl_keyfile
node.default['private_chef']['nginx']['ssl_dhparam'] ||= ssl_dhparam
node.default['private_chef']['nginx']['enable_non_ssl']=true
# chef-server-ctl reconfigure