Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How to use custom secure connections with Tornado?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Fabio Hernandez  
View profile  
 More options Sep 28 2012, 4:31 am
From: Fabio Hernandez <fairnan...@gmail.com>
Date: Fri, 28 Sep 2012 01:31:58 -0700 (PDT)
Local: Fri, Sep 28 2012 4:31 am
Subject: How to use custom secure connections with Tornado?

Hello,

I'm working on a prototype of a web service that exposes a REST API over
HTTPS. I'm using Tornado to implement the server side and so far I'm very
happy with this framework, in particular with the clear abstractions it
provides to the application.

Now I need to prototype a companion server side application that provides
some specific authentication mechanism. In particular, this application
needs to be involved in the SSL handshake when establishing the secure
connection with the client (which is command-line based intended to be used
in scripts, not a web browser). This kind of behavior is possible to
implement if one uses the pyOpenSSL package which provides the server a way
to specify a callback which is called each time a client establishes a new
secure connection.

As far as I understand by reading the Tornado 2.4 sources, the method
TCPServer._handle_connection creates a SSLIOStream object by wrapping the
secure socket created by the Python ssl.wrap_socket() function. So, there
is no direct mechanism for my application to provide Tornado a way to
establish my "custom" secure connection.

I would therefore appreciate some guidance from this community on a clean
way to implement this using Tornado. I thought that subclassing HTTPServer
and overriding the method TCPServer._handle_connection (which given its
name, is not meant to be overridden) could add the desired functionality,
provided that the resulting secure socket (the one created with pyOpenSSL)
exposes an interface compatible with the one the class SSLIOStream exposes.

Would this work? Do you see any cleaner way to implement what I need? Any
feedback on this would be really appreciated.

Regards,

Fabio Hernandez


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Darnell  
View profile  
 More options Sep 28 2012, 1:49 pm
From: Ben Darnell <b...@bendarnell.com>
Date: Fri, 28 Sep 2012 10:49:32 -0700
Local: Fri, Sep 28 2012 1:49 pm
Subject: Re: [tornado] How to use custom secure connections with Tornado?
SSLIOStream uses the standard library's ssl module.  If you need to
use PyOpenSSL instead, you'll probably need to make your own IOStream
subclass.  As long as PyOpenSSL exposes the asynchronous handshake
error codes (WANT_READ, WANT_WRITE, etc), it should be fairly
straightforward to translate SSLIOStream to another library.

-Ben


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »