先是master安装puppetpuppet-server,client上安装puppet,然后,master上启动puppetmaster进程,client上执行puppetd –server puppet-master --test,然后在master上执行puppetca -l能看到client发过来的验证请求,接着在master执行puppetca –s -a对client的验证进行签名,以上操作都可以正常的完成。

但接下来,client上得到签名了之后,再次执行puppetd –server puppet-master --test的时候,出现了下面的错误

warning: peer certificate won't be verified in this SSL session
info: Caching certificate for vhost-test01
info: Caching certificate_revocation_list for ca
err: Could not retrieve catalog from remote server: certificate verify failed
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run

网上google了一圈,也没啥结果,不过在puppet的bug提交区,看到有人包过这个错误,不过回答的并不明了,网上回答的内容如下

Please close the machines data time where totally incorrect.

无奈之下,只能自行找原因,发现client的上的selinux是启动状态,会不会和这个有关呢,关掉selinux之后再次执行,发现,还是报错,看来和这个是没有啥关系了,防火墙也都是处于关闭的状态。

根据以往的工作经验,我想到了,会不会是两台机器上的时间不同步造成的,由于服务器之间时间不同步,可能会产生很多莫名的问题

于是观察了一下client和master上的时间,发现,master上的时间是正确的,client上的时间慢了十几个小时。

为了统一master和client上的时间,分别在两台机器上执行了/usr/sbin/ntpdate time.nist.gov来同步时间

同步好后,再次在client上执行puppetd –server puppet-master --test,奇迹出现了,果然不再报错了

info: Caching catalog for vhost-test01
info: Applying configuration version '1290047517'
notice: //Node[default]/File[/tmp/temp1.txt]/content: defined content as 'unknown checksum'
info: Creating state file /var/lib/puppet/state/state.yaml
notice: Finished catalog run in 0.02 seconds

更改时间时需要将客户端/var/lib/puppet/ssl目录下的文件

特把此次经历记录下来,同时分享给更多的人知道,避免犯相同的错误