SSL implementation

55 views
Skip to first unread message

phantomias

unread,
Dec 1, 2009, 7:45:45 AM12/1/09
to EventMachine
Hello!

I'm using the latest EventMachine version and I wanna build up a TCP
server with a secure SSL connection.

Is this the only thing I have to do adding this line of code to
"post_init"?
start_tls(:private_key_file => '/tmp/server.key', :cert_chain_file =>
'/tmp/server.crt', :verify_peer => false)

And the the connection is secure, and all data send to this server and
the data from the server to the client is safe?

The "verify_peer" attribute: if this is true, the client must have a
ssl certificate? I read the documentation, but I'm not sure what does
this parameter mean.

Thanks for your help & best Regards.

phantomias

unread,
Dec 1, 2009, 7:47:45 AM12/1/09
to EventMachine
I forgot: Do I need additional packages on the server (OS:
LinuxFedora)?

phantomias

unread,
Dec 2, 2009, 5:41:11 AM12/2/09
to EventMachine
I have this source code:

def post_init
puts "post_init"
start_tls(:private_key_file => '/root/server.key', :cert_chain_file
=> '/root/server.crt', :verify_peer => false)
end

Starting the server with
EventMachine.run { EventMachine.start_server '192.168.2.1', 20000,
Server }

results:

post_init
terminate called after throwing an instance of 'std::runtime_error'
what(): Encryption not available on this event-machine
Abgebrochen # german word for "aborted"

I looked into the source code and I saw in "ed.cpp"
void ConnectionDescriptor::StartTls()
{
#ifdef WITH_SSL
if (SslBox)
throw std::runtime_error ("SSL/TLS already running on connection");

SslBox = new SslBox_t (bIsServer);
_DispatchCiphertext();
#endif

#ifdef WITHOUT_SSL
throw std::runtime_error ("Encryption not available on this event-
machine");
#endif
}

Where is WITH_SSL / WITHOUT_SSL set? How could I solve this?

Thanks & Regards.

phantomias

unread,
Dec 2, 2009, 5:59:21 AM12/2/09
to EventMachine
if EM.ssl?
puts "yes"
else
puts "no"
end

-> result: "no"

How can I build EventMachine with SSL-support?

phantomias

unread,
Dec 2, 2009, 11:41:26 AM12/2/09
to EventMachine
Hm, I reinstalled eventmachine and the it works...

But how could I ensure that the connection is secure? Is it possible
to access the data in encryped way?
Reply all
Reply to author
Forward
0 new messages