ejabberd - Comments for "ejabberd odbc auth module" https://www.ejabberd.im/node/5284 en Ok, let's look at them. Both https://www.ejabberd.im/node/5284#comment-58455 <p>Ok, let's look at them.<br /> Both are expected to return true on successful password check, false otherwize.</p> <ol> <li>check_password(User, Server, Password)<br /> This function first makes the hash of the password. Then it makes ODBC query to get the password stored in the DB for this user.<br /> Then, if the returned object contains three items: atom 'selected', string "password" and string equal to our compiled hash, then it returns result of checking if Password is not empty string (i.e., it returns true for non-empty password).<br /> In all other cases, it returns false. <p>While I might say that the logic is a bit suboptimal (I would first check for empty pass, then do the query, then make hash and check password), this function is "fully patched".</p> </li><li>check_password(User, Server, Password, Digest, DigestGen)<br /> This function takes two more arguments: Digest seems to be the string and DigestGen is a function.<br /> After building hash and querying DB (just like #1), it first checks if Digest isn't empty, and compares it to the result of <strong>applying DigestGen to password stored in DB</strong>. On success, it returns true, otherwize it checks if the ODBC result is our hash.<br /> So, this function only uses our hash if Digest auth is <strong>not</strong> used, and if Digest is used, the unhashed passwords in DB will be OK.</li></ol> <p>I think that if you will try to use hashes, you will possibly succeed unless you use Digest auth.</p> Mon, 19 Mar 2012 08:20:24 +0000 mikekaganski comment 58455 at https://www.ejabberd.im hmm yeah, but if you look at https://www.ejabberd.im/node/5284#comment-58454 <p>hmm yeah, but if you look at the two "check_password" functions, wouldn't it be those that are used for authentication?<br /> So wouldn't at least authentication work with hashes, as they are patched?</p> Mon, 19 Mar 2012 07:12:59 +0000 jra comment 58454 at https://www.ejabberd.im Disclaimer: I have no https://www.ejabberd.im/node/5284#comment-58453 <p>Disclaimer: I have no expertise in ejabberd auth code. Just first impression from looking into the code</p> <p>The code is not consistent. The original modifier (supposedly Henrik P. Hessel) seemed to only care about plain auth, while the code covers digest auth, too. And if the digest auth is used, the code will continue working as before (presuming that DB stores passwords as before), until users will try to set their password. As all the "password set" codepaths (I mean "set password for existing user" and "create new user") are patched so that they store sha-hashed passwords, this will break the digest auth, and user will be unable to login, unless he will provide hash instead of password (see remark at the bottom of <noindex><a href="http://nullable.de/using-salted-hashed-password-in-your-ejabberd" title="http://nullable.de/using-salted-hashed-password-in-your-ejabberd" rel="nofollow" >http://nullable.de/using-salted-hashed-password-in-your-ejabberd</a></noindex>, that seem to proove me right).</p> Mon, 19 Mar 2012 01:27:26 +0000 mikekaganski comment 58453 at https://www.ejabberd.im mikekaganski wrote: The https://www.ejabberd.im/node/5284#comment-58452 <div class="quote-msg"> <div class="quote-author"><em>mikekaganski</em> wrote:</div> <p>The "*_odbc" modules had been made obsolete by changes in 3.x that moved backend storage to an abstraction layer (see <noindex><a href="https://git.process-one.net/ejabberd/mainline/blobs/raw/master/doc/release_notes_3.0.0.txt" rel="nofollow" >Release Notes for 3.0</a></noindex>). Thus, for a module, it does not matter which storage is used.<br /> However, this is for 3.x only, it should not matter for 2.1.10.</p></div> <p>oh alright, well ... maybe someone could just help me out here then.<br /> I have this slightly modified version of ejabberd_auth_odbc.erl that I have compiled and put in my ebin folder (replacing the old and only other one on the system).</p> <p><noindex><a href="http://pastebin.com/CLR430KG" title="http://pastebin.com/CLR430KG" rel="nofollow" >http://pastebin.com/CLR430KG</a></noindex></p> <p>Original (of the modified version I used) is here: <noindex><a href="https://raw.github.com/gist/975172/3b9f3a05fe95a81b1581ea0c72fe047ae2e61126/gistfile1.hrl" title="https://raw.github.com/gist/975172/3b9f3a05fe95a81b1581ea0c72fe047ae2e61126/gistfile1.hrl" rel="nofollow" >https://raw.github.com/gist/975172/3b9f3a05fe95a81b1581ea0c72fe047ae2e61...</a></noindex><br /> I just simply used hexdigest512 instead of hexdigest256 that the original author of that modified version did.</p> <p>The thing is that it doesn't seem to make a difference if I use this module.<br /> The passwords remain in plain text in the database, because I haven't hashed them yet obviously, but the auth still works like normal, which I feel is strange since the auth module should hash the password before checking it with the database?</p> <p>Is there anyone who has tried this before and maybe could help me out?<br /> I'm rather new to erlang as well so :-)</p> <p>Thanks in advance</p> Sun, 18 Mar 2012 23:35:23 +0000 jra comment 58452 at https://www.ejabberd.im The "*_odbc" modules had been https://www.ejabberd.im/node/5284#comment-58451 <p>The "*_odbc" modules had been made obsolete by changes in 3.x that moved backend storage to an abstraction layer (see <noindex><a href="https://git.process-one.net/ejabberd/mainline/blobs/raw/master/doc/release_notes_3.0.0.txt" rel="nofollow" >Release Notes for 3.0</a></noindex>). Thus, for a module, it does not matter which storage is used.<br /> However, this is for 3.x only, it should not matter for 2.1.10.</p> Sun, 18 Mar 2012 22:39:59 +0000 mikekaganski comment 58451 at https://www.ejabberd.im