Bug 518520 - pre hashed salted passwords do not work
Summary: pre hashed salted passwords do not work
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: 389
Classification: Retired
Component: Security - Password Policy
Version: 1.2.1
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Rich Megginson
QA Contact: Viktor Ashirov
URL:
Whiteboard:
Depends On:
Blocks: 389_1.2.2 639035
TreeView+ depends on / blocked
 
Reported: 2009-08-20 17:32 UTC by Rich Megginson
Modified: 2015-12-07 16:35 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-12-07 16:35:24 UTC


Attachments (Terms of Use)
patch (3.70 KB, patch)
2009-08-20 17:34 UTC, Rich Megginson
no flags Details | Diff

Description Rich Megginson 2009-08-20 17:32:43 UTC
An attempt to perform simple authentication with a user name and password fails if the password was added to the server pre-hashed and salted (e.g. SSHA).  For example, the following python code:

import hashlib
import base64

...

sha = hashlib.sha1('thepassword')
sha.update('thesalt')
pwdval = '{SSHA}' + base64.b64encode(sha.digest() + 'thesalt')

Comment 1 Rich Megginson 2009-08-20 17:34:14 UTC
Created attachment 358138 [details]
patch

Comment 2 Rich Megginson 2010-10-22 17:15:08 UTC
commit 64e5a9f5cac3baf15b9fa6585072491ac75c0c3e
Author: Rich Megginson <rmeggins@redhat.com>
Date:   Thu Aug 20 11:28:14 2009 -0600

Comment 3 Amita Sharma 2011-05-19 14:47:04 UTC
Hi Rich,

Request you to please add some verification steps ( I read the comment 0) but if you can add more details will be helpful.

Thanks
Amita

Comment 4 Rich Megginson 2011-05-19 15:10:00 UTC
(In reply to comment #3)
> Hi Rich,
> 
> Request you to please add some verification steps ( I read the comment 0) but
> if you can add more details will be helpful.
> 
> Thanks
> Amita

1) Generate a password using the steps in comment 0.
2) use ldapmodify to set the password, as directory manager:

ldapmodify -x -D "cn=directory manager" -w dmpassword <<EOF
dn: uid=scarter,ou=people,dc=example,dc=com
changetype: modify
replace: userPassword
userPassword: {SSHA}......thevalue.....

EOF

3) Attempt to bind as scarter using the password value:
ldapsearch -x -D "uid=scarter,ou=people,dc=example,dc=com" -w thepassword -s base -b ""

Comment 5 Amita Sharma 2011-05-20 09:13:04 UTC
1. Password Generated : 
[root@testvm scripts]# ./prehashed_pwd.py
{SSHA}Kqifci3/3RY2XvAmioj0GVY+Thl0aGVzYWx0

2. [root@testvm scripts]# ldapmodify -h localhost -p 389 -D "cn=Directory Manager" -w xxx << EOF
> dn: uid=Suman,ou=people,dc=test,dc=com
> changetype: modify
> replace: userPassword
> userPassword: {SSHA}Kqifci3/3RY2XvAmioj0GVY+Thl0aGVzYWx0
> EOF
modifying entry "uid=Suman,ou=people,dc=test,dc=com"

3. ldapsearch -h localhost -p 389 -D "uid=Suman,ou=people,dc=test,dc=com" -w thepassword -s base -b ""
# extended LDIF
#
# LDAPv3
# base <> with scope baseObject
# filter: (objectclass=*)
# requesting: ALL
#

#
dn:
objectClass: top
namingContexts: dc=example,dc=com
namingContexts: dc=id,dc=polytechnique,dc=edu
namingContexts: dc=test,dc=com
namingContexts: o=netscaperoot

VERIFIED Successfully, thanks to Rich.


Note You need to log in before you can comment on or make changes to this bug.