[Twisted-Python] Server authentication

Volodymyr Orlenko orlenko at gmail.com
Tue Jan 16 21:19:51 EST 2007


Hi Martin,

To delegate user authentication to Windows, you can use win32security 
module.

from win32security import LogonUser, LOGON32_LOGON_NETWORK, 
LOGON32_PROVIDER_DEFAULT
from win32security import error as LogonError

def validate_password(username, domain, password):
    try:
        if LogonUser(username,
                     domain,
                     password,
                     LOGON32_LOGON_NETWORK,
                     LOGON32_PROVIDER_DEFAULT):
            print 'Yes!'
            return True
        else:
            print 'No'
    except LogonError, e:
        print 'No:', e
    return False

To use LogonUser(), calling process needs to have some special 
privileges, at least on Win2K. If I remember correctly, SE_TCB_NAME is 
required.

Hope this helps,
Volodymyr


Martin Evans wrote:
>
> I'm currently implementing a proprietary set of protocols for 
> interacting with twisted running on a Microsoft server. All is working 
> fine so far using the basic line receiver / raw methods.
>
> I was hoping to add a form of authentication to the protocol. Is there 
> anyway to interact with the existing accounts on the server?
>
> The client wishes to make use of some of the lock down facilities 
> based on the Microsoft Server accounts. ie in the same way MS Telnet 
> server allows you to logon and then be taken to your own folder. I 
> have taken a quick look at the cred module but have not seen anything 
> suitable yet.
>
> I am currently running "python twistd.py -y myserver.nac"
>
> If such a module has not been developed, I assume I could develop a C 
> extension module of some sort.
>
> Any pointers would be a appreciated. Thanks.
>
> Martin
>
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>





More information about the Twisted-Python mailing list