我有两台机器,puppet master--主机名puppet
--和一个单独的客户端,主机名git
。主机上的 puppet 代理工作正常。代理git
失败,并显示“400 未发送所需的 SSL 证书”。首先,puppet master 的配置是 thin/nginx 事务:
puppet:~# ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [i486-linux]
puppet:~# puppet --version
2.7.9
puppet:~# cat /etc/nginx/sites-enabled/default
server {
listen puppet:8140;
ssl on;
ssl_certificate /var/lib/puppet/ssl/certs/puppet.pem;
ssl_certificate_key /var/lib/puppet/ssl/private_keys/puppet.pem;
ssl_ciphers ALL:-ADH:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP;
ssl_client_certificate /var/lib/puppet/ssl/ca/ca_crt.pem;
ssl_verify_client on;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Client-Verify $ssl_client_verify;
proxy_set_header X-Client-Verify SUCCESS;
proxy_set_header X-Client-DN $ssl_client_s_dn;
proxy_set_header X-SSL-Subject $ssl_client_s_dn;
proxy_set_header X-SSL-Issuer $ssl_client_i_dn;
default_type application/x-raw;
location /production/file_content/ {
rewrite ^/production/file_content/modules/([^/]+)/(.*) /$1/files/$2;
break;
root /etc/puppet/modules/;
}
location / {
proxy_pass http://puppet-production;
}
}
# cat /etc/nginx/conf.d/puppet-production-upstream.conf
upstream puppet-production {
server unix:/var/run/puppet/master.00.sock;
server unix:/var/run/puppet/master.01.sock;
server unix:/var/run/puppet/master.02.sock;
}
puppet:~# cat /etc/supervisor/conf.d/puppetmaster.conf
# This file is autogenerated by Puppet. Manual changes will be overwritten!
[program:puppetmaster]
command=/usr/bin/thin start -e development --socket /var/run/puppet/master.%(process_num)02d.sock --user puppet --group puppet --chdir /etc/puppet -R /etc/puppet/config.ru
process_name=%(program_name)s_%(process_num)02d
numprocs=3
priority=999
autostart=true
autorestart=unexpected
startsecs=3
startretries=3
exitcodes=0,2
stopsignal=TERM
stopwaitsecs=10
redirect_stderr=false
stdout_logfile=/var/log/supervisor/puppetmaster/puppetmaster.out
stdout_logfile_maxbytes=250MB
stdout_logfile_backups=10
stderr_logfile=/var/log/supervisor/puppetmaster/puppetmaster.err
stderr_logfile_maxbytes=250MB
stderr_logfile_backups=10
puppet:~# cat /etc/puppet/puppet.conf
[main]
ssldir=$vardir/ssl
[master]
certname=puppet
应用解决方法这里git
当我尝试git
向傀儡大师介绍时,我只能让代理到达这一点:
git:~# puppet agent --waitforcert 30 --test
err: Could not request certificate: Error 400 on SERVER: <html>
<head><title>400 No required SSL certificate was sent</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<center>No required SSL certificate was sent</center>
<hr><center>nginx/1.1.8</center>
</body>
</html>
这资源建议模拟 SSL 连接git
从我的盒子中运行部分:
openssl s_client -host puppet -port 8140 -cert /var/lib/puppet/ssl/certs/git.troutwine.us.pem -key /var/lib/puppet/ssl/private_keys/git.troutwine.us.pem -CAfile /var/lib/puppet/ssl/certs/ca.pem
问题是我遗漏了/var/lib/puppet/ssl/certs/git.troutwine.us.pem
:
git:~# tree /var/lib/puppet/ssl/
/var/lib/puppet/ssl/
├── certificate_requests
├── certs
│ └── ca.pem
├── private
├── private_keys
│ └── git.troutwine.us.pem
└── public_keys
└── git.troutwine.us.pem
普通的 webrick puppetmasterd 运行良好——只有 nginx/puppet 组合让我失望。两台机器都运行 ntpd,时间分布可以接受。我做错了什么?
答案1
频道中的 newl#puppet
建议将其修改ssl_verify_client
为“可选”,而不是“启用”。我已经这样做了,现在一切都很顺利。
我自己也确信这是一件坏事,但在 newl 的建议之后,我记不起为什么了。如果有人做相信这是一个不太理想的配置设置,请告诉我。
答案2
如果您在主服务器上运行 Puppet 代理,则应确保它们不共享 SSL 目录。我曾见过该配置导致的奇怪结果。
摘自我的/etc/puppet/puppet.conf
:
[main]
# Where SSL certificates are kept for the puppet master and other
# subcommands.
# Note that this is a global setting because most of the subcommands
# other than 'agent' are only valid in puppetmaster context.
# The default value is '$confdir/ssl'.
vardir = /var/lib/puppetmaster
ssldir = $vardir/ssl
[agent]
# The var & SSL dir for the agent; listed explicitly because the master
# and other subcommands intended for the master should use
# the different SSL state.
# The default value is '$confdir/ssl'.
vardir = /var/lib/puppet
ssldir = $vardir/ssl