Class: Puppet::SSL::CertificateFactory
- Defined in:
- lib/puppet/ssl/certificate_factory.rb
Overview
The tedious class that does all the manipulations to the certificate to correctly sign it. Yay.
Constant Summary collapse
- UNITMAP =
How we convert from various units to the required seconds.
{ "y" => 365 * 24 * 60 * 60, "d" => 24 * 60 * 60, "h" => 60 * 60, "s" => 1 }
Instance Attribute Summary collapse
-
#cert_type ⇒ Object
readonly
Returns the value of attribute cert_type.
-
#csr ⇒ Object
readonly
Returns the value of attribute csr.
-
#issuer ⇒ Object
readonly
Returns the value of attribute issuer.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#serial ⇒ Object
readonly
Returns the value of attribute serial.
Instance Method Summary collapse
-
#initialize(cert_type, csr, issuer, serial) ⇒ CertificateFactory
constructor
A new instance of CertificateFactory.
-
#result ⇒ Object
Actually generate our certificate.
Constructor Details
#initialize(cert_type, csr, issuer, serial) ⇒ CertificateFactory
Returns a new instance of CertificateFactory.
16 17 18 19 20 |
# File 'lib/puppet/ssl/certificate_factory.rb', line 16 def initialize(cert_type, csr, issuer, serial) @cert_type, @csr, @issuer, @serial = cert_type, csr, issuer, serial @name = @csr.subject end |
Instance Attribute Details
#cert_type ⇒ Object (readonly)
Returns the value of attribute cert_type.
14 15 16 |
# File 'lib/puppet/ssl/certificate_factory.rb', line 14 def cert_type @cert_type end |
#csr ⇒ Object (readonly)
Returns the value of attribute csr.
14 15 16 |
# File 'lib/puppet/ssl/certificate_factory.rb', line 14 def csr @csr end |
#issuer ⇒ Object (readonly)
Returns the value of attribute issuer.
14 15 16 |
# File 'lib/puppet/ssl/certificate_factory.rb', line 14 def issuer @issuer end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
14 15 16 |
# File 'lib/puppet/ssl/certificate_factory.rb', line 14 def name @name end |
#serial ⇒ Object (readonly)
Returns the value of attribute serial.
14 15 16 |
# File 'lib/puppet/ssl/certificate_factory.rb', line 14 def serial @serial end |
Instance Method Details
#result ⇒ Object
Actually generate our certificate.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/puppet/ssl/certificate_factory.rb', line 23 def result @cert = OpenSSL::X509::Certificate.new @cert.version = 2 # X509v3 @cert.subject = @csr.subject @cert.issuer = @issuer.subject @cert.public_key = @csr.public_key @cert.serial = @serial build_extensions set_ttl @cert end |