<div><div>Hello twisted experts,</div><div> </div><div>We are trying to add kerberos authentication to our existing twisted server.  We haven&#39;t yet found a twisted specific library that can do this; any pointers?</div>
<div> </div><div>What we have found is python-krbV (<a href="https://fedorahosted.org/python-krbV/">https://fedorahosted.org/python-krbV/</a>), but we end up using it along with code like this to take over the socket ourselves from twisted, when the client connects:</div>
<div> </div><div>    self.transport.stopReading()</div><div>    self.transport.stopWriting()</div><div>    self.transport.socket.setblocking(1)</div><div> </div><div>and then we use the self.transport.socket directly in blocking mode in another thread (so it won&#39;t block the reactor).  In particular, we use code like this to start the authentication process:</div>
<div> </div><div>    ac = krbV.default_context().sendauth(self.transport.socket, ...)</div><div> </div><div>…once the client has authenticated, we use:</div><div> </div><div>    self.transport.socket.setblocking(0)</div><div>
    self.transport.startReading()</div><div>    self.transport.startWriting()</div><div> </div><div>to let twisted take over the socket again for the rest of the conversation.</div><div> </div><div>So in the event there are no ready-to-go twisted libraries for kerberos, is the above approach totally insane?</div>
</div>-- <br>Benjamin Rutt<br>