Ita*_*not 15 ssl certificate puppet puppetmaster puppet-agent
生产环境中的三台机器出现了一些硬件问题并已退役。基础架构团队已重新安装它们并为它们提供相同的主机名和 IP 地址。目的是在这些系统上运行 Puppet,以便可以再次调试这些系统。
试图
1) 通过发出以下命令从 Puppetmaster 中删除旧的 Puppet 证书:
puppet cert revoke grb16.company.com
puppet cert clean grb16.company.com
Run Code Online (Sandbox Code Playgroud)
2) 删除旧证书后,通过从重新安装的节点之一发出以下命令来创建新证书请求:
[root@grb16 ~]# puppet agent -t
Info: csr_attributes file loading from /etc/puppet/csr_attributes.yaml
Info: Creating a new SSL certificate request for grb16.company.com
Info: Certificate Request fingerprint (SHA256): 6F:2D:1D:71:67:18:99:86:2C:22:A1:14:80:55:34:35:FD:20:88:1F:36:ED:A7:7B:2A:12:09:4D:F8:EC:BF:6D
Exiting; no certificate found and waitforcert is disabled
[root@grb16 ~]#
Run Code Online (Sandbox Code Playgroud)
3) 一旦证书请求在 Puppetmaster 上可见,就会发出以下命令来签署证书请求:
[root@foreman ~]# puppet cert sign grb16.company.com
Notice: Signed certificate request for grb16.company.com
Notice: Removing file Puppet::SSL::CertificateRequest grb16.company.com at '/var/lib/puppet/ssl/ca/requests/grb16.company.com.pem'
[root@foreman ~]#
Run Code Online (Sandbox Code Playgroud)
问题
一旦证书请求被签名并启动了 Puppet 运行,就会抛出以下错误:
[root@grb16 ~]# puppet agent -t
Info: Caching certificate for grb16.company.com
Error: Could not request certificate: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed: [CRL is not yet valid for /CN=Puppet CA: foreman.company.com]
Exiting; failed to retrieve certificate and waitforcert is disabled
[root@grb16 ~]#
Run Code Online (Sandbox Code Playgroud)
第二次运行 Puppet 会导致:
[root@grb16 ~]# puppet agent -t
Warning: Unable to fetch my node definition, but the agent run will continue:
Warning: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed: [CRL is not yet valid for /CN=Puppet CA: foreman.company.com]
Info: Retrieving pluginfacts
Error: /File[/var/lib/puppet/facts.d]: Failed to generate additional resources using 'eval_generate': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed: [CRL is not yet valid for /CN=Puppet CA: foreman.company.com]
Error: /File[/var/lib/puppet/facts.d]: Could not evaluate: Could not retrieve file metadata for puppet://foreman.company.com/pluginfacts: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed: [CRL is not yet valid for /CN=Puppet CA: foreman.company.com]
Wrapped exception:
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed: [CRL is not yet valid for /CN=Puppet CA: foreman.company.com]
Info: Retrieving plugin
Error: /File[/var/lib/puppet/lib]: Failed to generate additional resources using 'eval_generate': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed: [CRL is not yet valid for /CN=Puppet CA: foreman.company.com]
Error: /File[/var/lib/puppet/lib]: Could not evaluate: Could not retrieve file metadata for puppet://foreman.company.com/plugins: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed: [CRL is not yet valid for /CN=Puppet CA: foreman.company.com]
Wrapped exception:
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed: [CRL is not yet valid for /CN=Puppet CA: foreman.company.com]
Error: Could not retrieve catalog from remote server: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed: [CRL is not yet valid for /CN=Puppet CA: foreman.company.com]
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
Error: Could not send report: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed: [CRL is not yet valid for /CN=Puppet CA: foreman.company.com]
[root@grb16 ~]#
Run Code Online (Sandbox Code Playgroud)
分析
为了解决该问题,对错误消息进行了调查,看起来问题与 SSL 或 Puppet 相关。也许这些软件包之一安装不正确,或者在重新安装的节点上安装了错误的版本。
木偶
[root@grb16 ~]# yum list installed |grep puppet
facter.x86_64 1:2.3.0-1.el6 @puppetlabs_6_products
hiera.noarch 1.3.4-1.el6 @puppetlabs_6_products
puppet.noarch 3.7.3-1.el6 @puppetlabs_6_products
puppetlabs-release.noarch
6-11 @puppetlabs_6_products
ruby-augeas.x86_64 0.4.1-3.el6 @puppetlabs_6_deps
ruby-shadow.x86_64 1:2.2.0-2.el6 @puppetlabs_6_deps
rubygem-json.x86_64 1.5.5-3.el6 @puppetlabs_6_deps
Run Code Online (Sandbox Code Playgroud)
安全证书
[root@grb16 ~]# yum list installed |grep ssl
nss_compat_ossl.x86_64 0.9.6-1.el6 @anaconda-CentOS-201410241409.x86_64/6.6
openssl.x86_64 1.0.1e-30.el6_6.4
openssl-devel.x86_64 1.0.1e-30.el6_6.4
[root@grb16 ~]#
Run Code Online (Sandbox Code Playgroud)
安装在各种服务器上的 SSL 和 Puppet 包之间没有发现差异。尚未退役或重新安装的系统仍然可以运行 Puppet。该问题仅限于重新安装的服务器。请注意,Puppet 尚未在其他两台重新安装的服务器上运行。是什么导致了这个问题以及如何解决它?
030*_*030 20
简明回答
该问题CRL is not yet valid for表明Puppet-agent 和 Puppetmaster 之间的时间不同步。同步时间 (NTP)。从 Puppet-agent 和 Puppetmaster 中删除证书并在代理上运行 Puppet。
综合解答
CRL is not yet valid for 驻留在以下代码段中。
在下面的测试代码片段说明是什么原因导致的问题:
it 'includes the CRL issuer in the verify error message' do
crl = OpenSSL::X509::CRL.new
crl.issuer = OpenSSL::X509::Name.new([['CN','Puppet CA: puppetmaster.example.com']])
crl.last_update = Time.now + 24 * 60 * 60
ssl_context.stubs(:current_crl).returns(crl)
subject.call(false, ssl_context)
expect(subject.verify_errors).to eq(["CRL is not yet valid for /CN=Puppet CA: puppetmaster.example.com"])
end
Run Code Online (Sandbox Code Playgroud)
ssl_context
let(:ssl_context) do
mock('OpenSSL::X509::StoreContext')
end
Run Code Online (Sandbox Code Playgroud)
主题
subject do
described_class.new(ssl_configuration,
ssl_host)
end
Run Code Online (Sandbox Code Playgroud)
该代码包括来自OpenSSL::X509::CRL类的片段。
发行人=(p1)
static VALUE
ossl_x509crl_set_issuer(VALUE self, VALUE issuer)
{
X509_CRL *crl;
GetX509CRL(self, crl);
if (!X509_CRL_set_issuer_name(crl, GetX509NamePtr(issuer))) { /* DUPs name */
ossl_raise(eX509CRLError, NULL);
}
return issuer;
}
Run Code Online (Sandbox Code Playgroud)
last_update=(p1)
static VALUE
ossl_x509crl_set_last_update(VALUE self, VALUE time)
{
X509_CRL *crl;
time_t sec;
sec = time_to_time_t(time);
GetX509CRL(self, crl);
if (!X509_time_adj(crl->crl->lastUpdate, 0, &sec)) {
ossl_raise(eX509CRLError, NULL);
}
return time;
}
Run Code Online (Sandbox Code Playgroud)
该LAST_UPDATED时间将是当前时间加上一个额外的一天,将被传递到调用的主题函数调用函数驻留在default_validator类。
class Puppet::SSL::Validator::DefaultValidator #< class Puppet::SSL::Validator
attr_reader :peer_certs
attr_reader :verify_errors
attr_reader :ssl_configuration
FIVE_MINUTES_AS_SECONDS = 5 * 60
def initialize(
ssl_configuration = Puppet::SSL::Configuration.new(
Puppet[:localcacert], {
:ca_auth_file => Puppet[:ssl_client_ca_auth]
}),
ssl_host = Puppet::SSL::Host.localhost)
reset!
@ssl_configuration = ssl_configuration
@ssl_host = ssl_host
end
def call(preverify_ok, store_context)
if preverify_ok
...
else
...
crl = store_context.current_crl
if crl
if crl.last_update && crl.last_update < Time.now + FIVE_MINUTES_AS_SECONDS
...
else
@verify_errors << "#{error_string} for #{crl.issuer}"
end
...
end
end
end
Run Code Online (Sandbox Code Playgroud)
如果 preverify_ok 为假,则 else 子句适用。由于if crl.last_update && crl.last_update < Time.now + FIVE_MINUTES_AS_SECONDS结果为 false,因为时间已被添加了一天,else 语句将适用。中的@verify_errors << "#{error_string} for #{crl.issuer}"结果评估CRL is not yet valid for /CN=Puppet CA: puppetmaster.example.com。
为了解决这个问题:
sudo puppet cert clean <fqdn-puppet-agent>
总之,Puppet-agents 和 Puppetmaster 上的时间应该一直同步。超过 5 分钟的最大允许偏差将导致问题。
| 归档时间: |
|
| 查看次数: |
38301 次 |
| 最近记录: |