Postfixadmin with clear-text passwords

One of my projects at the minute is converting vpopmail mail servers to postfixadmin. One _really_ handy thing about some of these vpopmail machines is that they store a cleartext copy of all the users’ passwords, so I can feed them straight into the new system.

So, I’ve now got a postfixadmin system that stores cleartext passwords, and in case you want to do it, too, I’ve put a patch up. It gives you an extra couple of options in the config.inc.php file, which I hope are well enough explained by the comments:

// cleartext
// Do you want to store cleartext passwords for email accounts?
// true = store cleartext passwords (need to have a password_clear column in the mailbox table)
// false = don't store cleartext passwords
$CONF['cleartext'] = false;
// and the same for admins:
$CONF['cleartext_admin'] = false;

If you do want this (and are aware of the problems with storing cleartext passwords) it’s quite easy to do. First, add a couple of columns to the MySQL db:

alter table mailbox add `password_clear` varchar(255);
alter table admin add `password_clear` varchar(255);

Next, apply my patch:

[email protected]:/var/www/postfixadmin$ wget -q http://avi.co/stuff/postfixadmin_plaintext-passwords.txt
[email protected]:/var/www/postfixadmin$ patch < postfixadmin_plaintext-passwords.txt

Lastly, configure it; my patch sets both the config variables to 'false' because I like safeguards like that :)

It's worth noting that if you're using cleartext passwords, and then turn it off, the cleartext columns wont be affected - you'll need to update them with nulls or something if you want to get rid of the data in them.