{"id":131134,"date":"2019-01-09T08:17:55","date_gmt":"2019-01-09T00:17:55","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=131134"},"modified":"2019-01-02T10:56:58","modified_gmt":"2019-01-02T02:56:58","slug":"linux-postfix-9","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-postfix-9.html","title":{"rendered":"Linux\u4e2dPostfix\u57fa\u4e8eSSL\u6536\u53d1\u90ae\u4ef6\uff08\u4e5d\uff09"},"content":{"rendered":"

\u5176\u4e2d\u5728\u6574\u4e2a\u4e00\u5957\u90ae\u4ef6\u670d\u52a1\u5668\u4e2d\uff0c\u9ed8\u8ba4\u4fe1\u606f\u4f20\u8f93\u90fd\u662f\u660e\u6587\u4f20\u8f93\u7684\uff0c\u6240\u4ee5\u8fd9\u4e2a\u5728\u5b89\u5168\u6027\u4e0a\u9762\u5c31\u4e0d\u662f\u90a3\u4e48\u597d\u3002\u4f46\u662f\u5982\u679c\u8bf4\u4e00\u5c01\u90ae\u4ef6\u4ece\u53d1\u751f\u5230\u5bf9\u65b9\u63a5\u53d7\u60f3\u8981\u5168\u7a0b\u505a\u5230\u52a0\u5bc6\u5904\u7406\u8fd9\u4e2a\u4e5f\u662f\u5f88\u96be\u7684\u3002\u56e0\u4e3a\u4e00\u5c01\u90ae\u4ef6\u4ece\u4e00\u4e2a\u57df\u8f6c\u5230\u53e6\u5916\u4e00\u4e2a\u57df\u670d\u52a1\u5668\u65f6\u5f88\u96be\u505a\u5230\u52a0\u5bc6\uff0c\u8fd9\u5c5e\u4e8e\u4e0d\u540c\u7684\u57df\uff0c\u6709\u4e0d\u540c\u7684\u4eba\u5728\u7ba1\u7406\uff0c\u6bd4\u5982\u8bf4\u4ece163\u53d1\u4e00\u5c01\u90ae\u4ef6\u5230QQ\u90ae\u7bb1\u3002<\/p>\n

\u4f46\u662f\u5982\u679c\u5728\u540c\u4e00\u4e2a\u57df\u5185\u4fdd\u8bc1\u90ae\u4ef6\u53d1\u9001\u548c\u63a5\u6536\u7684\u5b89\u5168\u6027\uff0c\u8be5\u5982\u4f55\u505a\u5462\uff1f\u5176\u5b9e\u4e5f\u6709\u4e00\u79cd\u673a\u5236\u5c31\u662fS\/MIME\uff0c\u63d0\u4f9b\u7528\u6237\u5230\u7528\u6237\u7684\u90ae\u4ef6\u5b89\u5168\u6027\u3002\u5b83\u80fd\u4fdd\u8bc1\u90ae\u4ef6\u53d1\u9001\u52a0\u5bc6\u540c\u65f6\u90ae\u4ef6\u5b58\u50a8\u5728\u90ae\u4ef6\u670d\u52a1\u5668\u4e0a\u4e5f\u662f\u52a0\u5bc6\u5b58\u653e\uff0c\u76f4\u5230\u7528\u6237\u53d6\u56de\u5230\u672c\u5730\u8fdb\u884c\u89e3\u5bc6\u624d\u53ef\u67e5\u770b\uff0c\u5728\u8fd9\u671f\u95f4\u4efb\u4f55\u4eba\u622a\u53d6\u90ae\u4ef6\u90fd\u662f\u4e0d\u53ef\u770b\u7684\uff0c\u53ef\u4ee5\u8bf4\u662f\u975e\u5e38\u5b89\u5168\u4e86\u3002\u4f46\u662f\u8fd9\u79cd\u673a\u5236\u4e00\u822c\u90fd\u662f\u63d0\u4f9b\u5546\u4e1a\u652f\u6301\u3002<\/p>\n

\u90a3\u4e48\u9664\u4e86S\/MIME\u8fd9\u79cd\u673a\u5236\uff0c\u5728\u6211\u4eec\u53ef\u63a7\u8303\u56f4\u5185\u53ef\u4ee5\u505a\u5230\u90ae\u4ef6\u53d1\u9001\u548c\u63a5\u6536\u65f6\u8fdb\u884c\u52a0\u5bc6\uff0c\u5982smtps\u662f\u52a0\u5bc6\u4f20\u8f93\u7684smtp\u534f\u8bae\uff0c\u5de5\u4f5c\u5728TCP\/465\u7aef\u53e3\uff1bPOP3s\u662f\u52a0\u5bc6\u4f20\u8f93\u7684pop3\u534f\u8bae\uff0c\u5de5\u4f5c\u5728TCP\/995\u7aef\u53e3\uff1b\u4ee5\u53caIMAP4s\u662f\u52a0\u5bc6\u4f20\u8f93\u7684imap4\u534f\u8bae\uff0c\u5de5\u4f5c\u5728TCP\/993\u7aef\u53e3\uff1b\u5f53\u7136\u8fd9\u53ea\u662f\u80fd\u4fdd\u8bc1\u90ae\u4ef6\u4ece\u90ae\u7bb1\u5230\u672c\u5730\u662f\u52a0\u5bc6\u7684\uff0c\u5982\u90ae\u4ef6\u53d1\u9001\u548c\u5b58\u50a8\u65e0\u6cd5\u505a\u5230\u52a0\u5bc6\u3002\u4e5f\u53ef\u4ee5\u5bf9webmail\u8fdb\u884chttps\u4f20\u8f93\uff0c\u8fd9\u4e9b\u90fd\u53ef\u4ee5\u5728\u4e00\u5b9a\u7a0b\u5ea6\u4e0a\u505a\u5230\u90ae\u4ef6\u52a0\u5bc6\u5904\u7406\u3002<\/p>\n

OpenSSL\u5b9e\u73b0\u79c1\u6709CA<\/strong><\/div>\n

CA\u670d\u52a1\u5668\u751f\u6210\u4e00\u5bf9\u79d8\u94a5\u5e76\u4fdd\u5b58<\/p>\n

\r\n[root@localhost ~]# openssl genrsa 1024 > \/etc\/pki\/CA\/private\/cakey.pem\r\n<\/pre>\n

CA\u670d\u52a1\u5668\u751f\u6210\u81ea\u7b7e\u7f72\u8bc1\u4e66<\/p>\n

\r\n[root@localjost ~]# openssl req -new -x509 -key \/etc\/pki\/CA\/private\/cakey.pem -out \/etc\/pki\/CA\/cacert.pem -days 365\r\n\u8f93\u5165\u56fd\u5bb6\u540d\u79f02\u4f4d\u7684\u4ee3\u7801\uff1acn\r\n\u8f93\u5165\u6240\u5728\u7701\u4efd\u7684\u540d\u79f0\uff1ashanghai\r\n\u8f93\u5165\u6240\u5728\u57ce\u5e02\u7684\u540d\u79f0\uff1ashanghai\r\n\u8f93\u5165\u516c\u53f8\u7684\u540d\u79f0\uff1aywnds\r\n\u8f93\u5165\u6240\u5728\u7684\u90e8\u95e8\uff1atech\r\n\u8f93\u5165\u4e3b\u673a\u7684\u540d\u79f0\uff1aca.ywnds.com(\u6b64\u4e3b\u673a\u540d\u8981\u8ddf\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u4fdd\u6301\u4e00\u81f4\uff1b\u5ba2\u6237\u7aef\u8bbf\u95ee\u4e3b\u673a\u65f6\u5fc5\u987b\u8981\u901a\u8fc7\u8fd9\u4e2a\u4e3b\u673a\u540d\u624d\u80fd\u5efa\u7acb\u8fde\u63a5\u5426\u5219\u8bf4\u8bc1\u4e66\u4e0d\u53ef\u4fe1)\r\n\u8f93\u5165E-mail\uff1aadmin@ywnds.com\r\n<\/pre>\n

\u4e3aCA\u521b\u5efa\u4e00\u4e9b\u76ee\u5f55\u548c\u6587\u4ef6<\/p>\n

\r\n[root@localhost ~]# mkdir \/etc\/pki\/CA\/{certs,newcerts,crl}\r\n[root@localhost ~]# touch \/etc\/pki\/CA\/{index.txt,serial}\r\n[root@localhost ~]# echo 01 > \/etc\/pki\/CA\/serial\r\n<\/pre>\n

\u90ae\u4ef6\u670d\u52a1\u5668\u751f\u6210\u8bc1\u4e66<\/p>\n

\r\n[root@localhost ~]# mkdir \/etc\/dovecot\/ssl\r\n[root@localhost ~]# openssl genrsa -out \/etc\/dovecot\/ssl\/dovecot.key 1024\r\n[root@localhost ~]# opensslreq -new -key \/etc\/dovecot\/ssl\/dovecot.key -out \/etc\/dovecot\/ssl\/dovecot.csr\r\n[\u8f93\u5165\u7684\u4fe1\u606f\u4e00\u5b9a\u8981\u8ddfCA\u8f93\u5165\u7684\u4fe1\u606f\u4e00\u81f4\u56e0\u4e3a\u6211\u4eec\u521b\u5efa\u7684\u79c1\u6709CA]\r\n\u8f93\u5165\u56fd\u5bb6\u540d\u79f02\u4f4d\u7684\u4ee3\u7801\uff1acn\r\n\u8f93\u5165\u6240\u5728\u7701\u4efd\u7684\u540d\u79f0\uff1ashanghai\r\n\u8f93\u5165\u6240\u5728\u57ce\u5e02\u7684\u540d\u79f0\uff1ashanghai\r\n\u8f93\u5165\u516c\u53f8\u7684\u540d\u79f0\uff1aywnds\r\n\u8f93\u5165\u6240\u5728\u7684\u90e8\u95e8\uff1atech\r\n\u8f93\u5165\u4e3b\u673a\u7684\u540d\u79f0\uff1amail.ywnds.com(\u6b64\u4e3b\u673a\u540d\u8981\u8ddf\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u4fdd\u6301\u4e00\u81f4\uff1b\u5ba2\u6237\u7aef\u8bbf\u95ee\u4e3b\u673a\u65f6\u5fc5\u987b\u8981\u901a\u8fc7\u8fd9\u4e2a\u4e3b\u673a\u540d\u624d\u80fd\u5efa\u7acb\u8fde\u63a5\u5426\u5219\u8bf4\u8bc1\u4e66\u4e0d\u53ef\u4fe1)\r\n\u8f93\u5165E-mail\uff1aadmin@ywnds.com\r\n\u8bc1\u4e66\u5bc6\u7801\uff1a\r\n<\/pre>\n

\u5728CA\u670d\u52a1\u5668\u7b7e\u7f72\u8bc1\u4e66\u5e76\u53d1\u9001\u56de\u7ed9\u90ae\u4ef6\u670d\u52a1\u5668<\/p>\n

\r\n[root@localhost ~]# openssl ca -in \/etc\/dovecot\/ssl\/dovecot.csr -out \/etc\/dovecot\/ssl\/dovecot.crt -days 365\r\n<\/pre>\n

\u5728CA\u670d\u52a1\u5668\u4e0a\u67e5\u770b\u7b7e\u7f72\u8fc7\u540e\/etc\/pki\/CA\u4e0b\u7684\u6587\u4ef6\u53d1\u751f\u7684\u53d8\u5316<\/p>\n

\r\n[root@localhost ~]# cat \/etc\/pki\/CA\/index.txt\r\n[root@localhost ~]# cat \/etc\/pki\/CA\/serial <\/strong>\r\n<\/pre>\n
Dovecot\u5f00\u542fSSL<\/strong><\/div>\n
\r\n[root@localhost ~]# vim \/etc\/dovecot.conf\r\nprotocols pop pop3 imap imap4\r\n \r\n[root@localhost ~]# vim \/etc\/dovecot\/conf.d\/10-ssl.conf\r\nssl = yes\r\nssl_cert = \/etc\/dovecot\/ssl\/dovecot.crt\r\nssl_key = \/etc\/dovecot\/ssl\/dovecot.key\r\n \r\n[root@localhost ~]# service dovecot restart\r\n<\/pre>\n

MUA\u8fde\u63a5\u90ae\u4ef6\u670d\u52a1\u5668\u6ce8\u610f\u4e8b\u9879:<\/p>\n

1.\u628aCA\u7684\u8bc1\u4e66cacert.pem\u4e0b\u8f7d\u5230\u5ba2\u6237\u7aef\u6539\u540dcacert.crt\u5e76\u5b89\u88c5\u5230\u6839\u4fe1\u4efb\u57df\u3002<\/p>\n

2.\u5ba2\u6237\u7aef\u8fde\u63a5pop3s\u670d\u52a1\u5668\u65f6POP3s\u4f1a\u53d1\u6765\u8bc1\u4e66\uff0c\u6b64\u65f6CA\u8bc1\u4e66cacert.crt\u4f1a\u53bb\u9a8c\u8bc1POP3\u8bc1\u4e66\uff0c\u6ca1\u6709\u95ee\u9898\u5c31\u53ef\u4ee5\u4f20\u8f93\u90ae\u4ef6\u3002<\/p>\n

3.MUA\u5728\u8fde\u63a5POP3s\u670d\u52a1\u5668\u65f6\u8981\u4f7f\u7528\u57df\u540d\u4e0d\u80fd\u4f7f\u7528IP\u5730\u5740\uff0c\u56e0\u4e3a\u8981\u8ddf\u8bc1\u4e66\u4e2d\u7684\u4e3b\u673a\u540d\u5bf9\u5e94\uff0c\u4e0d\u7136\u8fd8\u662f\u4f1a\u4e0d\u53d7\u4fe1\u4efb\uff0c\u540c\u65f6\u5ba2\u6237\u7aef\u8981\u80fd\u89e3\u6790\u6b64\u57df\u540d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5176\u4e2d\u5728\u6574\u4e2a\u4e00\u5957\u90ae\u4ef6\u670d\u52a1\u5668\u4e2d\uff0c\u9ed8\u8ba4\u4fe1\u606f\u4f20\u8f93\u90fd\u662f\u660e\u6587\u4f20\u8f93\u7684\uff0c\u6240\u4ee5\u8fd9\u4e2a\u5728\u5b89\u5168\u6027\u4e0a\u9762\u5c31\u4e0d\u662f\u90a3\u4e48\u597d\u3002\u4f46\u662f\u5982\u679c\u8bf4\u4e00\u5c01\u90ae\u4ef6\u4ece […]<\/p>\n","protected":false},"author":668,"featured_media":131136,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-131134","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/131134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/668"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=131134"}],"version-history":[{"count":3,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/131134\/revisions"}],"predecessor-version":[{"id":132915,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/131134\/revisions\/132915"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/131136"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=131134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=131134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=131134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}