新安装的Puppet环境不工作,CSR不匹配公钥

我想玩傀儡,所以我build立了一个小的testing环境,由4个虚拟机组成

  • pfSense:路由器
  • Windows Server 2012 R2:DNS,DHCP
  • Ubuntu服务器16.04:Puppetmaster
  • Ubuntu服务器16.04:傀儡代理

DNS设置正确,它正确回答所有正向和反向查找。

这里是我在两个ubuntu vms上执行的命令(基本configuration)

sudo dpkg-reconfigure keyboard-configuration sudo apt-get install -y vim openssh-server ntp sudo dpkg-reconfigure tzdata vi /etc/hostname (set to puppet / puppetclient) sudo reboot now wget https://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb sudo dpkg -i puppetlabs-release-pc1-xenial.deb sudo apt-get update 

然后在主人:

 sudo apt-get -y install puppetserver sudo /opt/puppetlabs/bin/puppet resource service puppetserver ensure=running enable=true sudo service puppetserver restart 

puppetserver-service运行良好(在为VM分配6GB内存之后))

在客户端:

 sudo apt-get install puppet-agent sudo /opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true 

在客户端,我做了一个:

 puppet agent --server puppet.puppet.intra --waitforcert 60 --test 

这是通过回答

 Error: Could not request certificate: The CSR retrieved from the master does not match the agent's public key. CSR fingerprint: 82:F5:08:CC:98:8A:D1:8F:EC:3D:B0:F7:5B:EB:43:FC:FC:0D:95:30:E8:6F:7F:81:9E:1B:02:CB:A4:01:0E:50 CSR public key: Public-Key: (4096 bit) Modulus: ... Exponent: 65537 (0x10001) Agent public key: Public-Key: (4096 bit) Modulus: ... Exponent: 65537 (0x10001) To fix this, remove the CSR from both the master and the agent and then start a puppet run, which will automatically regenerate a CSR. On the master: puppet cert clean puppetclient.puppet.intra On the agent: 1a. On most platforms: find /home/administrator/.puppetlabs/etc/puppet/ssl -name puppetclient.puppet.intra.pem -delete 1b. On Windows: del "\home\administrator\.puppetlabs\etc\puppet\ssl\certs\puppetclient.puppet.intra.pem" /f 2. puppet agent -t 

当然,我执行了build议的故障排除步骤,没有结果。 我进一步检查:

  • 我可以在服务器上打开端口8140
  • 时间设置相匹配
  • 两台机器都有正确的主机名设置,并正确解决了由DNS

我究竟做错了什么?

问候,基督徒

 编辑

我刚刚意识到了一些事情:看来只有当我试图以不同的用户运行puppet时,才会出现这个问题。 我想用sudo在OS X客户机上运行puppet agent -t,并得到前面描述的错误信息。 当我安装它的用户运行木偶时,错误不会发生。 我怎样才能解决这个问题?

TLDR:一直使用sudo或直接以root身份login(不推荐使用)

好吧,好像这是我的错:我不是百分之一百确定的,但是我可能以root的身份(通过sudo)安装木偶,做一个普通用户的CSR,然后试着以root身份运行它。

看来我应该一直使用sudo / root,因为我从客户端和服务器上删除证书后,像这样:

  To fix this, remove the CSR from both the master and the agent and then start a puppet run, which will automatically regenerate a CSR. On the master: puppet cert clean puppetclient.puppet.intra On the agent: 1a. On most platforms: find /home/administrator/.puppetlabs/etc/puppet/ssl -name puppetclient.puppet.intra.pem -delete 1b. On Windows: del "\home\administrator\.puppetlabs\etc\puppet\ssl\certs\puppetclient.puppet.intra.pem" /f 2. puppet agent -t 

然后以CSR为根,现在一切都好了。