Sha256: fc9718486ba063d6085ad7a78a416b74e5a9fbafd7123e031b707c1c8a5e550c

Contents?: true

Size: 1.23 KB

Versions: 15

Compression:

Stored size: 1.23 KB

Contents

require 'puppet/ssl/base'

# Manage certificates themselves.  This class has no
# 'generate' method because the CA is responsible
# for turning CSRs into certificates; we can only
# retrieve them from the CA (or not, as is often
# the case).
class Puppet::SSL::Certificate < Puppet::SSL::Base
  # This is defined from the base class
  wraps OpenSSL::X509::Certificate

  extend Puppet::Indirector
  indirects :certificate, :terminus_class => :file

  # Because of how the format handler class is included, this
  # can't be in the base class.
  def self.supported_formats
    [:s]
  end

  def subject_alt_names
    alts = content.extensions.find{|ext| ext.oid == "subjectAltName"}
    return [] unless alts
    alts.value.split(/\s*,\s*/)
  end

  def expiration
    return nil unless content
    content.not_after
  end

  def near_expiration?(interval = nil)
    return false unless expiration
    interval ||= Puppet[:certificate_expire_warning]
    # Certificate expiration timestamps are always in UTC
    expiration < Time.now.utc + interval
  end

  # This name is what gets extracted from the subject before being passed
  # to the constructor, so it's not downcased
  def unmunged_name
    self.class.name_from_subject(content.subject)
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/lib/puppet/ssl/certificate.rb
puppet-3.1.1 lib/puppet/ssl/certificate.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/lib/puppet/ssl/certificate.rb
puppet-3.1.0 lib/puppet/ssl/certificate.rb
puppet-3.1.0.rc2 lib/puppet/ssl/certificate.rb
puppet-3.1.0.rc1 lib/puppet/ssl/certificate.rb
puppet-3.0.2 lib/puppet/ssl/certificate.rb
puppet-3.0.2.rc3 lib/puppet/ssl/certificate.rb
puppet-3.0.2.rc2 lib/puppet/ssl/certificate.rb
puppet-3.0.2.rc1 lib/puppet/ssl/certificate.rb
puppet-3.0.1 lib/puppet/ssl/certificate.rb
puppet-3.0.1.rc1 lib/puppet/ssl/certificate.rb
puppet-3.0.0 lib/puppet/ssl/certificate.rb
puppet-3.0.0.rc8 lib/puppet/ssl/certificate.rb
puppet-3.0.0.rc7 lib/puppet/ssl/certificate.rb