![无法为 puppet-dashboard 生成证书](https://linux22.com/image/801443/%E6%97%A0%E6%B3%95%E4%B8%BA%20puppet-dashboard%20%E7%94%9F%E6%88%90%E8%AF%81%E4%B9%A6.png)
我无法生成用于 puppet-dashboard 的证书。仪表板与 puppet-master 在同一台主机上运行,两者都在 apache/passenger 下运行。服务器名称为“mon1”,但“puppet”和“dashboard”是此服务器的别名,是各个节点使用的。
版本:
puppet --version
3.2.0-rc1
puppet-dashboard:
1.2.23
傀儡名称本身是可解析的:
$ curl -k https://puppet:8140
can't convert nil into String
这是我的配置,下面是错误:
# config/settings.yml
cn_name: 'dashboard'
ca_crl_path: 'certs/dashboard.ca_crl.pem'
ca_certificate_path: 'certs/dashboard.ca_cert.pem'
certificate_path: 'certs/dashboard.cert.pem'
private_key_path: 'certs/dashboard.private_key.pem'
public_key_path: 'certs/dashboard.public_key.pem'
ca_server: 'puppet'
ca_port: 8140
# auth.conf
path /facts
auth any
method find, search
allow *
path /inventory
auth any
method find, search
allow *
错误如下:
[root@mon1 puppet-dashboard]# sudo -u puppet-dashboard rake cert:create_key_pair
DEPRECATION WARNING: Rake tasks in vendor/plugins/delayed_job/tasks are deprecated. Use lib/tasks instead. (called from /usr/share/puppet-dashboard/vendor/rails/railties/lib/tasks/rails.rb:10)
[root@mon1 puppet-dashboard]# sudo -u puppet-dashboard rake cert:request --trace
DEPRECATION WARNING: Rake tasks in vendor/plugins/delayed_job/tasks are deprecated. Use lib/tasks instead. (called from /usr/share/puppet-dashboard/vendor/rails/railties/lib/tasks/rails.rb:10)
** Invoke cert:request (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute cert:request
rake aborted!
400 ""
/usr/lib/ruby/1.8/net/http.rb:2105:in `error!'
/usr/share/puppet-dashboard/lib/puppet_https.rb:27:in `put'
/usr/share/puppet-dashboard/lib/tasks/install.rake:50
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/task.rb:246:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/task.rb:184:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/application.rb:101:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/application.rb:101:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/application.rb:73:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/bin/rake:33
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
Tasks: TOP => cert:request
编辑:
我的 apache vhost 似乎出了点问题。当将 Puppet Master 作为守护进程或本地运行时,对库存服务的查询可以正常工作,但由 apache 托管时则不行。以下是我的 vhost:
Listen 8140
<VirtualHost *:8140>
SSLEngine On
# Only allow high security cryptography. Alter if needed for compatibility.
SSLProtocol All -SSLv2
SSLCipherSuite HIGH:!ADH:RC4+RSA:-MEDIUM:-LOW:-EXP
SSLCertificateFile /var/lib/puppet/ssl/certs/mon1.domain.com.pem
SSLCertificateKeyFile /var/lib/puppet/ssl/private_keys/mon1.domain.com.pem
SSLCertificateChainFile /var/lib/puppet/ssl/ca/ca_crt.pem
SSLCACertificateFile /var/lib/puppet/ssl/ca/ca_crt.pem
SSLCARevocationFile /var/lib/puppet/ssl/ca/ca_crl.pem
SSLVerifyClient optional
SSLVerifyDepth 1
SSLOptions +StdEnvVars +ExportCertData
# These request headers are used to pass the client certificate
# authentication information on to the puppet master process
RequestHeader set X-SSL-Subject %{SSL_CLIENT_S_DN}e
RequestHeader set X-Client-DN %{SSL_CLIENT_S_DN}e
RequestHeader set X-Client-Verify %{SSL_CLIENT_VERIFY}e
DocumentRoot /usr/share/puppet/rack/puppetmasterd/public/
<Directory /usr/share/puppet/rack/puppetmasterd/>
Options None
AllowOverride None
Order Allow,Deny
Allow from All
</Directory>
</VirtualHost>
Passenger 相关的调整设置在不同的虚拟主机中,但我认为它们无关紧要。这可能与证书名称为“mon1.domain.com”而不是“puppet.domain.com”有关吗?
这是 access_log 的一个示例:
# curl -k -H "Accept: yaml" https://puppet:8140/production/facts/my.node.com
<LOCALIP> - - [09/May/2013:16:52:40 +1000] "GET /production/facts/my.node.com HTTP/1.1" 400 29 "-" "curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2"
# some node making a request
<REMOTEIP> - - [09/May/2013:16:52:53 +1000] "GET /production/node/some.other.node? HTTP/1.1" 200 3291 "-" "Ruby"
请注意,我尝试使用本地机器上的 curl 来查询事实和节点,但不起作用。与 puppet-dashboard 的尝试相同。
答案1
很奇怪它刚刚起作用了..我没有在你的 Apache 配置中看到任何东西会在 Passenger 下运行时导致 400 响应,而在 webrick 下不会发生这种情况,但你永远不知道。
乘客身下的傀儡大师还能正常工作吗?
如果您想继续弄清楚发生了什么,那么找出问题所在下一步就是启用--debug
您的线路。或者您也可以只使用 webrick 解决方法请求和签名证书,然后就结束了。config.ru
确保以下设置已添加到您的 puppet.conf 文件:
[master]
ssl_client_header = SSL_CLIENT_S_DN
ssl_client_verify_header = SSL_CLIENT_VERIFY