Update migrate.to.iredmail.easy.html.

This commit is contained in:
Zhang Huangbin 2020-11-11 18:55:49 +08:00
parent 6bebe64640
commit 1e67d04221
6 changed files with 8 additions and 348 deletions

View File

@ -93,6 +93,7 @@ ALL | `sql_user_iredapd` | Password of SQL user `iredapd` | `/opt/iredapd/settin
ALL | `sql_user_roundcube` | Password of SQL user `roundcube` | `/root/.my.cnf-roundcube` or `/opt/www/roundcubemail/config/config.inc.php`
ALL | `sql_user_sogo` | Password of SQL user `sogo`. If you didn't install SOGo, it's ok to not create this file. | `/etc/sogo/sogo.conf`
ALL | `sql_user_netdata` | Password of SQL user `netdata`. If you didn't install netdata, it's ok to not create this file. | `/root/.my.cnf-netdata` or `/opt/netdata/etc/netdata/my.cnf`
ALL | `sql_user_fail2ban` | Password of SQL user `fail2ban`. If you didn't integrate Fail2ban with SQL server, it's ok to not create this file. | `/root/.my.cnf-fail2ban` (OpenLDAP or MariaDB backends), or `/var/lib/pgsql/.pgpass` (CentOS), or `/var/lib/postgresql/.pgpass` (Debian/Ubuntu), `/var/postgresql/.pgpass` (OpenBSD)
ALL | `iredapd_srs_secret` | The secret string used to sign SRS. It's ok if not present. | `/opt/iredapd/settings.py`, parameter `srs_secrets =`.
ALL | `sogo_sieve_master_password` | The Dovecot master user used by SOGo. It's ok if not present. | `/etc/sogo/sieve.cred`.
ALL | `roundcube_des_key` | The DES key used by Roundcube to encrypt the session. | `/opt/www/roundcubemail/config/config.inc.php`, parameter `$config['des_key'] =`.

View File

@ -61,7 +61,6 @@
<li><a href="ignore.trash.folder.in.quota-zh_CN.html">在邮箱配额中忽略垃圾箱目录</a></li>
<li><a href="mailbox.sharing-zh_CN.html">共享邮箱(将 IMAP 目录共享给其他用户)</a></li>
<li><a href="reset.user.password-zh_CN.html">重置用户密码</a></li>
<li><a href="use.a.bought.ssl.certificate-zh_CN.html">使用购买的 SSL 证书</a></li>
</ul>
<h3 id="_2">排错与调试</h3>
<ul>

View File

@ -210,6 +210,12 @@ config files.</p>
</tr>
<tr>
<td>ALL</td>
<td><code>sql_user_fail2ban</code></td>
<td>Password of SQL user <code>fail2ban</code>. If you didn't integrate Fail2ban with SQL server, it's ok to not create this file.</td>
<td><code>/root/.my.cnf-fail2ban</code> (OpenLDAP or MariaDB backends), or <code>/var/lib/pgsql/.pgpass</code> (CentOS), or <code>/var/lib/postgresql/.pgpass</code> (Debian/Ubuntu), <code>/var/postgresql/.pgpass</code> (OpenBSD)</td>
</tr>
<tr>
<td>ALL</td>
<td><code>iredapd_srs_secret</code></td>
<td>The secret string used to sign SRS. It's ok if not present.</td>
<td><code>/opt/iredapd/settings.py</code>, parameter <code>srs_secrets =</code>.</td>

View File

@ -1,182 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>使用购买的 SSL 证书</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="./use.a.bought.ssl.certificate.html">English</a> /</p>
</div>
<h1 id="ssl">使用购买的 SSL 证书</h1>
<div class="toc">
<ul>
<li><a href="#ssl">使用购买的 SSL 证书</a><ul>
<li><a href="#ssl-ssl">生成 SSL 密钥并购买 SSL 证书</a></li>
<li><a href="#postfixdovecotapachenginx-ssl">配置 Postfix/Dovecot/Apache/Nginx 使用购买的 SSL 证书</a><ul>
<li><a href="#postfix-smtp">Postfix (SMTP 服务器)</a></li>
<li><a href="#dovecot-pop3imap">Dovecot (POP3/IMAP 服务器)</a></li>
<li><a href="#apache">Apache 网页服务器</a></li>
<li><a href="#nginx">Nginx (网页服务器)</a></li>
<li><a href="#openldap">OpenLDAP</a></li>
</ul>
</li>
<li><a href="#_1">参考资料</a></li>
</ul>
</li>
</ul>
</div>
<p>iRedMail 在安装期间会自动生成一个自签名的 SSL 证书,如果你只是要确保有安全的
网络服务(如基于 SSL/TLS 之上的 POP3/IMAP/SMTP 服务),该证书足以。但某些邮件
客户端或浏览器会弹出一个烦人的警示框,提示你该证书不受信任。为了避免这种提示,
必须从 SSL 证书供应商那里购买 SSL 证书。在 Google 中搜索 <code>buy ssl certificate</code>
会列出许多 SSL 证书供应商,选择你信任的那一家即可。</p>
<blockquote>
<p><a href="https://letsencrypt.org">Let's Encrypt 提供免费的 SSL 证书</a>.</p>
</blockquote>
<h2 id="ssl-ssl">生成 SSL 密钥并购买 SSL 证书</h2>
<p>首先,你需要在服务器上使用 <code>openssl</code> 命令生成一个新的 SSL 证书。<strong>警告</strong> :请
__不要__使用长度小于 2048 位的密钥,那是不安全的。</p>
<pre><code># openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr
</code></pre>
<p>该命令会生成两个文件:</p>
<ul>
<li><code>server.key</code>:密钥文件。可用于解密 SSL 证书。必须保护好这个文件。</li>
<li><code>server.csr</code>:用于申请证书的前面请求文件。<strong>购买 SSL 证书时服务商需要此文件。</strong></li>
</ul>
<p>openssl 命令会依据 X.509 规范的要求提示输入凭据信息:</p>
<ul>
<li><code>Country Name (2 letter code)</code>: 使用两个不带标点符号的字母来表示国别。例如: USCACN。</li>
<li><code>State or Province Name (full name)</code>: 地区或省份全称。例如California。</li>
<li><code>Locality Name (eg, city)</code>: 城市或城镇名称。例如Berkeley。</li>
<li><code>Organization Name (eg, company)</code>: 组织名、公司名。</li>
<li><code>Organizational Unit Name (eg, section)</code>: 申请此凭据的部门或单位。</li>
<li><code>Common Name (e.g. server FQDN or YOUR name)</code>: 服务器域名或申请人名字。</li>
<li><code>Email Address []</code>: 申请人邮箱地址。</li>
<li><code>A challenge password []</code>: 为该 SSL 证书设置一个密码。</li>
<li><code>An optional company name []</code>: 一个可选的备用公司名。</li>
</ul>
<p><strong>注意</strong>:有一些 web 服务器只能识别 <code>Common Name</code> 里指定的服务器地址。例如,使用为
<code>domain.com</code> 申请的证书,用户在访问 <code>www.domain.com</code> 或者 <code>secure.domain.com</code>
的网页时,会被警告当前网站使用的证书不可信,因为 <code>www.domain.com</code>
<code>secure.domain.com</code> 与证书的域名 <code>domain.com</code> 是不同的。</p>
<p>现在有了 <code>server.key</code><code>server.csr</code> 两个文件,前往选定的 SSL 证书供应商
的网站购买证书,它会要求你上传 <code>server.csr</code> 文件或输入该文件的内容,然后就可以
获得签发的 SSL 证书了。</p>
<p>通常情况下, SSL 服务提供商将会给你两个文件:</p>
<ul>
<li>server.crt</li>
<li>server.ca-bundle</li>
</ul>
<p>我们需要着两个文件,以前之前生成的 <code>server.key</code>。将它们上传到服务器,以下是
推荐的存放路径:</p>
<ul>
<li>在 RHEL/CentOS 系统上:<code>server.crt</code><code>server.ca-bundle</code> 上传至
<code>/etc/pki/tls/certs/</code> <code>server.key</code> 上传至 <code>/etc/pki/tls/private/</code></li>
<li>在 Debian/Ubuntu FreeBSD 系统上: <code>server.crt</code><code>server.ca-bundle</code> 上传至
<code>/etc/ssl/certs/</code> <code>server.key</code> 上传至<code>/etc/ssl/private/</code></li>
<li>在 OpenBSD 系统上:上传至 <code>/etc/ssl/</code></li>
</ul>
<h2 id="postfixdovecotapachenginx-ssl">配置 Postfix/Dovecot/Apache/Nginx 使用购买的 SSL 证书</h2>
<p>下面示例中我们以 CentOS 系统为例,请根据你的发行版调整相关文件路径(已在上面注明)。</p>
<h3 id="postfix-smtp">Postfix (SMTP 服务器)</h3>
<p>直接使用 <code>postconf</code> 命令来更新 SSL 证书相关的设置:</p>
<pre><code>postconf -e smtpd_tls_cert_file='/etc/pki/tls/certs/server.crt'
postconf -e smtpd_tls_key_file='/etc/pki/tls/private/server.key'
postconf -e smtpd_tls_CAfile='/etc/pki/tls/certs/server.ca-bundle'
</code></pre>
<p>修改后需重启 Postfix 服务。</p>
<h3 id="dovecot-pop3imap">Dovecot (POP3/IMAP 服务器)</h3>
<p>Dovecot 的 SSL 证书设置定义在主配置文件 <code>/etc/dovecot/dovecot.conf</code>
(Linux/OpenBSD) 或 <code>/usr/local/etc/dovecot/dovecot.conf</code> (FreeBSD) 里:</p>
<pre><code>ssl = required
ssl_cert = &lt;/etc/pki/tls/certs/server.crt
ssl_key = &lt;/etc/pki/tls/private/server.key
ssl_ca = &lt;/etc/pki/tls/certs/server.ca-bundle
</code></pre>
<p>修改后需重启 Dovecot 服务。</p>
<h3 id="apache">Apache 网页服务器</h3>
<ul>
<li>在 RHEL/CentOS 系统上,配置文件为 <code>/etc/httpd/conf.d/ssl.conf</code></li>
<li>在 Debian/Ubuntu 系统上,配置文件为 <code>/etc/apache2/sites-available/default-ssl</code>
(或者是 <code>default-ssl.conf</code> </li>
<li>在 FreeBSD 系统上,配置文件为 <code>/usr/local/etc/apache24/extra/httpd-ssl.conf</code> 。注意:取决于运行的 Apache 版本,右侧路径会有所不同(<code>apache24</code> 将会是 <code>apache[_version_]</code> )。</li>
<li>在 OpenBSD 系统,如果是 OpenBSD 5.5 或更早的版本,配置文件为 <code>/var/www/conf/httpd.conf</code> 。注意: OpenBSD 5.6 以及之后的版本不再装置 Apache 。</li>
</ul>
<p>示例:</p>
<pre><code>SSLCertificateFile /etc/pki/tls/certs/server.crt
SSLCertificateKeyFile /etc/pki/tls/private/server.key
SSLCertificateChainFile /etc/pki/tls/certs/server.ca-bundle
</code></pre>
<p>修改后需重启 Apache 服务。</p>
<h3 id="nginx">Nginx (网页服务器)</h3>
<ul>
<li>在 Linux 和 OpenBSD 系统上, 配置文件为 <code>/etc/nginx/conf.d/default.conf</code></li>
<li>在 FreeBSD 系统上,配置文件为 <code>/usr/local/etc/nginx/conf.d/default.conf</code></li>
</ul>
<pre><code>server {
listen 443;
...
ssl on;
ssl_certificate /etc/pki/tls/certs/server.crt;
ssl_certificate_key /etc/pki/tls/private/server.key;
...
}
</code></pre>
<p>大部分浏览器能识别 SSL 证书,但可能有小部分浏览器无法正确识别。这种情况可以
<code>server.crt</code><code>server.ca-bundle</code> 的内容追加到一个新文件里,然后以这个
新文件作为 SSL 证书。注意:<code>server.crt</code> 的内容要在前面。</p>
<pre><code># cd /etc/pki/tls/certs/
# cat server.crt server.ca-bundle &gt; server.chained.crt
</code></pre>
<p>更新 <code>/etc/nginx/conf.d/default.conf</code> 文件中的 <code>ssl_certificate</code> 参数:</p>
<pre><code> ssl_certificate /etc/pki/tls/certs/server.chained.crt;
</code></pre>
<p>修改后需重启 Nginx 服务。</p>
<h3 id="openldap">OpenLDAP</h3>
<ul>
<li>Red Hat/CentOS配置文件为 <code>/etc/openldap/slapd.conf</code></li>
<li>Debian/Ubuntu配置文件为 <code>/etc/ldap/slapd.conf</code></li>
<li>FreeBSD配置文件为 <code>/usr/local/etc/openldap/slapd.conf</code></li>
<li>OpenBSD配置文件为 <code>/etc/openldap/slapd.conf</code></li>
</ul>
<pre><code>TLSCACertificateFile /etc/pki/tls/certs/server.ca-bundle
TLSCertificateFile /etc/pki/tls/certs/server.crt
TLSCertificateKeyFile /etc/pki/tls/private/server.key
</code></pre>
<p>修改后需重启 OpenLDAP 服务。</p>
<h2 id="_1">参考资料</h2>
<ul>
<li><a href="http://nginx.org/en/docs/http/configuring_https_servers.html">HTTPS 服务器配置</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>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-3293801-21"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-3293801-21');
</script>
</body></html>

View File

@ -15,11 +15,7 @@
/>&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="./use.a.bought.ssl.certificate-zh_CN.html">简体中文</a> /</p>
</div>
<h1 id="use-a-bought-ssl-certificate">Use a bought SSL certificate</h1>
&nbsp;&nbsp;//&nbsp;&nbsp;<a href="./index.html">Document Index</a></div><h1 id="use-a-bought-ssl-certificate">Use a bought SSL certificate</h1>
<div class="toc">
<ul>
<li><a href="#use-a-bought-ssl-certificate">Use a bought SSL certificate</a><ul>

View File

@ -1,160 +0,0 @@
# 使用购买的 SSL 证书
[TOC]
iRedMail 在安装期间会自动生成一个自签名的 SSL 证书,如果你只是要确保有安全的
网络服务(如基于 SSL/TLS 之上的 POP3/IMAP/SMTP 服务),该证书足以。但某些邮件
客户端或浏览器会弹出一个烦人的警示框,提示你该证书不受信任。为了避免这种提示,
必须从 SSL 证书供应商那里购买 SSL 证书。在 Google 中搜索 `buy ssl certificate`
会列出许多 SSL 证书供应商,选择你信任的那一家即可。
> [Let's Encrypt 提供免费的 SSL 证书](https://letsencrypt.org).
## 生成 SSL 密钥并购买 SSL 证书
首先,你需要在服务器上使用 `openssl` 命令生成一个新的 SSL 证书。__警告__ :请
__不要__使用长度小于 2048 位的密钥,那是不安全的。
```
# openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr
```
该命令会生成两个文件:
* `server.key`:密钥文件。可用于解密 SSL 证书。必须保护好这个文件。
* `server.csr`用于申请证书的前面请求文件。__购买 SSL 证书时服务商需要此文件。__
openssl 命令会依据 X.509 规范的要求提示输入凭据信息:
* `Country Name (2 letter code)`: 使用两个不带标点符号的字母来表示国别。例如: USCACN。
* `State or Province Name (full name)`: 地区或省份全称。例如California。
* `Locality Name (eg, city)`: 城市或城镇名称。例如Berkeley。
* `Organization Name (eg, company)`: 组织名、公司名。
* `Organizational Unit Name (eg, section)`: 申请此凭据的部门或单位。
* `Common Name (e.g. server FQDN or YOUR name)`: 服务器域名或申请人名字。
* `Email Address []`: 申请人邮箱地址。
* `A challenge password []`: 为该 SSL 证书设置一个密码。
* `An optional company name []`: 一个可选的备用公司名。
__注意__有一些 web 服务器只能识别 `Common Name` 里指定的服务器地址。例如,使用为
`domain.com` 申请的证书,用户在访问 `www.domain.com` 或者 `secure.domain.com`
的网页时,会被警告当前网站使用的证书不可信,因为 `www.domain.com`
`secure.domain.com` 与证书的域名 `domain.com` 是不同的。
现在有了 `server.key``server.csr` 两个文件,前往选定的 SSL 证书供应商
的网站购买证书,它会要求你上传 `server.csr` 文件或输入该文件的内容,然后就可以
获得签发的 SSL 证书了。
通常情况下, SSL 服务提供商将会给你两个文件:
* server.crt
* server.ca-bundle
我们需要着两个文件,以前之前生成的 `server.key`。将它们上传到服务器,以下是
推荐的存放路径:
* 在 RHEL/CentOS 系统上:`server.crt` 和 `server.ca-bundle` 上传至
`/etc/pki/tls/certs/` `server.key` 上传至 `/etc/pki/tls/private/`
* 在 Debian/Ubuntu FreeBSD 系统上: `server.crt``server.ca-bundle` 上传至
`/etc/ssl/certs/` `server.key` 上传至`/etc/ssl/private/`。
* 在 OpenBSD 系统上:上传至 `/etc/ssl/`
## 配置 Postfix/Dovecot/Apache/Nginx 使用购买的 SSL 证书
下面示例中我们以 CentOS 系统为例,请根据你的发行版调整相关文件路径(已在上面注明)。
### Postfix (SMTP 服务器)
直接使用 `postconf` 命令来更新 SSL 证书相关的设置:
```
postconf -e smtpd_tls_cert_file='/etc/pki/tls/certs/server.crt'
postconf -e smtpd_tls_key_file='/etc/pki/tls/private/server.key'
postconf -e smtpd_tls_CAfile='/etc/pki/tls/certs/server.ca-bundle'
```
修改后需重启 Postfix 服务。
### Dovecot (POP3/IMAP 服务器)
Dovecot 的 SSL 证书设置定义在主配置文件 `/etc/dovecot/dovecot.conf`
(Linux/OpenBSD) 或 `/usr/local/etc/dovecot/dovecot.conf` (FreeBSD) 里:
```
ssl = required
ssl_cert = </etc/pki/tls/certs/server.crt
ssl_key = </etc/pki/tls/private/server.key
ssl_ca = </etc/pki/tls/certs/server.ca-bundle
```
修改后需重启 Dovecot 服务。
### Apache 网页服务器
* 在 RHEL/CentOS 系统上,配置文件为 `/etc/httpd/conf.d/ssl.conf`
* 在 Debian/Ubuntu 系统上,配置文件为 `/etc/apache2/sites-available/default-ssl`
(或者是 `default-ssl.conf`
* 在 FreeBSD 系统上,配置文件为 `/usr/local/etc/apache24/extra/httpd-ssl.conf` 。注意:取决于运行的 Apache 版本,右侧路径会有所不同(`apache24` 将会是 `apache[_version_]` )。
* 在 OpenBSD 系统,如果是 OpenBSD 5.5 或更早的版本,配置文件为 `/var/www/conf/httpd.conf` 。注意: OpenBSD 5.6 以及之后的版本不再装置 Apache 。
示例:
```
SSLCertificateFile /etc/pki/tls/certs/server.crt
SSLCertificateKeyFile /etc/pki/tls/private/server.key
SSLCertificateChainFile /etc/pki/tls/certs/server.ca-bundle
```
修改后需重启 Apache 服务。
### Nginx (网页服务器)
* 在 Linux 和 OpenBSD 系统上, 配置文件为 `/etc/nginx/conf.d/default.conf`
* 在 FreeBSD 系统上,配置文件为 `/usr/local/etc/nginx/conf.d/default.conf`
```
server {
listen 443;
...
ssl on;
ssl_certificate /etc/pki/tls/certs/server.crt;
ssl_certificate_key /etc/pki/tls/private/server.key;
...
}
```
大部分浏览器能识别 SSL 证书,但可能有小部分浏览器无法正确识别。这种情况可以
`server.crt``server.ca-bundle` 的内容追加到一个新文件里,然后以这个
新文件作为 SSL 证书。注意:`server.crt` 的内容要在前面。
```
# cd /etc/pki/tls/certs/
# cat server.crt server.ca-bundle > server.chained.crt
```
更新 `/etc/nginx/conf.d/default.conf` 文件中的 `ssl_certificate` 参数:
```
ssl_certificate /etc/pki/tls/certs/server.chained.crt;
```
修改后需重启 Nginx 服务。
### OpenLDAP
* Red Hat/CentOS配置文件为 `/etc/openldap/slapd.conf`
* Debian/Ubuntu配置文件为 `/etc/ldap/slapd.conf`
* FreeBSD配置文件为 `/usr/local/etc/openldap/slapd.conf`
* OpenBSD配置文件为 `/etc/openldap/slapd.conf`
```
TLSCACertificateFile /etc/pki/tls/certs/server.ca-bundle
TLSCertificateFile /etc/pki/tls/certs/server.crt
TLSCertificateKeyFile /etc/pki/tls/private/server.key
```
修改后需重启 OpenLDAP 服务。
## 参考资料
* [HTTPS 服务器配置](http://nginx.org/en/docs/http/configuring_https_servers.html)