Creating an NT-Password value with python

jon michaels joniamasad at gmail.com
Sat Nov 21 12:30:18 CET 2009


Hi list,

I am trying to figure out how to create an NT-Password hash for the
authentication database using python.

I found the package python_ntlm which seems to be able to do the job.
http://code.google.com/p/python-ntlm/source/browse/trunk/python26/ntlm/ntlm.py

I think it needs a modification however, because currently the hash
returned looks like this:

>>> from ntlm.ntlm import create_NT_hashed_password_v1
>>> create_NT_hashed_password_v1('test')
'\xdb4mi\x1dz\xccM\xc2b]\xb1\x9f\x9e?R'

I then proceed to add the user in mysql:
insert into radcheck (username,attribute,value,op) values
('testuser','NT-Password','\xdb4mi\x1dz\xccM\xc2b]\xb1\x9f\x9e?R',':=');

Next, when i tried to authenticate using the OSX pptp client, radius
debug tells me:

[mschap] No Cleartext-Password configured.  Cannot create LM-Password.
[mschap] Invalid NT-Password
[mschap] Told to do MS-CHAPv2 for passman with NT-Password
[mschap] FAILED: No NT/LM-Password.  Cannot perform authentication.
[mschap] FAILED: MS-CHAP2-Response is incorrect

I suppose the hash i get from the create_NT_hashed_password_v1
function isn't correctly formatted.
Can anyone point me in the right direction?

Thanks,

Jon.



More information about the Freeradius-Users mailing list