我有一个安装并配置了 Postfix 的邮件服务器http://flurdy.com/docs/postfix/index.html。我使用一个 mysql 数据库,maildb
其中有一个表,users
其中包含两个文件id
=和= 。使用如下查询更新密码:'[email protected]'
crypt
'salted_md5_hash'
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 密码插件以配合上述安装?
答案1
编辑 roundcube mainconfig.inc.php
并添加插件名称'密码'到插件数组()如下所示,以激活插件:
// List of active plugins (in plugins/ directory)
$config['plugins'] = array('password');
您还可以记下 roundcube 用于连接到'圆形立方体'mysql 数据库$config['db_dsnw'] = 'mysql://user:pass@localhost/roundcube'
cd 进入.../roundcube_www_root/plugins/password/
并创建config.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('127.0.0.1');
$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';
...
要使用SHA-512
密码哈希代替SHA-256
,请将设置$id$
为$6$
(另请参阅man 3 crypt
):
$config['password_query'] = 'UPDATE users SET crypt=ENCRYPT(%p,CONCAT(_utf8\'$6$\',RIGHT(MD5(RAND()),8),_utf8\'$\')) WHERE id=%u LIMIT 1';
请参阅.../plugins/password/README
和.../plugins/password/config.inc.php.dist
以了解更多信息。
假设你将使用相同的 mysql 用户密码插件来更新密码,你必须 GRANT选择和更新餐桌上的特权‘用户’在‘邮件数据库’到'圆形立方体'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