iredmail-doc/html_bk/password.hashes-zh_CN.html

128 lines
6.5 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>密码</title>
<link rel="stylesheet" type="text/css" href="./css/markdown.css" />
</head>
<body>
<div id="navigation">
<a href="https://www.iredmail.org" target="_blank">
<img alt="iRedMail web site"
src="./images/logo-iredmail.png"
style="vertical-align: middle; height: 30px;"
/>&nbsp;
<span>iRedMail</span>
</a>
&nbsp;&nbsp;//&nbsp;&nbsp;<a href="./index.html">Document Index</a></div><div class="admonition note">
<p class="admonition-title">This tutorial is available in other languages. <a href="https://github.com/iredmail/docs">Help translate more</a></p>
<p><a href="./password.hashes.html">English</a> /</p>
</div>
<h1 id="_1">密码</h1>
<div class="toc">
<ul>
<li><a href="#_1">密码</a><ul>
<li><a href="#iredmail">iRedMail 支持的密码</a></li>
<li><a href="#iredmail_1">iRedMail 中默认使用的密码</a></li>
<li><a href="#iredmail_2">如何在 iRedMail 中使用不同的哈希密码</a><ul>
<li><a href="#mysql-postgresql">对于采用 MySQL 和 PostgreSQL 后端的用户</a></li>
<li><a href="#openldap">对于采用 OpenLDAP 后端的用户</a></li>
</ul>
</li>
<li><a href="#_2">参考资料</a></li>
</ul>
</li>
</ul>
</div>
<h2 id="iredmail">iRedMail 支持的密码</h2>
<p>在 iRedMail 中Doevcot 被配置为 Postfix 的 SASL 认证服务器因此Dovecot 支持
的所有密码格式都可以在 Postfix (SMTP 服务)中使用。 查看 Dovecot 的 wiki 页面
<a href="http://wiki2.dovecot.org/Authentication/PasswordSchemes">Password Schemes</a>
获取更多信息。</p>
<p>iRedAdmin-Pro 支持以下密码格式,因此你可以使用给用户使用下列任意一种。</p>
<ol>
<li>SSHA512例如 <code>{SSHA512}FxgXDhBVYmTqoboW+ibyyzPv/wGG7y4VJtuHWrx+wfqrs/lIH2Qxn2eA0jygXtBhMvRi7GNFmL++6aAZ0kXpcy1fxag=</code></li>
<li>BCRYPT例如 <code>{CRYPT}$2a$05$TKnXV39M3uJ4o.AbY1HbjeAval9bunHbxd0.6Qn782yKoBjTEBXTe</code></li>
<li>SSHA例如 <code>{SSHA}OuCrqL2yWwQIu8a9uvyOQ5V/ZKfL7LJD</code></li>
<li>
<p>MD5salted。例如</p>
<ul>
<li>带有前缀:<code>{CRYPT}$1$GfHYI7OE$vlXqMZSyJOSPXAmbXHq250</code></li>
<li>不带前缀:<code>$1$GfHYI7OE$vlXqMZSyJOSPXAmbXHq250</code></li>
</ul>
<p><strong>重要提示</strong>: SOGo 不支持不带前缀的 MD5 密码,因此,当你打算从旧邮件服务器
上迁移密码数据时,请预先加上 <code>{CRYPT}</code> 前缀。</p>
</li>
<li>
<p>PLAIN-MD5 (不带 salt),例如:<code>0d2bf3c712402f428d48fed691850bfc</code></p>
</li>
<li>明文密码。例如: <code>123456</code></li>
</ol>
<p><strong>警告</strong>MD5, PLAIN-MD5 和明文密码都不安全,请尽可能不要使用它们。</p>
<p><strong>注意</strong>:</p>
<ul>
<li><code>BCRYPT</code> 目前仅在 BSD 平台上有效,因为 Linux 系统带的 <code>libc</code> 函数库不支持 bcrypt。</li>
</ul>
<h2 id="iredmail_1">iRedMail 中默认使用的密码</h2>
<ul>
<li>
<p>对于采用 MySQL 和 PostgreSQL 后端而言:</p>
<ul>
<li>iRedMail-0.9.0 及后续新版本:<code>SSHA512</code></li>
<li>iRedMail-0.8.7 及更早版本:<code>MD5</code></li>
</ul>
</li>
<li>
<p>LDAP 后端:<code>SSHA</code>.</p>
<p>OpenLDAP 内建的密码验证不支持直接验证 SHA-2 格式密码,因此,如果你有第三方
程序需要使用 OpenLDAP 内建的密码验证机制,建议使用 <code>SSHA</code></p>
<p>如果你没有这方面的顾虑,可以使用 <code>SSHA512/BCRYPT</code> 来保存用户密码,同时
<code>/etc/dovecot/dovecot.conf</code> 里设置 <code>ldap_bind = no</code>。SMTP/IMAP/POP3
服务都能正常工作但是Apache 的基础认证basic auth则不行。</p>
</li>
</ul>
<h2 id="iredmail_2">如何在 iRedMail 中使用不同的哈希密码</h2>
<h3 id="mysql-postgresql">对于采用 MySQL 和 PostgreSQL 后端的用户</h3>
<p>所有的邮箱用户账户存放于 SQL 表 <code>vmail.mailbox</code> 中,用户密码则存放于
<code>mailbox.password</code> 字段中。例如(注意:你需要将 <code>xx@xx</code> 替换为实际的邮件地址):</p>
<pre><code>sql&gt; USE vmail;
sql&gt; UPDATE mailbox SET password='$1$GfHYI7OE$vlXqMZSyJOSPXAmbXHq250' WHERE username='xx@xx';
sql&gt; UPDATE mailbox SET password='{SSHA}OuCrqL2yWwQIu8a9uvyOQ5V/ZKfL7LJD' WHERE username='xx@xx';
sql&gt; UPDATE mailbox SET password='{SSHA512}FxgXDhBVYmTqoboW+ibyyzPv/wGG7y4VJtuHWrx+wfqrs/lIH2Qxn2eA0jygXtBhMvRi7GNFmL++6aAZ0kXpcy1fxag=' WHERE username='xx@xx';
</code></pre>
<ul>
<li>要保存 PLAIN-MD5 ,需要加上 <code>{PLAIN-MD5}</code> 前缀:</li>
</ul>
<pre><code>sql&gt; USE vmail;
sql&gt; UPDATE mailbox SET password='{PLAIN-MD5}0d2bf3c712402f428d48fed691850bfc' WHERE username='xx@xx';
</code></pre>
<ul>
<li>要保存明文密码,需要加上 <code>{PLAIN}</code> 前缀:</li>
</ul>
<pre><code>sql&gt; USE vmail;
sql&gt; UPDATE mailbox SET password='{PLAIN}123456' WHERE username='xx@xx';
</code></pre>
<h3 id="openldap">对于采用 OpenLDAP 后端的用户</h3>
<p>用户密码存储于用户的 <code>userPassword</code> 属性中。</p>
<ul>
<li>要保存明文密码SSHASSHA512 哈希密码,只需要直接按原有格式保存即可。例如:</li>
</ul>
<pre><code>userPassword: 123456
userPassword: {SSHA}OuCrqL2yWwQIu8a9uvyOQ5V/ZKfL7LJD
userPassword: {SSHA512}FxgXDhBVYmTqoboW+ibyyzPv/wGG7y4VJtuHWrx+wfqrs...
</code></pre>
<ul>
<li>要保存标准的 MD5 哈希值密码salted MD5 hash请在密码前加上 <code>{CRYPT}</code>
前缀(不区分大小写)。例如:</li>
</ul>
<pre><code>userPassword: {CRYPT}$1$GfHYI7OE$vlXqMZSyJOSPXAmbXHq250
</code></pre>
<p><strong>重要提示</strong> If you want to input password hash with phpLDAPadmin,
please choose <code>clear</code> in the password hash list, then input password hash.</p>
<h2 id="_2">参考资料</h2>
<ul>
<li><a href="./reset.user.password.html">重置用户密码</a></li>
</ul><div class="footer">
<p style="text-align: center; color: grey;">All documents are available in <a href="https://github.com/iredmail/docs/">GitHub repository</a>, and published under <a href="http://creativecommons.org/licenses/by-nd/3.0/us/" target="_blank">Creative Commons</a> license. You can <a href="https://github.com/iredmail/docs/archive/master.zip">download the latest version</a> for offline reading. If you found something wrong, please do <a href="https://www.iredmail.org/contact.html">contact us</a> to fix it.</p>
</div></body></html>