. : August 19, 2015 : .

Postfix, Dovecot, and Webmail – Allowing Users to Change Their Passwords

I recently set up a mail server using Postfix, Dovecot, and MySQL. I had very limited experience with this sort of thing, so I followed this tutorial. Everything turned out all fine and dandy, but I needed to give users the ability to change their passwords. That means setting up some kind of webmail.

That’s when I found RainLoop

Installing RainLoop was a breeze. Well, somewhat painless. They have good logging and error messages, that make troubleshooting feel more like fish-in-a-barrel shooting. I defaulted to my normal “cheap and risky” behavior patterns when selecting software, and installed their Community (free) version.

After that was up and running, it was time to add the plugin to allow users to change their passwords. I found one named postfixadmin-change-password that came close to doing what I needed. However, there were a few problems.

There isn’t a way in the admin screen to customize the following:

  • The table name where user information is stored
  • The column name for user names
  • The column name for passwords

Since I had used a different table name and column names for these things, the plugin didn’t work. So, I changed the code in the plugin to match my naming convention, and it worked! These are the default lines I changed:


if (0 < \strlen($sUpdatePassword))
{
 $oStmt = $oPdo->prepare('UPDATE mailbox SET password = ? WHERE username = ?');
 $bResult = (bool) $oStmt->execute(array($sUpdatePassword, $oAccount->Email()));
}

For a moment, I was satisfied, but then I thought of others

Hence, I took it upon myself to fork RainLoop, and modify the plugin. Now it looks like this in the admin panel.

rainloop_postfix-change-password

References:

Categories:

2 responses to “Postfix, Dovecot, and Webmail – Allowing Users to Change Their Passwords”

  1. Hello! Just wanted to post a thank you for your work on this. I cloned your repo today and used the tool with no issues whatsoever (a rare feat these days). Just want to say cheers!

Leave a Reply