如何手动创建 Puppet CA 和证书?

如何手动创建 Puppet CA 和证书?

我想知道如何手动(使用 openssl 而不是 puppet ca 命令)创建可供 Puppet 使用的 CA?目标是编写此类 CA 的创建脚本,以将它们部署在多个 puppetmaster 上,而不是通过 puppet cert 命令在它们上创建证书。

关于如何做到这一点有什么想法吗?我只能找到类似的东西:https://wiki.mozilla.org/ReleaseEngineering/PuppetAgain/HowTo/Set_up_a_standalone_puppetmaster但它无法工作——在创建 CA 和客户端证书并将它们应用到 puppetmaster 之后,它会抱怨:

Feb 16 09:35:20 test puppet-master[81728]: Could not prepare for execution: The certificate retrieved from the master does not match the agent's private key.
Feb 16 09:35:20 test puppet-master[81728]: Certificate fingerprint: 4F:08:AE:01:B9:14:AC:A4:EA:A7:92:D7:02:E9:34:39:1C:5F:0D:93:A0:85:1C:CF:68:E4:52:B8:25:D1:11:64
Feb 16 09:35:20 test puppet-master[81728]: To fix this, remove the certificate from both the master and the agent and then start a puppet run, which will automatically regenerate a certficate.
Feb 16 09:35:20 test puppet-master[81728]: On the master:
Feb 16 09:35:20 test puppet-master[81728]:   puppet cert clean test
Feb 16 09:35:20 test puppet-master[81728]: On the agent:
Feb 16 09:35:20 test puppet-master[81728]:   rm -f /var/puppet/ssl/certs/test.pem
Feb 16 09:35:20 test puppet-master[81728]:   puppet agent -t

答案1

代理未使用预生成的客户端证书。而是创建了一个 CSR(使用新密钥),因此主服务器不会信任该代理。

确保在以下位置找到的文件

`puppet agent --configprint ssldir`/{certs,private_keys}/`puppet agent --configprint certname`

与您预先生成并放在主版本上的版本完全相同。(主版本应该不是收到代理人私钥的副本。)

答案2

我不知道你为什么需要生成证书的脚本?一旦 puppet 生成证书,只要你有客户端(代理),它就应该一直有效。除非你删除了客户端并创建了具有相同主机名的新客户端计算机。如果你运行 puppet,它会抱怨说私钥不匹配。相反,你应该在不需要客户端时(例如,你正在重新安装操作系统或重新创建虚拟机)使用puppet cert clean testpuppetmaster 清除 puppet 服务器上的证书。

答案3

请参考此 URL。此 URL 也许可以帮助您解决问题 https://docs.puppet.com/puppet/5.0/ssl_regenerate_certificates.html

相关内容