mirror of
https://github.com/opensolutions/ViMbAdmin.git
synced 2026-04-26 00:36:00 +03:00
[GH-ISSUE #178] Refactor password handling #139
Labels
No labels
bug
feature
feature
improvement
improvement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ViMbAdmin-opensolutions#139
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @PhrozenByte on GitHub (Apr 11, 2016).
Original GitHub issue: https://github.com/opensolutions/ViMbAdmin/issues/178
ViMbAdmin 3.0.15 now recommends the
dovecot:BLF-CRYPTpassword scheme by default. Needless to say that this is a significant improvement in comparison to the previous defaultmd5.salted(no matter whether salting worked or not), but it still has some disadvantages:dovecot:password scheme family is a security issue in general, because it forces you to allow PHP to use theexec()function. This function is disabled on many webservers on purpose.doveadmcommand when using thedovecot:password scheme family (see #95). ViMbAdmin therefore requires you to change the configuration of highly security sensitive system components. Breaking the configuration may even prevent you from booting your system.dovecot:password scheme family also requires you to install ViMbAdmin on the same machine as Dovecot. This prevents service separation or at least makes it more difficult. Additionally, just think of using Docker.BLF-CRYPT. You will need to compile your own version oflibcwith enabled Blowfish support to make this work. It's definitely the most secure password scheme, but shouldn't be recommended as default as long as it isn't widely supported.Now the funny part: You don't need the
dovecot:password scheme family to allow users to use the most secure password schemes (BLF-CRYPT,SHA512-CRYPT,SHA256-CRYPT) - just use thecrypt:password scheme family instead. They are completely identical!So, why does the
dovecot:password scheme family work (provided that PHP is able to rundoveadm) (nearly) out-of-the-box, whereas thecrypt:password scheme family does not? It's simple:doveadmadds a{…}prefix (e.g.{SHA512-CRYPT}) indicating the used password scheme, so users don't have to tell Dovecot what password scheme is used. ViMbAdmin'scrypt:password scheme doesn't add this prefix, so you will have to tell Dovecot the used password scheme by setting thedefault_pass_schemeoption.ViMbAdmin should add the
{…}prefix to the database, so Dovecot can determine the used password scheme without additional configuration and without using thedovecot:password scheme family. I can think of two possible solutions:dovecot:password scheme family or add a additional column to store the used password scheme (e.g.crypt:sha512), otherwise it would be impossible for ViMbAdmin to distinguish between e.g.dovecot:SHA512-CRYPTandcrypt:sha512(as said, they are identical).password_dovecotcolumn which extends the existingpasswordcolumn by the appropriate{…}prefix. The new column actually is never read by ViMbAdmin, it's just used by Dovecot. Not the nicest, but definitely the easiest solution. It can be implemented with a very small number of additional lines of code.To prove that this works just fine, here's the SQL query I'm using as Dovecot's
password_query.default_pass_schemeis unset. ViMbAdmin is configured withdefaults.mailbox.password_scheme = "crypt:sha512". I'm using aCASEstatement to distinguish between the most important password schemes (namely thecrypt:anddovecot:password scheme families), a solution built into ViMbAdmin obviously won't require such a hack and supports all (possible) password schemes of all password scheme families. I switched fromSHA256-CRYPTtoSHA512-CRYPTon-the-fly (i.e. without resetting a single password) not long ago.@barryo commented on GitHub (Apr 12, 2016):
Hi @PhrozenByte - yip, I agree with:
In fact in trying to conjure up various fixes to the issue that prompted this, allowing multiple password schemes is really the only solution.
What above a second column that defines the schema used? Advantages:
@PhrozenByte commented on GitHub (Apr 12, 2016):
Yeah, sounds reasonable to me 👍 😃
@pquan commented on GitHub (Apr 13, 2016):
If the {...} is not in the database, dovecot will fail to authenticate users with an error like this:
Password data is not valid for scheme : Input isn't valid base64 encoded data
Adding the {..} will make it work.
Currently vimbadmin is striping the {..} generated by "doveadm pw -s '' -u 'user@domain' -p 'password'
This is a "bug" when not using the default MD5 cipher
@barryo commented on GitHub (Apr 13, 2016):
Hi @pquan - it's only a bug if allowing multiple password schemes to be supported simultaneously was/is meant to be a feature 😉
It wasn't but this issue is about supporting that.
Note also that ViMbAdmin isn't just for Dovecot so how this is supported needs to be more flexible. Presenting the
{scheme}to Dovecot would be just a matter of crafting your SQL query withCONCAT().@nysander commented on GitHub (Feb 5, 2017):
for me this should be a config option "Do you use Dovecot" which changes line 59 in Dovecot.php library file from:
to
because this easily make doveadm pw generated passwords compatible with Dovecot setup without any tricks and complicated SQL queries.
@mfechner commented on GitHub (May 29, 2020):
I use this modification since 16.12.2018:
github.com/mfechner/ViMbAdmin@9495046e50And I have not seen any errors. But I only use dovecot and no other imap server. Postfix is using dovecot also for authentication.
I used this modification also to switch all users to newer more secure password hashes where dovecot automatically updates the hash if the user logs in:
https://wiki.dovecot.org/HowTo/ConvertPasswordSchemes
@barryo commented on GitHub (Apr 1, 2022):
Time out closing on this - please reopen if help still required.
@PhrozenByte commented on GitHub (Apr 1, 2022):
@barryo Since you've closed a whole lot of dangling issues, I reckon that you just overlooked that this is not a help request, but a feature request. You even already acknowledged that it should be implemented (at some point, possibly never if nobody else picks it up, but nevertheless). So, if desired, you (only contributors can) might wanna reopen it 👍