免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3533 | 回复: 2
打印 上一主题 下一主题

[Mail] (已解决)Roundcubemamil plugins password加密格式问题? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-09-27 09:49 |只看该作者 |倒序浏览
本帖最后由 yungdeguo 于 2013-09-28 07:54 编辑

大家好!


我配置了一台邮件服务器,
系统是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/


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

论坛徽章:
0
2 [报告]
发表于 2013-09-28 07:57 |只看该作者
大家好,此问题已经解决了。
总结原因是自己不懂英语,不看文件说明。

把这段
$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就行了。

论坛徽章:
0
3 [报告]
发表于 2014-01-22 13:34 |只看该作者
回复 2# yungdeguo


    为什么我改成%D还是不可以呢,提示我密码没有加密修改不了。。谢谢
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP