-
Notifications
You must be signed in to change notification settings - Fork 33
Description
Use Case
PE manages a certificate for the console. This can be the same as the agent cert,but it doesn't has to be. I think it would be really helpful to check if the used cert expires in < 90 days.
Describe the Solution You Would Like
As done in S0015, we could read the cert:
puppetlabs-pe_status_check/lib/facter/pe_status_check.rb
Lines 138 to 146 in 7b99552
| chunk(:S0015) do | |
| # Is the hostcert expiring within 90 days | |
| next unless File.exist?(Puppet.settings['hostcert']) | |
| raw_hostcert = File.read(Puppet.settings['hostcert']) | |
| certificate = OpenSSL::X509::Certificate.new raw_hostcert | |
| result = certificate.not_after - Time.now | |
| { S0015: result > 7_776_000 } | |
| end |
The default path is /opt/puppetlabs/server/data/console-services/certs/console-cert.cert.pem or /opt/puppetlabs/server/data/console-services/certs/${certname}.cert.pem. But the path is configureable in puppet_enterprise::profile::console::browser_ssl_cert. I don't think we can access the parameter easily from a fact. We could read it from /etc/puppetlabs/console-services/conf.d/console.conf.
A different approach would be to make an HTTP request to the console and get the cert.
Describe Alternatives You've Considered
A customer could use their internal monitoring tool for this, but since pe_status_check already validates certificates and people might get the impression that it covers every important part, I think it makes sense to integrate this into pe_status_check.