{"id":131128,"date":"2019-01-06T09:15:55","date_gmt":"2019-01-06T01:15:55","guid":{"rendered":"https:\/\/gulass.cn\/?p=131128"},"modified":"2019-01-02T10:53:32","modified_gmt":"2019-01-02T02:53:32","slug":"linux-postfix-4","status":"publish","type":"post","link":"https:\/\/gulass.cn\/linux-postfix-4.html","title":{"rendered":"Linux\u4e2dPostfix\u90ae\u4ef6\u63a5\u6536\u914d\u7f6e\uff08\u56db\uff09"},"content":{"rendered":"
MRA\u90ae\u4ef6\u53d6\u56de\u4ee3\u7406\u4e5f\u6709\u5f88\u591a\u5982courier-imap\uff0ccyrus-imap\u548cdovecot\u8fd9\u4e09\u4e2a\u4e2a\u5de5\u5177\uff0c\u4e0b\u9762\u91cd\u70b9\u4ecb\u7ecdDovecot:<\/p>\n
1.\u9ad8\u5b89\u5168\u6027\u3002\u636e Dovecot \u7684\u4f5c\u8005\u58f0\u79f0\uff0c\u4ece Dovecot \u7684\u8bbe\u8ba1\u548c\u5b9e\u73b0\uff0c\u5b89\u5168\u6027\u90fd\u662f\u88ab\u9ad8\u5ea6\u5173\u6ce8\u548c\u5f3a\u8c03\u7684\u3002\u8fd9\u91cc\u7684\u5b89\u5168\u6027\u4e0d\u5355\u5355\u6307\u4f20\u7edf\u610f\u4e49\u7684\u5b89\u5168\u6f0f\u6d1e\uff0c\u4e5f\u5305\u62ec\u8f6f\u4ef6\u7684\u53ef\u9760\u6027\u3002\u800c Dovecot \u9ad8\u5b89\u5168\u6027\u7684\u6700\u4f73\u4f50\u8bc1\uff0c\u5c31\u662f\u201c\u60ac\u8d4f\u201d\u3002Dovecot \u4f5c\u8005\u4ece 2006 \u5e74\u5f00\u59cb\uff0c\u5bf9\u4e8e\u7b2c\u4e00\u4e2a\u80fd\u591f\u53d1\u73b0\u201cremotely exploitable security hole\u201d\u7684\u4eba\uff0c\u5956\u8d4f 1000 \u82f1\u9551\uff0c\u7ed3\u679c\u65f6\u81f3\u4eca\u65e5\uff0c\u8fd9 1000 \u82f1\u9551\u4ecd\u7136\u6ca1\u6709\u4eba\u5f97\u5230\u3002\u8fd9\u91cc\u7684\u201cremotely exploitable security hole\u201d\u5e76\u4e0d\u662f\u7b80\u5355\u7684\u6307\u8f6f\u4ef6\u7f3a\u9677\u3002\u7531\u6b64\u770b\u51fa\u5176\u5b89\u5168\u6027\u5341\u5206\u4e86\u5f97\u3002\u800c\u4f5c\u4e3a\u53ef\u76f4\u63a5\u8bbf\u95ee\u7528\u6237\u6570\u636e\u548c\u90ae\u4ef6\u7684\u5e94\u7528\uff0c\u5982\u679c\u5b58\u5728\u88ab\u4eba\u975e\u6cd5\u8bbf\u95ee\u7684\u6f0f\u6d1e\uff0c\u540e\u679c\u4f55\u5176\u4e25\u91cd\u3002<\/p>\n
2.\u9ad8\u6027\u80fd\u3002\u8fd9\u91cc\u7684\u9ad8\u6027\u80fd\u5e76\u4e0d\u662f\u6cdb\u6307 Dovecot \u8f6f\u4ef6\u672c\u8eab\u8fd0\u884c\u591a\u5feb\uff0c\u800c\u662f\u4e13\u6307 Dovecot \u5728\u8bbf\u95ee\u90ae\u7bb1\u65f6\u7684\u9ad8\u6027\u80fd\u3002Dovecot \u662f\u901a\u8fc7\u5bf9\u6807\u51c6\u7684\u90ae\u4ef6\u5b58\u50a8\u683c\u5f0f mbox \u548c maildir \u8fdb\u884c\u7d22\u5f15\u6765\u505a\u5230\u7684\u3002\u7d22\u5f15\u5bf9\u7528\u6237\u662f\u900f\u660e\u7684\uff0c\u5728\u540e\u53f0\u6084\u6084\u7684\uff0c\u5e76\u4e14\u662f\u589e\u91cf\u8fdb\u884c\uff0c\u4e5f\u5c31\u662f\u5728\u6bcf\u6b21\u6709\u65b0\u90ae\u4ef6\u6216\u8005\u662f\u7528\u6237\u5bf9\u90ae\u4ef6\u8fdb\u884c\u4fee\u6539\u6216\u5220\u9664\u65f6\u8fdb\u884c\uff0c\u56e0\u6b64\u5c06\u7d22\u5f15\u7684\u4ee3\u4ef7\u964d\u81f3\u6700\u4f4e\u3002Dovecot \u53ea\u5bf9\u90a3\u4e9b\u7528\u6237\u5ba2\u6237\u7aef\u7ecf\u5e38\u7528\u5230\u7684\u4fe1\u606f\uff0c\u5982\u90ae\u4ef6\u6807\u9898\uff0c\u90ae\u4ef6\u53d1\u9001\u8005\u7b49\u8fdb\u884c\u7d22\u5f15\u3002\u4fdd\u8bc1\u7d22\u5f15\u6587\u4ef6\u4e0d\u8fc7\u4e8e\u592a\u5927\u3002\u5728\u90ae\u7bb1\u7684\u90ae\u4ef6\u6570\u5f88\u5c0f\u7684\u65f6\u5019\u662f\u770b\u4e0d\u51fa\u7d22\u5f15\u7684\u597d\u5904\u7684\uff0c\u4f46\u5f53\u90ae\u4ef6\u6570\u91cf\u6162\u6162\u589e\u5927\u65f6\uff0cDovecot \u5c31\u663e\u793a\u51fa\u4ed6\u7684\u4f18\u52bf\uff1a\u6bcf\u6b21\u6253\u5f00\u90ae\u7bb1\uff0c\u6536\u53d1\u5220\u9664\u90ae\u4ef6\u90fd\u975e\u5e38\u5feb\u3002\u76f8\u6bd4\u5176\u4ed6\u4e00\u4e9b\u4f20\u7edf\u4e3b\u6d41\u7684 IMAP Server \u5982 uwimap\uff0c\u5c31\u4e0d\u652f\u6301\u7d22\u5f15\uff0c\u56e0\u6b64\u6bcf\u5f53\u6253\u5f00\u90ae\u7bb1\uff0c\u9700\u8981\u626b\u63cf\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf\uff0c\u8f7d\u5165\u5168\u90e8\u6587\u4ef6\uff0c\u653e\u5230\u5185\u5b58\uff0c\u4ee3\u4ef7\u4e4b\u5927\uff0c\u53ef\u60f3\u800c\u77e5\u3002\u53e6\u5916\u7d22\u5f15\u548c\u6211\u4eec\u63a5\u4e0b\u6765\u8ba8\u8bba\u7684\u4e3b\u9898\u662f\u7d27\u5bc6\u76f8\u5173\u7684\u3002<\/p>\n
3.\u652f\u6301pop3,imap4,pops,imaps\u6536\u90ae\u4ef6\u534f\u8bae<\/p>\n
4.\u6613\u4e8e\u7ba1\u7406\u548c\u6269\u5c55\u6027\u3002Dovecot \u5177\u6709\u975e\u5e38\u591a\u7684\u63d2\u4ef6\uff0c\u4f7f\u5f97\u914d\u7f6e\u5341\u5206\u65b9\u4fbf\u548c\u7075\u6d3b\u3002\u6bd4\u5982\u6709SASL\u7684\u8ba4\u8bc1\u80fd\u529b\uff0c\u4f46\u4e0d\u4f9d\u8d56\u4e8eSASL\u624d\u53ef\u4ee5\u8ba4\u8bc1\uff0c\u81ea\u8eab\u5c31\u53ef\u4ee5\u76f4\u63a5\u53bb\u505a\u8ba4\u8bc1\u7684 auth-mechanism\uff0c\u652f\u6301 plain\uff0cCRAM-MD5 \u7b49\u3002\u4e0b\u9762\u662f\u4f8b\u5b50\uff1a<\/p>\n
\r\n10-auth.conf:\r\n\r\nauth_mechanisms = plain login cram-md5\u3002\r\n<\/pre>\n\u53c8\u6bd4\u5982\u7528\u4e8e\u7528\u6237\u5bc6\u7801\u8ba4\u8bc1\u7684 passworddb\uff0c\u652f\u6301 password-file\uff0cLDAP\uff0cSQL\uff0cStatic \u7b49\u3002<\/p>\n
5.\u652f\u6301\u4e24\u79cd\u90ae\u7bb1\u683c\u5f0f:<\/p>\n
\r\nmailbox\uff1a\u4e00\u4e2a\u90ae\u4ef6\u5b58\u50a8\u6240\u6709\u90ae\u4ef6(redhat\u9ed8\u8ba4\u4f7f\u7528)\r\n\r\nmaildir\uff1a\u4e00\u4e2a\u6587\u4ef6\u5b58\u50a8\u4e00\u5c01\u90ae\u4ef6,\u6240\u6709\u90ae\u4ef6\u5b58\u50a8\u5728\u4e00\u4e2a\u76ee\u5f55\u4e2d\r\n<\/pre>\nRPM\u5305\u5b89\u88c5Dovecot<\/strong><\/div>\n\u2460 \u5b89\u88c5Dovecot<\/p>\n
\r\n[root@localhost ~]# yum install dovecot dovecot-mysql\r\n<\/pre>\n\u2461\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/p>\n
\r\n[root@localhost ~]# vim \/etc\/dovecot\/dovecot.conf\r\nssl = no\r\n #\u7981\u6b62SSL\u673a\u5236\uff0c\u4e0d\u7136\u540e\u9762telnet\u65e0\u6cd5\u8fde\u63a5\u6d4b\u8bd5\r\ndisable_plaintext_auth = no\r\n #\u5141\u8bb8\u660e\u6587\u5bc6\u7801\u9a8c\u8bc1\uff0c\u4e0d\u7136\u8d26\u53f7\u8fde\u63a5\u4e0d\u4e0a\r\nmail_location = maildir:~\/Maildir\r\n #\u8bbe\u7f6e\u90ae\u4ef6\u5b58\u50a8\u683c\u5f0f\u53ca\u4f4d\u7f6e\uff08Dovecot\u6536\u90ae\u4ef6\u7684\u65b9\u5f0f\u4e00\u5b9a\u8981\u4e0ePostfix\u6536\u90ae\u4ef6\u65b9\u5f0f\u76f8\u540c\uff09\r\nprotocols = imap imaps pop3 pop3s\r\n #\u5f00\u542f\u652f\u6301\u7684\u6536\u90ae\u4ef6\u534f\u8bae\r\n[root@localhost ~]# service dovecot start\r\n\r\n[root@localhost ~]# chkconfig dovecot on\r\n<\/pre>\nPS\uff1aDovecot\u5c31\u5b89\u88c5\u5b8c\u6210\u540e\u5f00\u542f\u534f\u8bae\u5c31\u53ef\u4ee5\u7528\u6765\u6536\u90ae\u4ef6\u4e86\uff0c\u9ed8\u8ba4\u5c31\u53ef\u4ee5\u4ecePasswd\u4e2d\u8ba4\u8bc1\u8d26\u6237\u3002<\/p>\n
POP3\u534f\u8bae\u6536\u90ae\u4ef6\u547d\u4ee4<\/strong><\/div>\n<\/p>\n
\u7f16\u8bd1\u5b89\u88c5Dovecot<\/strong><\/div>\n\u2460\u5b89\u88c5pam-devel<\/p>\n
\r\n[root@localhost ~]# yum install pam-devel\r\n<\/pre>\n\u2461\u5b89\u88c5Dovecot<\/p>\n
\r\n[root@localhost ~]# useradd -M -s \/sbin\/nologin dovecot\r\n[root@localhost ~]# useradd -M -s \/sbin\/nologin dovenull\r\n[root@localhost ~]# tar xvf dovecot-2.1.11.tar.gz -C \/usr\/src\r\n[root@localhost dovecot-2.1.11]# cd \/usr\/src\/dovecot-2.1.11\r\n[root@localhost dovecot-2.1.11]# .\/configure --sysconfdir=\/etc --with-mysql --with-pam\r\n[root@localhost dovecot-2.1.11]# make && make install\r\n<\/pre>\n\u2462\u5b89\u88c5dovecot.pem<\/p>\n
\r\n[root@localhost ~]# mkdir -p \/etc\/ssl\/certs\r\n[root@localhost ~]# mkdir -p \/etc\/ssl\/private\r\n[root@localhost ~]# cd \/usr\/src\/dovecot-2.1.11\/doc\r\n[root@localhost doc]# sh mkcert.sh\r\n<\/pre>\n#\u4f1a\u5728\/etc\/ssl\/certs\/\u4e0b\u751f\u4ea7\u4e00\u4e2adovecot.pem\u8bc1\u4e66<\/p>\n
\u2463\u6dfb\u52a0\u7cfb\u7edf\u7684\u670d\u52a1<\/p>\n
\r\n[root@localhost doc]# cp dovecot-initd.sh \/etc\/init.d\/dovecot\r\n[root@localhost ~]# chmod +x \/etc\/init.d\/dovecot\r\n[root@localhost ~]# chkconfig --add dovecot\r\n[root@localhost ~]# chkconfig dovecot on\r\n<\/pre>\n\u2464\u5efa\u7acbdovecot.conf\u914d\u7f6e\u6587\u4ef6<\/p>\n
\r\n[root@localhost ~]# cp -R \/usr\/local\/share\/doc\/dovecot\/example-config\/* \/etc\/dovecot\r\n[root@localhost ~]# vi \/etc\/dovecot\/dovecot.conf\r\n!include conf.d\/10-auth.conf\r\nssl = no\r\n #\u7981\u6b62SSL\u673a\u5236\r\ndisable_plaintext_auth = no\r\n #\u5141\u8bb8\u660e\u6587\u5bc6\u7801\u9a8c\u8bc1\uff0c\u4e0d\u7136\u8d26\u53f7\u8fde\u63a5\u4e0d\u4e0a\r\nmail_location = maildir:~\/Maildir\r\n #\u8bbe\u7f6e\u90ae\u4ef6\u5b58\u50a8\u683c\u5f0f\u53ca\u4f4d\u7f6e\uff08Dovecot\u6536\u90ae\u4ef6\u7684\u65b9\u5f0f\u4e00\u5b9a\u8981\u4e0ePostfix\u6536\u90ae\u4ef6\u65b9\u5f0f\u76f8\u540c\uff09\r\nprotocols = imap pop3\r\n #\u5f00\u542f\u652f\u6301\u7684\u6536\u90ae\u4ef6\u534f\u8bae\r\n<\/pre>\n\u2465\u521b\u5efaPAM\u8ba4\u8bc1\u6587\u4ef6<\/p>\n
\r\n[root@localhost ~]# vi \/etc\/pam.d\/dovecot\r\nauth required pam_nologin.so\r\nauth include system-auth\r\naccount include system-auth\r\nsession include system-auth\r\n<\/pre>\n\u2467\u6700\u540e\u542f\u52a8\u7f16\u8bd1\u597d\u7684dovecot\u670d\u52a1\u53ef\u4ee5\u6d4b\u8bd5\u6536\u90ae\u4ef6<\/p>\n
\r\n[root@localhost ~]# \/etc\/init.d\/dovecot start\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"MRA\u90ae\u4ef6\u53d6\u56de\u4ee3\u7406\u4e5f\u6709\u5f88\u591a\u5982courier-imap\uff0ccyrus-imap\u548cdovecot\u8fd9\u4e09\u4e2a\u4e2a\u5de5\u5177\uff0c\u4e0b\u9762\u91cd […]<\/p>\n","protected":false},"author":668,"featured_media":131143,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-131128","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/131128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/668"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=131128"}],"version-history":[{"count":3,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/131128\/revisions"}],"predecessor-version":[{"id":132910,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/131128\/revisions\/132910"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/131143"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=131128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=131128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=131128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}