2015-12-16 08:07:31 +03:00
|
|
|
# frozen_string_literal: false
|
2003-10-20 19:24:00 +04:00
|
|
|
require 'drb/drb'
|
|
|
|
require 'drb/extserv'
|
|
|
|
require 'drb/ssl'
|
|
|
|
|
|
|
|
if __FILE__ == $0
|
|
|
|
def ARGV.shift
|
|
|
|
it = super()
|
|
|
|
raise "usage: #{$0} <uri> <name>" unless it
|
|
|
|
it
|
|
|
|
end
|
|
|
|
|
2014-06-01 07:07:58 +04:00
|
|
|
module DRbTests
|
|
|
|
|
|
|
|
TEST_KEY_DH1024 = OpenSSL::PKey::DH.new <<-_end_of_pem_
|
2012-09-20 12:05:08 +04:00
|
|
|
-----BEGIN DH PARAMETERS-----
|
|
|
|
MIGHAoGBAKnKQ8MNK6nYZzLrrcuTsLxuiJGXoOO5gT+tljOTbHBuiktdMTITzIY0
|
|
|
|
pFxIvjG05D7HoBZQfrR0c92NGWPkAiCkhQKB8JCbPVzwNLDy6DZ0pmofDKrEsYHG
|
|
|
|
AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
|
|
|
|
-----END DH PARAMETERS-----
|
|
|
|
_end_of_pem_
|
|
|
|
|
2014-06-01 07:07:58 +04:00
|
|
|
end
|
2012-09-20 12:05:08 +04:00
|
|
|
|
2003-10-20 19:24:00 +04:00
|
|
|
config = Hash.new
|
2014-06-01 07:07:58 +04:00
|
|
|
config[:SSLTmpDhCallback] = proc { DRbTests::TEST_KEY_DH1024 }
|
2003-10-20 19:24:00 +04:00
|
|
|
config[:SSLVerifyMode] = OpenSSL::SSL::VERIFY_PEER
|
|
|
|
config[:SSLVerifyCallback] = lambda{|ok,x509_store|
|
|
|
|
true
|
|
|
|
}
|
|
|
|
config[:SSLCertName] =
|
|
|
|
[ ["C","JP"], ["O","Foo.DRuby.Org"], ["CN", "Sample"] ]
|
|
|
|
|
2013-07-11 09:24:32 +04:00
|
|
|
DRb.start_service('drbssl://localhost:0', [1, 2, 'III', 4, "five", 6], config)
|
2014-02-07 05:54:40 +04:00
|
|
|
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
|
2003-10-20 19:24:00 +04:00
|
|
|
DRb.thread.join
|
2014-02-07 05:54:40 +04:00
|
|
|
es.stop_service if es.alive?
|
2003-10-20 19:24:00 +04:00
|
|
|
end
|
|
|
|
|