加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 如何使用随机盐设置带有sql驱动程序和mysql加密的round

发布时间:2020-12-13 17:08:14 所属栏目:Linux 来源:网络整理
导读:我有一个postfix安装和配置的邮件服务器,如 http://flurdy.com/docs/postfix/index.html所示. 我使用mysql数据库maildb与表用户有两个文件ID =’user@domain.com’和crypt =’salted_md5_hash’.使用如下查询更新密码: UPDATE users SET crypt = ENCRYPT('a
我有一个postfix安装和配置的邮件服务器,如 http://flurdy.com/docs/postfix/index.html所示.
我使用mysql数据库maildb与表用户有两个文件ID =’user@domain.com’和crypt =’salted_md5_hash’.使用如下查询更新密码:
UPDATE users SET crypt = ENCRYPT('apassword',CONCAT('$5$',MD5(RAND()))) WHERE id = 'user@domain.tld';

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

如何设置roundcube密码插件以使用上述安装?

解决方法

编辑roundcube main config.inc.php并将插件名称’password’添加到plugins array(),如下所示,以激活插件:
// List of active plugins (in plugins/ directory)
$config['plugins'] = array('password');

您还可以记下圆形立方体使用的DSN连接到’roundcube’mysql数据库$config [‘db_dsnw’] =’mysql:// user:pass @ localhost / roundcube’

cd into … / 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('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.1替换

更新:我最近不得不将圆形主机主配置(config / config.inc.php)中的参数$config [‘default_host’]更改为fqdn而不是localhost.因此我不得不将插件配置(plugins / password / config.inc.php)中的参数$config [‘password_hosts’]更改为服务器fqdn.

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

假设您将使用相同的mysql用户作为密码插件来更新密码,您必须将’maildb’中的’users’表的GRANT SELECT和UPDATE权限授予’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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读