Sha256: 24ddd0a4687f612f20c78e16d3510a24118c2c540aa2cab35176d951674bf720

Contents?: true

Size: 905 Bytes

Versions: 1

Compression:

Stored size: 905 Bytes

Contents

#!/usr/bin/env ruby

require 'drb'
require 'drb/ssl'

require_client_cert = true
here = ARGV.shift || "drbssl://localhost:3456"

class HelloWorld
  include DRbUndumped

  def hello(name)
    "Hello, #{name}, from an SSL-encrypted server!"
  end
end

puts "PSSST! Password is 5678"

config = Hash.new
config[:verbose] = true
config[:SSLPrivateKey] = OpenSSL::PKey::RSA.new File.read("host/host_keypair.pem")
config[:SSLCertificate] =
  OpenSSL::X509::Certificate.new File.read("host/cert_host.pem")

if require_client_cert then
  config[:SSLVerifyMode] = OpenSSL::SSL::VERIFY_PEER |
                           OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
  config[:SSLCACertificateFile] = "CA/cacert.pem"
  config[:SSLVerifyCallback] = proc do |ok, store|
    p :SSLVerifyCallback_args => [ok, store.error_string]
    ok
  end
end

DRb.start_service(here, HelloWorld.new, config)
puts DRb.uri
DRb.thread.join

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quick_cert-2.0 sample/drbssl_s.rb