1 最后由 yungdeguo (2013-09-28 13:12:18) 编辑

主题: [已解决]请教个roundcubemail密码插件问题。

==== 必填信息。没有填写将不予回复 ====
- iRedMail 版本号:
- 使用哪个数据库存储用户帐号(OpenLDAP,MySQL,PostgreSQL):
- 使用的 Linux/BSD 发行版名称及版本号:
- 与您的问题相关的日志信息:
==== ==== 必填信息。没有填写将不予回复 ====
- iRedMail 版本号:未使用
- 使用哪个数据库存储用户帐号(OpenLDAP,MySQL,PostgreSQL):mysql
- 使用的 Linux/BSD 发行版名称及版本号:centos6.4
- 与您的问题相关的日志信息:
====

大家好!

我用的是
系统是CENTOS6.4,组件是
apache+php+mysql+phpmyadmin+roundcubemail
postfix+postfixadmin+dovecot
amavisd-new+clamav+spamassassin

现在针对webmail修改密码插件的时候,
找了些资料。
密码是可以修改了,但改后不能登陆。

Roundcubemamil plugins password config.inc.php

// The SQL query used to change the password.
// The query can contain the following macros that will be expanded as follows:
//      %p is replaced with the plaintext new password
//      %c is replaced with the crypt version of the new password, MD5 if available
//         otherwise DES. More hash function can be enabled using the password_crypt_hash
//         configuration parameter.
//      %D is replaced with the dovecotpw-crypted version of the new password
//      %o is replaced with the password before the change
//      %n is replaced with the hashed version of the new password
//      %q is replaced with the hashed password before the change
//      %h is replaced with the imap host (from the session info)
//      %u is replaced with the username (from the session info)
//      %l is replaced with the local part of the username
//         (in case the username is an email address)
//      %d is replaced with the domain part of the username
//         (in case the username is an email address)
// Escaping of macros is handled by this module.
// Default: "SELECT update_passwd(%c, %u)"
// $rcmail_config['password_query'] = 'SELECT update_passwd(%c, %u)';

// 网上找了一些能改,但就是改后不能登陆。如这样的代码都能改
$rcmail_config['password_query'] = "UPDATE mailbox SET password=ENCRYPT(%p,concat(_utf8'$1$',right(m(rand()),,_utf8'$')) WHERE username=%u LIMIT 1";

// By default the crypt() function which is used to create the '%c'
// parameter uses the md5 algorithm. To use different algorithms
// you can choose between: des, md5, blowfish, sha256, sha512.
// Before using other hash functions than des or md5 please make sure
// your operating system supports the other hash functions.
$rcmail_config['password_crypt_hash'] = 'md5';

// By default domains in variables are using unicode.
// Enable this option to use punycoded names
$rcmail_config['password_idn_ascii'] = false;

// Path for dovecotpw (if not in $PATH)
// $rcmail_config['password_dovecotpw'] = '/usr/local/sbin/dovecotpw';

// Dovecot method (dovecotpw -s 'method')
$rcmail_config['password_dovecotpw_method'] = 'CRAM-MD5';

// Enables use of password with crypt method prefix in %D, e.g. {MD5}$1$LUiMYWqx$fEkg/ggr/L6Mb2X7be4i1/
$rcmail_config['password_dovecotpw_with_method'] = false;

// Using a password hash for %n and %q variables.
// Determine which hashing algorithm should be used to generate
// the hashed new and current password for using them within the
// SQL query. Requires PHP's 'hash' extension.
$rcmail_config['password_hash_algorithm'] = 'sha1';

// You can also decide whether the hash should be provided
// as hex string or in base64 encoded format.
$rcmail_config['password_hash_base64'] = false;


postfixadmin config.inc.php

// Encrypt
// In what way do you want the passwords to be crypted?
// md5crypt = internal postfix admin md5
// md5 = md5 sum of the password
// system = whatever you have set as your PHP system default
// cleartext = clear text passwords (ouch!)
// mysql_encrypt = useful for PAM integration
// authlib = support for courier-authlib style passwords
// dovecot:CRYPT-METHOD = use dovecotpw -s 'CRYPT-METHOD'. Example: dovecot:CRAM-MD5
$CONF['encrypt'] = 'dovecot:CRAM-MD5';

// In what flavor should courier-authlib style passwords be enrypted?
// md5 = {md5} + base64 encoded md5 hash
// md5raw = {md5raw} + plain encoded md5 hash
// SHA = {SHA} + base64-encoded sha1 hash
// crypt = {crypt} + Standard UNIX DES-enrypted with 2-character salt
$CONF['authlib_default_flavor'] = 'md5raw';


mysql password存储的格式
6feb0f68909d494a087a536d50bdbcfd4432d76dcfbd705ef70ffab969b3615f

改后的密码格式成了
$1$6ca8e2a7$qUpkbGEqNFhiBPf416Xql/


不知道如何配置密码插件里的格式。


非常抱歉在这里提非iredmail问题。
见谅!








此问题已经解决了。
总结原因是自己不懂英语,不看文件说明。

把这段
$rcmail_config['password_query'] = 'SELECT update_passwd(%c, %u)';
改成
$rcmail_config['password_query'] = 'UPDATE mailbox SET password=%D WHERE username=%u';

此段也是网上找到的,照别人抄过来 password=%c,换成 password=%D就行了。

回复: [已解决]请教个roundcubemail密码插件问题。

抱歉,我们不提供对非 iRedMail 部署的邮件服务器的技术支持。