5

I have a mailserver with postfix installed and configured as in http://flurdy.com/docs/postfix/index.html. I use a mysql database maildb with a table users with two fileds id='user@domain.com' and crypt='salted_md5_hash'. Password is updated with a query like this:

UPDATE users SET crypt = ENCRYPT('apassword', CONCAT('$5$', MD5(RAND()))) WHERE id = 'user@domain.tld';

Roundcube 1.0-RC is installed according http://trac.roundcube.net/wiki/Howto_Install

Howto setup roundcube password plugin to work with the above installation?

8

Edit roundcube main config.inc.php and add the plugin name 'password' to the plugins array() as shown below, to activate the plugin:

// List of active plugins (in plugins/ directory)
$config['plugins'] = array('password');

You may also note down the DSN used by roundcube to connect to the 'roundcube' mysql database $config['db_dsnw'] = 'mysql://user:pass@localhost/roundcube'

cd into .../roundcube_www_root/plugins/password/ and create config.inc.php

# cp config.inc.php.dist config.inc.php
# vi config.inc.php

Edit the following lines in the password plugin's config.inc.php:

<?php

$config['password_driver'] = 'sql';
$config['password_confirm_current'] = true;
$config['password_minimum_length'] = 8;
$config['password_require_nonalpha'] = false;
$config['password_log'] = false;
$config['password_login_exceptions'] = null;
// If the server is accessed via fqdn, replace localhost by the fqdn:
$config['password_hosts'] = array('localhost');
$config['password_force_save'] = true;

// SQL Driver options
$config['password_db_dsn'] = 'mysql://user:pass@localhost/maildb';

// SQL Update Query with encrypted password using random 8 character salt
$config['password_query'] = 'UPDATE users SET crypt=ENCRYPT(%p,CONCAT(_utf8\'$5$\',RIGHT(MD5(RAND()),8),_utf8\'$\')) WHERE id=%u LIMIT 1';

...

Update: In some situations localhost seems not to work and needs to be replaced by 127.0.0.1 as reported by Terry

Update: I recently had to change the parameter $config['default_host'] in the roundcube main config (config/config.inc.php) to the fqdn instead of localhost. Therefore I had to change the parameter $config['password_hosts'] in the plugin config (plugins/password/config.inc.php) to the servers fqdn as well.

See .../plugins/password/README and .../plugins/password/config.inc.php.dist for more info.

Assuming you will use the same mysql user for the password plugin to update the password, you have to GRANT SELECT and UPDATE privileges on the table 'users' in 'maildb' to the 'roundcube' mysql user:

# mysql -u root -p
mysql > GRANT SELECT,UPDATE ON maildb.users TO 'roundcube'@'localhost';
mysql > FLUSH PRIVILEGES;
mysql > quit
# 

That's it. If you encounter problems, tail the roundcube error log:

# tail -f ../../logs/error
  • 1
    I think array(password) should be array('password'). – Andrew Schulman Feb 13 '14 at 17:09
  • OK, thanks, I corrected it. However, both variants seem to work fine. – rda Feb 13 '14 at 17:16
  • Thanks!! Worked for me. I've been trying to figure this issue out for a long time. I was listing out password hosts $config['password_hosts'] = array('mail.host1.com', 'mail.host2.com', 'mail.host3.com'); which doesn't work. Upon switching to $config['password_hosts'] = array('localhost'); as per above the password Setting option appeared. – Brandon Coder Mar 29 '15 at 2:39
  • I forgot to mention, Roundcube v1.0.3, Password plugin v3.4. Cheers! – Brandon Coder Mar 29 '15 at 18:48
  • I had a similar issue with this. Some server setups may require using 127.0.0.1 instead of using localhost. Just a heads up. Using the IP address is what worked for me personally. localhost didn't do anything. – Terry Carter Feb 29 '16 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.