directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1464031 - /directory/site/trunk/content/apacheds/advanced-ug/4.1.1.2-name-password-authn.mdtext
Date Wed, 03 Apr 2013 14:10:01 GMT
Author: elecharny
Date: Wed Apr  3 14:10:01 2013
New Revision: 1464031

URL: http://svn.apache.org/r1464031
Log:
Updated the name/password authent page

Modified:
    directory/site/trunk/content/apacheds/advanced-ug/4.1.1.2-name-password-authn.mdtext

Modified: directory/site/trunk/content/apacheds/advanced-ug/4.1.1.2-name-password-authn.mdtext
URL: http://svn.apache.org/viewvc/directory/site/trunk/content/apacheds/advanced-ug/4.1.1.2-name-password-authn.mdtext?rev=1464031&r1=1464030&r2=1464031&view=diff
==============================================================================
--- directory/site/trunk/content/apacheds/advanced-ug/4.1.1.2-name-password-authn.mdtext (original)
+++ directory/site/trunk/content/apacheds/advanced-ug/4.1.1.2-name-password-authn.mdtext Wed
Apr  3 14:10:01 2013
@@ -23,3 +23,128 @@ Notice: Licensed to the Apache Software 
     under the License.
 
 # 4.1.1.2 - Name/Password Authentication
+
+This is the most common authentication system, though not the safest. The user provides his
name and a password. Both are passed as clear text to the server, which checks that the user
exists, and that its password is correct.
+
+## User's name retrieval
+
+The first thing the server does is to check that the user's name exists in the server. The
provided name is always a full **DN**.
+
+Here is an example of simple authentication using Studio, where we authenticate the **uid=admin,ou=system**
user :
+
+![Name/Password authentication](images/simple-name-password-authn.png)
+
+The password is not visible here, but this is just for security reasons.
+
+This request is sent to the server, which will check that the **uid=admin,ou=system** exists
in its backend. If it doesn't, the authentication will fail.
+
+## Password check
+
+That's not enough : once the user is retreived, we have to check the provided password against
the stored password. 
+
+The entry associated with the user should contain a **userPassword** AttributeType, otherwise
the request will be rejected. Here is an example of such an entry :
+
+    :::Text
+    version: 1
+
+    dn: uid=admin,ou=system
+    objectClass: top
+    objectClass: person
+    objectClass: organizationalPerson
+    objectClass: inetOrgPerson
+    cn: system administrator
+    sn: administrator
+    displayName: Directory Superuser
+    uid: admin
+    userPassword:: c2VjcmV0
+
+As we can see, this entry has an **userPassword** which contains the base64 encoded password.
If we decode the value, we get :
+
+    :::Text
+    userPassword: secret
+
+Not exactly safe...
+
+### Password storage
+
+As we have juste seen, the password is stored in plain text in the server. This is not exatcly
safe ! As soon as someone gets access to your server, all the passwords are compromised. This
is certainly not the way we want to protect our users !
+
+Hopefully, you can hash those passwords, instead of storing them as provided. 
+
+<DIV class="note" markdown="1">
+A hashed password is not a password we can decrypt : when we hash a password, we lose some
information. Also note that two different passwords might result in the exact same hash value,
but it's unlikely.
+</DIV>
+
+**ApacheDS** let you select an encryption type when you inject a password :
+
+![Password hash method selection](images/password-hash-selection.png)
+
+The following hash method are available :
+
+| Hash method | Comment |
+|---|---|
+| PLAIN | no hashing |
+| MD5 | - |
+| SMD5 | Salted MD5 |
+| crypt | - |
+| SHA | SHA-1 |
+| SSHA | Salted SHA-1 |
+| SHA-256 | SHA-2 (Studio 2.0) |
+| SSHA-256 | Salted SHA-2 (Studio 2.0) |
+| SHA-384 | SHA-2 (Studio 2.0) |
+| SSHA-384 | Salted SHA-2 (Studio 2.0) |
+| SHA-512 | SHA-2 (Studio 2.0) |
+| SSHA-512  | Salted SHA-2 (Studio 2.0) |
+
+### How it works ?
+
+So the server receives a Name/Password authentication request. The password is _in clear
text_ up to this point. Once the user is found in the server, and if it has a **userPassword**
attributeType, the server extracts each values contained in this AttributeType (we may have
more than one password per user) and check the provided password against those values.
+
+This is not as simple as it seems : as we may have hashed the values on the server, we first
have to detect the selected hash method, and then hash the provided password, which result
is compaed to the stored hashed value.
+
+Hopefully, the hash method is stored within the hashed password in the server :
+
+    :::Text
+    version: 1
+
+    dn: uid=admin,ou=system
+    objectClass: top
+    objectClass: person
+    objectClass: organizationalPerson
+    objectClass: inetOrgPerson
+    cn: system administrator
+    sn: administrator
+    displayName: Directory Superuser
+    uid: admin
+    userPassword:: c2VjcmV0
+    userPassword:: {CRYPT}FgGgCMynLfYGw
+
+Here, one of the **userPassword** value is hashed using the **crypt** algorithm. The following
code is used to chekc the provided password :
+
+    :::Text
+    for each stored password
+      if it has a hash method 
+        then 
+          extract the method
+          hash the provided password using this method
+          compare the result with the stored hash value
+          if they are equal
+            then
+              return true
+        else
+          compare the provided password with the stored password
+          if they are equal
+            then
+              return true
+    done
+
+    return false
+
+<DIV class="note" markdown="1">
+  A few rule of thumb :
+  o Never store a password as plain text. 
+  o Prefer salted methods over non salted ones, and prefer the strongest one (here, SSHA-512
on Studio 2.0, or SSHA)
+  o crypt is also a good choice
+  o Pick strong passwords, otherwise if someone gets access to the list of passwords, he
or she can run a rainbow attack on it.
+  o Keep in mind that whatever you do, the password will be passed in clear text from the
client to the server. Always use startTLS before any bind, or at least use SSL
+</DIV>
\ No newline at end of file



Mime
View raw message