傀儡证书不符合EC2

我正在通过gem(rhel6)在ec2中build立一个puppetmaster(2.7.6),我遇到了证书名称的问题,并让主人能够自己说话。

我的puppet.conf看起来像这样:

[main] logdir = /var/log/puppet rundir = /var/run/puppet vardir = /var/lib/puppet ssldir = $vardir/ssl pluginsync = true environment = production report = true certname = master 

当我启动puppetmaster进程时,ssl目录如下所示:

 ssl/private_keys/master.pem ssl/crl.pem ssl/public_keys/master.pem ssl/ca/ca_crl.pem ssl/ca/signed/master.pem ssl/ca/ca_crt.pem ssl/ca/ca_pub.pem ssl/ca/ca_key.pem ssl/certs/ca.pem ssl/certs/master.pem 

我有一个/ etc / hosts条目,将'puppet'主机名指向localhost,这样我就不必更改'server'选项。

当我运行代理时,我得到以下内容:

 # puppet agent --test info: Retrieving plugin err: /File[/var/lib/puppet/lib]: Failed to generate additional resources using 'eval_generate: Server hostname 'puppet' did not match server certificate; expected master err: /File[/var/lib/puppet/lib]: Could not evaluate: Server hostname 'puppet' did not match server certificate; expected master Could not retrieve file metadata for puppet://puppet/plugins: Server hostname 'puppet' did not match server certificate; expected master err: Could not retrieve catalog from remote server: Server hostname 'puppet' did not match server certificate; expected master warning: Not using cache on failed catalog err: Could not retrieve catalog; skipping run err: Could not send report: Server hostname 'puppet' did not match server certificate; expected master 

如果我指定certname作为服务器(与相应的主机条目),我得到:

 # puppet agent --test --server master info: Retrieving plugin err: /File[/var/lib/puppet/lib]: Could not evaluate: Could not retrieve information from environment production source(s) puppet://master/plugins info: Caching catalog for master info: Applying configuration version '1321805956' notice: Finished catalog run in 0.05 seconds 

哪一种是成功的,那么当我申请清单的时候,这个来源错误会让我感到困扰。 我已经尝试了一些使用ec2私有主机名的其他变体,并得到了混合的结果。

我想避免设置服务器='x'和使用DNS /主机来控制什么'木偶'来解决,以决定哪个服务器(播放更容易与可用性区等)

所以经过一番调查,我发现了这一点。 当Puppet 2.7.6为主服务器生成证书时,它不会在服务器证书上设置subjectAltNames(它真的不知道它是否是主服务器)。

有两种方法可以解决这个问题:

1.手动生成主文件的证书

 puppet ca generate --dns_alt_names puppet [master-name/uuid/string/etc] 

2.在puppet.conf中设置dns_alt_names

在运行puppet master或puppet(导致生成证书)之前,将dns_alt_names = puppet添加到master(以及master)

现在,连接到“puppet”的/ etc / hosts或dns条目将工作得很好。

与插件有关的其他错误是关于启用插件同步但是没有插件可用于同步的错误。

 certname = master 

您将certname设置为master。 对于你设置它的方式,要么使用puppet,要么使用host文件来设置master而不是puppet的ip地址。

您可能还想使用FQDN,例如master.example.com或puppet.example.com,这样您就可以使用dns条目而不需要search域条目。

在EC2中使用puppet的一个技巧是给你的puppet分配一个ElasticIP,然后为ElasticIP CNAME创build一个DNS条目,而不是IP的Alogging。

AWS DNS服务器根据查询是来自同一个EC2区域还是来自外部,来改变其响应。 如果CNAME请求来自EC2区域,则AWS DNS服务器将使用CNAME的内部IP进行响应。

您应该在DNS中使用CNAME,以便当EC2 puppet客户端向AWS DNS服务器查询Puppetmaster的IP时,他们将收到一个响应,指示他们到puppetmaster的内部IP,而不是外部IP。