久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術(shù)文章
文章詳情頁

CentOS郵件服務(wù)器搭建系列——用 SSL 對(duì)郵件加密的支持

瀏覽:149日期:2024-07-11 10:04:58

前言

通常,我們發(fā)送的郵件在傳輸過程中都采用明文傳輸。當(dāng)發(fā)送重要信息的時(shí)候,仍然存在郵件被第三方獲取,泄露隱私及密碼等等的安全隱患。在 Web 服務(wù)器中,通過用 SSL 實(shí)現(xiàn)對(duì) HTTPS 協(xié)議的支持,實(shí)現(xiàn)了對(duì)傳輸內(nèi)容的加密,在郵件服務(wù)器中,我們也同樣能夠依靠 SSL 來實(shí)現(xiàn)對(duì)郵件的加密,從而提高通過用郵件傳遞信息的安全性。

證書與密鑰的確認(rèn)

在這里,可以為郵件服務(wù)器建立新的證書,但為了管理上的便利性,我們直接引用 Web 服務(wù)器的證書,作為郵件服務(wù)器的證書。

首先確認(rèn) Web 服務(wù)器證書的存在。

[root@sample ~]# ls -l /etc/httpd/conf/ssl.crt/server.crt  ← 確認(rèn)證書的存在性

-rw-r--r-- 1 root root 956 Oct 14 08:51 /etc/httpd/conf/ssl.crt/server.crt  ← 證書存在

[root@sample ~]# ls -l /etc/httpd/conf/ssl.key/server.key  ← 確認(rèn)密鑰的存在性

-rw------- 1 root root 887 Oct 14 08:49 /etc/httpd/conf/ssl.key/server.key  ← 密鑰存在

如果以上確認(rèn),沒有發(fā)現(xiàn)相關(guān)的證書和密鑰的存在,請(qǐng)參見 “讓服務(wù)器支持安全 HTTP 協(xié)議( HTTPS )” 中的方法來建立相關(guān)的證書和密鑰。

SMTP服務(wù)器(Postfix)方面的相關(guān)設(shè)置

[1] 編輯 Postfix 的 mail.cf 配置文件。

[root@sample ~]# vi /etc/postfix/main.cf  ← 編輯 Postfix 配置文件,在文尾添加如下行:

smtpd_use_tls = yessmtpd_tls_session_cache_database = btree:/etc/postfix/smtpd_scachesmtpd_tls_cert_file = /etc/httpd/conf/ssl.crt/server.crtsmtpd_tls_key_file = /etc/httpd/conf/ssl.key/server.key

[2] 編輯 Postfix 的 master.cf 配置文件。

[root@sample ~]# vi /etc/postfix/master.cf  ← 編輯 master.cf

smtp inet n - n - - smtpd  ← 找到此行,在行首加“#”↓#smtp inet n - n - - smtpd  ← 改為此狀態(tài),禁用SMTP協(xié)議

#smtps inet n - n - - smtpd  ← 找到此行,去掉行首的“#”↓smtps inet n - n - - smtpd  ← 改為此狀態(tài),使用SMTPS協(xié)議

# -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes  ← 找到此行,去掉行首的“#”↓-o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes  ← 改為此狀態(tài)

[3] 編輯 Dovecot 的配置文件。

[root@sample ~]# vi /etc/dovecot.conf  ← 編輯 Dovecot 的配置文件

protocols = imap pop3  ← 找到此行,將“=”后面的部分改為如下狀態(tài)↓protocols = imaps pop3s  ← 改為此狀態(tài),讓其只支持imaps和pop3s協(xié)議

#ssl_disable = no  ← 找到此行,去掉行首的“#”↓ssl_disable = no  ← 改為此狀態(tài),讓其支持 SSL 及 TLS

#ssl_cert_file = /usr/share/ssl/certs/dovecot.pem  ← 找到此行,去掉行首的“#”,并指定證書所在位置↓ssl_cert_file =/etc/httpd/conf/ssl.crt/server.crt  ← 改為此狀態(tài),指定其證書為 Apache 的證書↓#ssl_key_file = /usr/share/ssl/private/dovecot.pem  ← 找到此行,去掉行首的“#”,并指定密鑰所在位置

ssl_key_file = /etc/httpd/conf/ssl.key/server.key   ← 改為此狀態(tài),指定其密鑰為 Apache 的密鑰

[4] 編輯防火墻規(guī)則,打開相應(yīng)端口。

[root@sample ~]# vi /etc/sysconfig/iptables  ← 編輯防火墻規(guī)則

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT  ← 找到此行,接著添加如下行:-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 465 -j ACCEPT  ← 允許SMTPS的465號(hào)端口-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 995 -j ACCEPT  ← 允許POP3S的995號(hào)端口-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 993 -j ACCEPT  ← 允許IMAPS的993號(hào)端口

重新起動(dòng)相關(guān)服務(wù),使設(shè)置生效

最后,重新啟動(dòng)所有相關(guān)的服務(wù),使剛剛的設(shè)置生效。

[root@sample ~]# /etc/rc.d/init.d/postfix restart  ← 重新啟動(dòng) Postfix

Shutting down postfix: [ OK ]Starting postfix: [ OK ]

[root@sample ~]# /etc/rc.d/init.d/dovecot restart  ← 重新啟動(dòng) Dovecot

Stopping Dovecot Imap:  [ OK ]Starting Dovecot Imap: [ OK ]

[root@sample ~]# /etc/rc.d/init.d/iptables restart  ← 重新啟動(dòng) iptables

Flushing firewall rules:  [ OK ]Setting chains to policy ACCEPT: filter [ OK ]Unloading iptables modules: [ OK ]Applying iptables firewall rules:  [ OK ]

郵件客戶端的設(shè)置

這里,郵件客戶端的設(shè)置以 Thunderbird 為例。

* SMTP 方面:

在 SMTP 服務(wù)器設(shè)置中,選擇 SSL 方式。使用 Thunderbird 的情況下,選擇 SSL 后,端口號(hào)會(huì)自動(dòng)變成 465。其它郵件客戶端軟件請(qǐng)根據(jù)實(shí)際情況正確設(shè)置。

標(biāo)簽: CentOS
相關(guān)文章:
主站蜘蛛池模板: 昂仁县| 方山县| 晋宁县| 沂源县| 红河县| 临澧县| 噶尔县| 龙山县| 漳浦县| 双城市| 娱乐| 广水市| 永康市| 安顺市| 诏安县| 定州市| 黄梅县| 措勤县| 湘西| 新丰县| 综艺| 福建省| 恩平市| 民权县| 泸州市| 水城县| 建水县| 大姚县| 湟源县| 和田县| 阿合奇县| 将乐县| 龙泉市| 辽宁省| 寻乌县| 巍山| 鄢陵县| 东山县| 嵩明县| 江华| 昆明市|