Puppet: 服务器主机名 'puppetmaster' 与服务器证书不匹配;预期为 puppetmaster.us-east-2.compute.internal 中的一个,DNS:puppet。

3

我在AWS中使用puppet,当Puppet运行时,出现以下错误:

Puppet:Server hostname 'puppetmaster' did not match server certificate; expected one of puppetmaster.us-east-2.compute.internal, DNS:puppet,

请查看以下配置:
#master /etc/hosts
ubuntu@puppetmaster:~$ cat /etc/hosts
127.0.0.1 localhost
172.31.16.177  puppetmaster puppet 
172.31.19.211  ip-172-31-19-211 #client

#client
 ubuntu@ip-172-31-19-211:~$ cat /etc/hosts
 127.0.0.1 localhost
 172.31.16.177  puppetmaster puppet
 172.31.19.211  ip-172-31-19-211
 
ubuntu@ip-172-31-19-211:~$ cat /etc/puppetlabs/puppet/puppet.conf
# This file can be used to override the default puppet settings.
# See the following links for more details on what settings are available:
# - https://puppet.com/docs/puppet/latest/config_important_settings.html
# - https://puppet.com/docs/puppet/latest/config_about_settings.html
# - https://puppet.com/docs/puppet/latest/config_file_main.html
# - https://puppet.com/docs/puppet/latest/configuration.html
[main]
certname = ip-172-31-19-211
server = puppetmaster

上述是主控机和节点机的主机文件,并且我也已经在节点机上配置了puppet.conf文件,但是客户端机器仍未连接到主控机。请有人帮忙解决这个问题。

尝试使用 server = puppetmaster.us-east-2.compute.internal。它的意思是你配置了连接到 puppetmaster(我建议你使用完全限定域名),但似乎没有解析为 puppetmaster.us-east-2.compute.internal - azbarcea
另外,在生成证书时,您在安装或升级 Puppet 时没有使用 DNS 替代名称(如 puppet_master_dnsaltnames)。它在 pe.conf 中使用(更多信息请参见官方文档)。 - azbarcea
1个回答

1
Puppet在客户端和服务器端都使用加密证书来认证机器身份。错误消息显示,认证失败是因为服务器向客户端呈现的证书不能将其标识为客户端所期望的机器。
具体而言,机器期望服务器被标识为“puppetmaster”,但该证书中未列出该标识(“puppetmaster.us-east-2.compute.internal”是其中之一,但用途不同)。
设置这些内容时有相当大的灵活性,但为了获得最顺畅的体验,应该:
  • 在Puppet服务器和所有Puppet客户端上配置完全限定的、可通过DNS解析的主机名。在安装任何Puppet软件或至少在首次启动任何Puppet组件之前,在每台机器上进行此操作。

  • 在设置好Puppet后,不要更改Puppet客户端或服务器主机名。

  • 始终使用所选的完全限定名称连接到Puppet服务器。特别是,在客户端的配置文件中将其指定为服务器名称。

问题不清楚具体情况下观察到错误的情况,但可能是在新客户端上,在最初尝试将其连接到服务器时发生。在这种情况下,最简单的解决方案可能是更新客户端的puppet.conf以通过其证书上的名称指定服务器:"puppetmaster.us-east-2.compute.internal"。这假设可以通过该名称访问服务器;如果不能,则可能需要为服务器生成一个新证书。

请同时查看这个问题:https://dev59.com/6NH7oIgBc1ULPQZFjKUe - markhorrocks

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接