如何设置与SQL驱动程序和MySQL使用随机盐encryptionroundcube密码插件?

我有一个邮件服务器与安装和http://flurdy.com/docs/postfix/index.htmlconfiguration后缀。 我使用一个mysql数据库maildb与两个文件id 'salted_md5_hash'crypt = 'salted_md5_hash'的表users 。 密码用这样的查询更新:

 UPDATE users SET crypt = ENCRYPT('apassword', CONCAT('$5$', MD5(RAND()))) WHERE id = '[email protected]'; 

Roundcube 1.0-RC根据http://trac.roundcube.net/wiki/Howto_Install安装

如何设置roundcube密码插件与上述安装工作?

编辑roundcube main config.inc.php并将插件名称'password'添加到插件数组()中,如下所示,以激活插件:

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

你也可以记下由roundcube使用的DSN连接到$config['db_dsnw'] = 'mysql://user:pass@localhost/roundcube'数据库$config['db_dsnw'] = 'mysql://user:pass@localhost/roundcube'

cd进入.../roundcube_www_root/plugins/password/并创buildconfig.inc.php

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

编辑密码插件的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'; ... 

更新:在某些情况下, localhost似乎不工作,需要由Terry报告的127.0.0.1replace

更新:我最近不得不将roundcube main config( config/config.inc.php )中的参数$config['default_host']更改为fqdn而不是localhost 。 因此,我必须将插件configuration( plugins/password/config.inc.php )中的参数$config['password_hosts'] plugins/password/config.inc.php为服务器fqdn。

有关详细信息,请参阅.../plugins/password/README.../plugins/password/config.inc.php.dist

假设你将使用相同的mysql用户作为密码插件来更新密码,你必须在'maildb'的 'users'表中将GRANT SELECTUPDATE特权授予'roundcube'mysql用户:

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

而已。 如果遇到问题,请停用roundcube错误日志:

 # tail -f ../../logs/error