1

Topic: Password and maildir migration.

==== Provide required information ====
- iRedMail version and backend (LDAP/MySQL/PGSQL): iRedMail-0.8.0 and iRedAdmin-Pro v1.7.2 (LDAP)
- Linux/BSD distribution name and version: Scientific Linux 6.2
- Any related log? Log is helpful for troubleshooting.
====

Hi,

I am upgrading our existing mail server to an iRedMail solution. At the moment I have a FreeBSD machine running Postfix/Dovecot/MySQL/etc/etc with PostfixAdmin as the Postfix management tool. Passwords are encrypted with the standard internal PostfixAdmin "md5crypt" routine, which appears to be salted md5 of some description.

Here is a sample password, both encrypted and in plain text as pulled from the MySQL database with phpMyAdmin:
Plain text: test
Encrypted: $1$68ea415b$tgGUY0f5zygJ6elSKH7Yx1

Is there an easy way to migrate the existing passwords to a new LDAP based iRedMail installation?

So far I have tried using phpLDAPadmin to change the password field of a user. I have pasted the encrypted password and tried both the md5 and md5crypt tags but updating and then trying the "Check password" tool hasn't made a match.

The second query I have isn't essential, but it would make my life much easier. Existing maildirs are structured like this:

Username: finch@testfinch.com
Maildir base: /mail/maildirs

finch@testfinch.com's maildir location looks like this: /mail/maildirs/testfinch.com/finch@testfinch.com. Another user, test@testfinch.com would have the maildir /mail/maildirs/testfinch.com/test@testfinch.com, and so on.

Keeping a similar maildir structure would allow a simple rsync to move all the existing maildirs to the new server. How do I go about changing the default maildir format for iRedmail, whilst ensuring that all facets of the suite will work properly?

Any assistance with the two above queries will be very much appreciated :)

Thanks,

Finch!

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Password and maildir migration.

Finch wrote:

So far I have tried using phpLDAPadmin to change the password field of a user. I have pasted the encrypted password and tried both the md5 and md5crypt tags but updating and then trying the "Check password" tool hasn't made a match.

Try this: Select 'clear' (plain text) instead of MD5/CRYPT in the drop-down menu, then paste '{MD5}$1$68ea415b$tgGUY0f5zygJ6elSKH7Yx1' (without quotes) in the password field, save changes and verify it.

Finch wrote:

The second query I have isn't essential, but it would make my life much easier. Existing maildirs are structured like this:

Username: finch@testfinch.com
Maildir base: /mail/maildirs

finch@testfinch.com's maildir location looks like this: /mail/maildirs/testfinch.com/finch@testfinch.com. Another user, test@testfinch.com would have the maildir /mail/maildirs/testfinch.com/test@testfinch.com, and so on.

Keeping a similar maildir structure would allow a simple rsync to move all the existing maildirs to the new server. How do I go about changing the default maildir format for iRedmail, whilst ensuring that all facets of the suite will work properly?

Maildir path is stored in LDAP/MySQL/PGSQL, so you can modify it to fit your need.
Take a look at /etc/dovecot/dovecot-ldap.conf or dovecot-mysql.conf, dovecot-pgsql.conf, it defines how Dovecot will read maildir path from LDAP/SQL query. Be careful, It will append '/Maildir/' in maildir path which is hard-coded in dovecot-{ldap,mysql,pgsql}.conf, not stored in LDAP/SQL, so you may want to remove it to fit your current maildir structure.

My personal suggestion: i recommend you to make the maildir structure fit the default iRedMail style if it's not a hard work for you, so that you don't need to care too much about upgrading iRedMail. This is a one-time deal, i believe it worths.

3

Re: Password and maildir migration.

Hi,

Thanks for the (very quick!) reply smile

I hadn't considered the upgrade issue with regards to the maildir structure. I'll leave it as default and get started on the manual migration.

The password suggestion did not work. I pasted (unquoted) "{MD5}$1$68ea415b$tgGUY0f5zygJ6elSKH7Yx1" in to the password field, selected "clear" and updated, but checking the password against "test" produced an error telling me that the passwords did not match. Interestingly, despite selecting "clear" before updating, when the page reloaded it was set to "md5" - and I can't get the change to "clear" to persist.

Any ideas?

Thanks again,

Finch!

4

Re: Password and maildir migration.

Finch wrote:

The password suggestion did not work.

Try this: Select 'clear' (plain text) instead of MD5/CRYPT in the drop-down menu, then paste '{CRYPT}$1$68ea415b$tgGUY0f5zygJ6elSKH7Yx1' (without quotes) in the password field, save changes and verify it.

Tested with phpLDAPadmin moment ago, works for me. How i test it:

1: Genereate a salted MD5 password with command: openssl passwd -1 test (Password is 'test' without quotes)
2: Update password with phpLDAPadmin as mentioned above
3: Login to roundcube webmail with new password.

Finch wrote:

I pasted (unquoted) "{MD5}$1$68ea415b$tgGUY0f5zygJ6elSKH7Yx1" in to the password field, selected "clear" and updated, but checking the password against "test" produced an error telling me that the passwords did not match. Interestingly, despite selecting "clear" before updating, when the page reloaded it was set to "md5" - and I can't get the change to "clear" to persist.

It shows "md5" in drop-down list, that's working as designed. It will detect prefix of password string and show the proper crypt.
With {crypt} + your password string, it will show you "md5crypt".

5

Re: Password and maildir migration.

Hi,

Replacing {MD5} with {CRYPT} worked perfectly smile

Thank you very much for the assistance. iRedMail is a great product.

Best regards,

Finch.