Skip to content
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

Encrypted Mailbox Passwords #235

Merged
merged 3 commits into from Oct 13, 2016
Merged

Conversation

mehmetakbulut
Copy link
Contributor

This pull request makes Ajenti-V store mailbox passwords with MD5 hashing instead of plaintext. Default behavior is that when a password is entered for a new account or a password is changed in the GUI, it will keep its MD5 hash instead of plaintext from now on.

Passwords stored as plaintext will remain as plaintext for compatibility, unless changed on the Mail page in Ajenti.

While recreating the courier userdb, plaintext and MD5 passwords are properly handled so plaintext passwords still work and MD5 passwords are not double-hashed.

improved-mail

Here you can see the mail.json where Ajenti stores all of the mail configurations.
johndoe and janedoe have their passwords encrypted (as shown with md5 prefix), while hodor still has a plaintext password and they all can happily use their mailboxes.

Encrypts plaintext passwords with MD5 as before to pass into userdb but
also ensures previously encrypted passwords with MD5 are not
double-hashed
Passwords are hashed with MD5 before storing. Previous passwords stored
as plaintext are not modified for compatibility. Ensures plaintext
passwords are sent to userdb with MD5 hashing as before but also makes
sure encrypted passwords with MD5 hashing are not double-hashed.
@Ardakilic
Copy link

Thanks, this looks promising 👍

Since I'm not a Python developer I wanted to ask: Is using bcrypt instead of md5 possible ? I would way prefer that instead.

@mehmetakbulut
Copy link
Contributor Author

mehmetakbulut commented May 23, 2016

Implementing bcrypt might require installing additional applications on the server which might not be an option on all operating systems. It is not a limitation of Python but rather Courier's as Ajenti relies on Courier to store and authenticate accounts. I can see some examples of bcrypt with postfix / mysql online but this would be a departure from how Ajenti currently handles mail overall as I understand.

I actually plan on adding an option to change the encryption scheme. Available algorithm are partially limited by userdbpw.

When I have time, I want to depreciate userdbpw and use authpasswd as it allows md5, sha1 and sha256, and give the user to option to choose. This would be a drop-in replacement that requires no changes to Courier itself or Ajenti in the grand scheme of things.

@Ardakilic
Copy link

Ardakilic commented May 24, 2016

Thank you @mehmetakbulut for the detailed explaination 👍

@Eugeny Eugeny merged commit 6a74c2f into Eugeny:master Oct 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants