-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: support for Bcrypt password hashes #225
Conversation
fwiw, the latest perl-Crypt-Eksblowfish (0.009, dated 27 April 2011) is old enough to be available available for RHEL/CentOS 6 and 7 from EPEL and for all supported Fedora releases. Debian 8 and 9 have Libcrypt-eksblowfish-perl 0.009, while the soon to be end-of-life Debian 7 has 0.008. |
Quickly reading through the commit, I think it might be missing the part to change the database schema on upgrade. |
Thanks for the review! Good news that it looks like perl-Crypt-Eksblowfish module may be usable. As for the password column, I looked for a place to update the column in Upgrade.pm and didn't find an obvious place. I observed though that just setting the width to 64 in DatabaseDescription.pm led to Sympa automatically altering the column in the database when I restarted Sympa. It looks like Sympa::DatabaseManager::probe_db calls Sympa::DatabaseDriver::update_field as part of the probe sequence, which then issues the database-specific query to update the column. |
Great enhancement @mpkut. May I add this PR to 6.2.26 milestone?
I think no.
We should use more widely adopted module to avoid difference between implementations[1]. Wandering CPAN, I felt this module looks popular enough. 👍
Salt is generated by default in Other points I noticed:
[1] Some implementations mistakenly use only 56 octets (448 bits) at beginning of input. Crypt-Eksblowfish's bcrypt uses 72 octets as original algorithm does. |
Thank you for looking this over! If you think the code is close enough to being ready, that would be quite agreeable. :-)
To back up a bit, Bcrypt uses the settings in the existing hash to generate an identical fingerprint from the same password. That means we need to pass the value of It seemed least invasive to add a second
For the purposes of Sympa authentication it seems like either could be used as long as the usage was consistent. Given the discouragement of
Got it. Added to the PR branch. Thank you! |
I got it. I missed another call of password_fingerprint().
I see. Sympa itself will generate only On |
…d_fingerprint without a previous password hash
Ok, great. I have updated the calls to I had thought about gradual password upgrades as you suggest. The code that checks the user fingerprint during login already calls A question: would this behavior be controlled by a separate config setting, or would it be implicit upon changing the In terms of code, it seems useful to add a function to |
…hashes as users log in
Here is a draft implementation of the gradual update idea.
With these changes, the code allows me to log in with the same password string even as I toggle the setting |
@mpkut, thanks for quick response.
I supposed that If administrator decided switching to bcrypt at all, they may clear I'll review your code briefly, and if no critical problem found, I'll merge it in Monday morning UTC (in early morning CT), then it will be included in the next beta on 13th March. |
Thank you @ikedas. I'm entirely in favor creating good default behavior and avoiding useless config file parameters. If old password hashes should always be transparently converted to the current hash algorithm, then yes, there is no need for an One idea for a slightly more useful config file parameter might be a combined "accept and update old hashes" flag.
Either way it seems like the current implementation is a bit off base. I will hold off on making any updates to this PR pending your input. |
@mpkut, thanks for suggestion. For now I'll merge recent code and close this PR. We would be better to examine about migration scenario further. Thanks again! |
Thank you @ikedas! Yes, it will take some more thought about various migration scenarios to determine the best semantics and defaults. We really appreciate the consideration and acceptance of this contribution! |
Built-in authentication page was added to documentation site. Additions / corrections of contents are welcome. |
Thanks, will review. Per my comments above, I will need to correct the behavior so old hashes are only honored if "password_hash_update" is true, which is not the case with the current code. Will submit a separate fix PR ASAP. |
Some Sympa sites may find it desirable to use other password hash functions than MD5. At our site we have been looking at Bcrypt, which has useful properties like supporting a random salt and scaling in expense as computing power becomes cheaper over time. Both features make it much more costly to crack a site's user passwords if they are revealed in some way.
Since Sympa has already modularized password hashing in
Sympa::User::password_fingerprint
, we found that the changes required for basic Bcrypt support are relatively small in number:password_hash
:md5
orbcrypt
(defaultmd5
)bcrypt_cost
: integer value used to determine the "cost" parameter of the Bcrypt algorithm (default12
)Sympa::User::password_fingerprint
: inAuth.pm
:password_hash
settingmd5
, used as Bcrypt settings forbcrypt
)Sympa::User::password_fingerprint
to supply the user's current password hashupgrade_sympa_password.pl
to recognize both MD5 and Bcrypt hashespassword_user
column from 40 to 64 columns in order to store Bcrypt hashes without truncationSome additional notes:
user_table
. Other Sympa features that use MD5 continue to use that hash exclusively.We understand that it is not a trivial thing to suggest changes to the Sympa authentication infrastructure, and we definitely have some uncertainty about some of the choices here:
password_hash
etc?password_user
field wider present an issue?password_fingerprint
seems awkwardIf it would be more appropriate to pose this as an issue rather than a pull request, please let me know. Either way, we would like to improve this code to the point where it is acceptable inclusion in Sympa, so suggestions for improvement would be very welcome.