2. Module ksocket

 

The ksocket module provides a socket-like object which supports alternate interfaces to provide Kerberos authentication for connections. This should be used when only authentication is used; most code which operates on a connected socket can use an instance of the KStreamSocket class implemented by this module. Only TCP sockets are currently supported.

A single exception is defined by this module:

KSocketError
This exception is raised for errors specifically involving the Kerberos aspect of the connection. Ordinary socket errors raise socket.error  .

``Kerberized'' sockets are created using this constructor:

KStreamSocket ([lprinc])
Create a Kerberized socket. If lprinc is given, it is used as the local principal. If omitted, the result of krb5.get_login_principal() is used. The return value is an instance which behaves almost exactly like a socket, but with some additional interfaces and changes as described below.