Module: RoadForest::SSL
- Defined in:
- lib/roadforest/server.rb
Defined Under Namespace
Modules: ClientCert
Class Method Summary collapse
- .add_ca_cert(config, cert_file) ⇒ Object
- .add_client_verify(config) ⇒ Object
- .enable(config, key, cert) ⇒ Object
Class Method Details
.add_ca_cert(config, cert_file) ⇒ Object
37 38 39 |
# File 'lib/roadforest/server.rb', line 37 def add_ca_cert(config, cert_file) config..merge!( :SSLCACertificateFile => cert_file) end |
.add_client_verify(config) ⇒ Object
48 49 50 51 |
# File 'lib/roadforest/server.rb', line 48 def add_client_verify(config) Webmachine::Request.instance_eval{include(ClientCert)} config..merge!( :SSLEnable => true, :SSLVerifyClient => OpenSSL::SSL::VERIFY_PEER) end |
.enable(config, key, cert) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/roadforest/server.rb', line 29 def enable(config, key, cert) require 'webrick/https' key = OpenSSL::PKey::RSA.new(File.read(key)) cert = OpenSSL::X509::Certificate.new(File.read(cert)) config..merge!( :SSLEnable => true, :SSLPrivateKey => key, :SSLCertificate => cert, :SSLCertName => [["CN", WEBrick::Utils::getservername]] ) end |