-
Notifications
You must be signed in to change notification settings - Fork 102
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
Refactor password handling #178
Comments
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:
|
Yeah, sounds reasonable to me 👍 😃 |
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 |
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 |
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. |
I use this modification since 16.12.2018: And 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: |
Time out closing on this - please reopen if help still required. |
@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 👍 |
ViMbAdmin 3.0.15 now recommends the
dovecot:BLF-CRYPT
password 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.doveadm
command when using thedovecot:
password scheme family (see Password generation/changing error using dovecot:SHA512-CRYPT #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 oflibc
with 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:doveadm
adds 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_scheme
option.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-CRYPT
andcrypt:sha512
(as said, they are identical).password_dovecot
column which extends the existingpassword
column 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_scheme
is unset. ViMbAdmin is configured withdefaults.mailbox.password_scheme = "crypt:sha512"
. I'm using aCASE
statement 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-CRYPT
toSHA512-CRYPT
on-the-fly (i.e. without resetting a single password) not long ago.The text was updated successfully, but these errors were encountered: