{"id":12864,"date":"2024-01-06T17:00:06","date_gmt":"2024-01-06T09:00:06","guid":{"rendered":"http:\/\/www.aiersheng.cc\/?p=12864"},"modified":"2025-01-06T17:20:37","modified_gmt":"2025-01-06T09:20:37","slug":"centos-7-9-%e6%90%ad%e5%bb%ba-postfix-%e9%82%ae%e4%bb%b6%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.aiersheng.cc\/?p=12864","title":{"rendered":"CentOS 7.9 \u642d\u5efa Postfix \u90ae\u4ef6\u670d\u52a1\u5668"},"content":{"rendered":"<h3>CentOS 7.9 \u642d\u5efa Postfix \u90ae\u4ef6\u670d\u52a1\u5668<\/h3>\n<h4>\u4e00\u3001\u5b89\u88c5 DNS<\/h4>\n<p>\u5728\u642d\u5efa\u90ae\u4ef6\u670d\u52a1\u5668\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5\u548c\u914d\u7f6e DNS \u670d\u52a1\uff0c\u56e0\u4e3a\u90ae\u4ef6\u7cfb\u7edf\u4f9d\u8d56 DNS \u6765\u8fdb\u884c\u57df\u540d\u89e3\u6790\u548c\u53cd\u5411\u89e3\u6790\u3002\u4ee5\u4e0b\u6b65\u9aa4\u8bf4\u660e\u5982\u4f55\u5728 CentOS 7.9 \u4e0a\u5b89\u88c5\u5e76\u914d\u7f6e DNS \u670d\u52a1\u3002<\/p>\n<h5>1. \u5b89\u88c5 DNS \u670d\u52a1<\/h5>\n<p>\u4f7f\u7528 <code>yum<\/code> \u5b89\u88c5 <code>bind<\/code> \u548c\u76f8\u5173\u5de5\u5177\u3002<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">[root@localhost ~]<span class=\"hljs-comment\"># yum -y install bind bind-utils bind-chroot<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<ul>\n<li><strong>bind<\/strong>\uff1a\u8fd9\u662f\u7528\u4e8e\u57df\u540d\u89e3\u6790\u7684 DNS \u670d\u52a1\u5668\u3002<\/li>\n<li><strong>bind-utils<\/strong>\uff1a\u63d0\u4f9b\u4e00\u4e9b\u5e38\u7528\u7684\u5de5\u5177\uff0c\u5982 <code>dig<\/code> \u548c <code>nslookup<\/code>\uff0c\u7528\u4e8e DNS \u67e5\u8be2\u548c\u8c03\u8bd5\u3002<\/li>\n<li><strong>bind-chroot<\/strong>\uff1a\u63d0\u4f9b\u5c06 <code>bind<\/code> \u8fd0\u884c\u5728 chroot \u73af\u5883\u4e2d\u7684\u9009\u9879\uff0c\u4ee5\u63d0\u9ad8\u5b89\u5168\u6027\u3002<\/li>\n<\/ul>\n<h5>2. \u914d\u7f6e DNS<\/h5>\n<p>\u914d\u7f6e\u5b8c\u5b89\u88c5\u5305\u540e\uff0c\u9700\u8981\u5bf9 DNS \u670d\u52a1\u8fdb\u884c\u4e00\u4e9b\u914d\u7f6e\uff0c\u786e\u4fdd\u5b83\u80fd\u591f\u6b63\u786e\u89e3\u6790\u57df\u540d\u3002<\/p>\n<p>1\uff09\u4fee\u6539 <strong>bind<\/strong> \u4e3b\u914d\u7f6e\u6587\u4ef6 <code>\/etc\/named.conf<\/code>\uff1a<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">[root@localhost ~]<span class=\"hljs-comment\"># sed -i -e 's\/127.0.0.1\/any\/' -e 's\/localhost\/any\/' \/etc\/named.conf<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<p>\u8fd9\u91cc\u7684\u64cd\u4f5c\u5c06 <code>bind<\/code> \u914d\u7f6e\u4e3a\u76d1\u542c\u6240\u6709 IP \u5730\u5740\uff0c\u800c\u4e0d\u4ec5\u4ec5\u662f <code>127.0.0.1<\/code>\uff08\u672c\u5730\u5730\u5740\uff09\uff0c\u4ee5\u4fbf\u5916\u90e8\u4e5f\u80fd\u8bbf\u95ee\u3002<\/p>\n<h5>3. \u914d\u7f6e\u6b63\u5411\u89e3\u6790<\/h5>\n<p>\u5728 DNS \u914d\u7f6e\u4e2d\uff0c\u9700\u8981\u8bbe\u7f6e\u6b63\u5411\u89e3\u6790\uff0c\u4ee5\u4fbf\u901a\u8fc7\u57df\u540d\u89e3\u6790 IP \u5730\u5740\u3002\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<p>1\uff09\u914d\u7f6e <strong>named.rfc1912.zones<\/strong> \u6587\u4ef6\uff1a<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">[root@localhost ~]<span class=\"hljs-comment\"># vim \/etc\/named.rfc1912.zones<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<p>\u5728\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\u6765\u5b9a\u4e49\u6b63\u5411\u89e3\u6790\u7684\u533a\u57df\uff1a<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">zone <span class=\"hljs-string\">\"yangxingzhen.net\"<\/span> IN {<br \/>\n\t<span class=\"hljs-built_in\">type<\/span> master;<br \/>\n\tfile <span class=\"hljs-string\">\"yangxingzhen.net.zone\"<\/span>;<br \/>\n\tallow-update { none; };<br \/>\n};<\/p>\n<p>zone <span class=\"hljs-string\">\"3.168.192.in-addr.arpa\"<\/span> IN {<br \/>\n\t<span class=\"hljs-built_in\">type<\/span> master;<br \/>\n\tfile <span class=\"hljs-string\">\"192.168.3.arpa\"<\/span>;<br \/>\n\tallow-update { none; };<br \/>\n};<br \/>\n<\/code><\/div>\n<\/div>\n<ul>\n<li><strong>zone &#8220;yangxingzhen.net&#8221;<\/strong>\uff1a\u8bbe\u7f6e\u57df\u540d <code>yangxingzhen.net<\/code> \u7684\u6b63\u5411\u89e3\u6790\u533a\u57df\uff0c\u89e3\u6790\u8be5\u57df\u540d\u4e0b\u7684\u4e3b\u673a\u3002<\/li>\n<li><strong>zone &#8220;3.168.192.in-addr.arpa&#8221;<\/strong>\uff1a\u914d\u7f6e\u8be5\u5b50\u7f51\u7684\u53cd\u5411\u89e3\u6790\u533a\u57df\uff0c\u901a\u5e38\u7528\u4e8e\u5c06 IP \u5730\u5740\u6620\u5c04\u56de\u57df\u540d\uff08\u53cd\u5411 DNS\uff09\u3002<\/li>\n<\/ul>\n<p>\u901a\u8fc7\u914d\u7f6e\u8fd9\u4e9b\u533a\u57df\uff0cDNS \u670d\u52a1\u5668\u5c06\u80fd\u591f\u8fdb\u884c\u6b63\u5e38\u7684\u57df\u540d\u89e3\u6790\u548c\u53cd\u5411\u89e3\u6790\u3002<\/p>\n<h5>4. \u521b\u5efa DNS \u533a\u57df\u6587\u4ef6<\/h5>\n<p>1\uff09\u4e3a\u6b63\u5411\u89e3\u6790\u521b\u5efa <strong>yangxingzhen.net.zone<\/strong> \u6587\u4ef6\uff1a<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">[root@localhost ~]<span class=\"hljs-comment\"># vim \/var\/named\/yangxingzhen.net.zone<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<p>\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\"><span class=\"hljs-variable\">$TTL<\/span> 86400<br \/>\n@ IN SOA ns1.yangxingzhen.net. root.yangxingzhen.net. (<br \/>\n  2024010101 ; Serial<br \/>\n  3600 ; Refresh<br \/>\n  1800 ; Retry<br \/>\n  1209600 ; Expire<br \/>\n  86400 ) ; Minimum TTL<\/p>\n<p>@ IN NS ns1.yangxingzhen.net.<br \/>\n@ IN A 192.168.3.10<br \/>\nwww IN A 192.168.3.10<br \/>\n<\/code><\/div>\n<\/div>\n<ul>\n<li><strong>SOA<\/strong>\uff08Start of Authority\uff09\u8bb0\u5f55\u5b9a\u4e49\u4e86 DNS \u533a\u57df\u7684\u8d77\u59cb\u70b9\u3002<\/li>\n<li><strong>NS<\/strong> \u8bb0\u5f55\u6307\u5b9a\u8be5\u57df\u540d\u7684 DNS \u670d\u52a1\u5668\u3002<\/li>\n<li><strong>A<\/strong> \u8bb0\u5f55\u5c06\u4e3b\u673a\u540d\u6620\u5c04\u5230 IP \u5730\u5740\uff0c<code>www<\/code> \u89e3\u6790\u4e3a <code>192.168.3.10<\/code>\u3002<\/li>\n<\/ul>\n<p>2\uff09\u4e3a\u53cd\u5411\u89e3\u6790\u521b\u5efa <strong>192.168.3.arpa<\/strong> \u6587\u4ef6\uff1a<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">[root@localhost ~]<span class=\"hljs-comment\"># vim \/var\/named\/192.168.3.arpa<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<p>\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\"><span class=\"hljs-variable\">$TTL<\/span> 86400<br \/>\n@ IN SOA ns1.yangxingzhen.net. root.yangxingzhen.net. (<br \/>\n  2024010101 ; Serial<br \/>\n  3600 ; Refresh<br \/>\n  1800 ; Retry<br \/>\n  1209600 ; Expire<br \/>\n  86400 ) ; Minimum TTL<\/p>\n<p>@ IN NS ns1.yangxingzhen.net.<br \/>\n10 IN PTR www.yangxingzhen.net.<br \/>\n<\/code><\/div>\n<\/div>\n<ul>\n<li><strong>PTR<\/strong> \u8bb0\u5f55\u7528\u4e8e\u53cd\u5411\u89e3\u6790\uff0c<code>10 IN PTR www.yangxingzhen.net.<\/code> \u8868\u793a IP \u5730\u5740 <code>192.168.3.10<\/code> \u5bf9\u5e94 <code>www.yangxingzhen.net<\/code>\u3002<\/li>\n<\/ul>\n<h5>5. \u542f\u52a8\u5e76\u9a8c\u8bc1 DNS \u670d\u52a1<\/h5>\n<p>1\uff09\u542f\u7528\u5e76\u542f\u52a8 <strong>named<\/strong> \u670d\u52a1\uff1a<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">[root@localhost ~]<span class=\"hljs-comment\"># systemctl enable named<\/span><br \/>\n[root@localhost ~]<span class=\"hljs-comment\"># systemctl start named<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<p>2\uff09\u68c0\u67e5 DNS \u670d\u52a1\u662f\u5426\u6b63\u5e38\u8fd0\u884c\uff1a<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">[root@localhost ~]<span class=\"hljs-comment\"># systemctl status named<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<p>\u5982\u679c\u670d\u52a1\u542f\u52a8\u6210\u529f\uff0cDNS \u914d\u7f6e\u5df2\u6b63\u786e\u751f\u6548\u3002<\/p>\n<p>3\uff09\u4f7f\u7528 <code>dig<\/code> \u6216 <code>nslookup<\/code> \u5de5\u5177\u68c0\u67e5 DNS \u914d\u7f6e\uff1a<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">[root@localhost ~]<span class=\"hljs-comment\"># dig yangxingzhen.net<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<p>\u6b64\u547d\u4ee4\u5c06\u8fd4\u56de <code>yangxingzhen.net<\/code> \u57df\u540d\u7684\u89e3\u6790\u4fe1\u606f\u3002<\/p>\n<h4>\u4e8c\u3001\u5b89\u88c5 Postfix \u90ae\u4ef6\u670d\u52a1\u5668<\/h4>\n<p>\u5b89\u88c5\u548c\u914d\u7f6e <strong>Postfix<\/strong> \u90ae\u4ef6\u670d\u52a1\u5668\u662f\u642d\u5efa\u90ae\u4ef6\u7cfb\u7edf\u7684\u6838\u5fc3\u90e8\u5206\u3002Postfix \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u90ae\u4ef6\u4f20\u8f93\u4ee3\u7406\uff08MTA\uff09\uff0c\u7528\u4e8e\u53d1\u9001\u3001\u63a5\u6536\u548c\u8f6c\u53d1\u90ae\u4ef6\u3002\u5b83\u4e0e\u5176\u4ed6 MTA\uff08\u5982 Sendmail\uff09\u76f8\u6bd4\uff0c\u56e0\u5176\u5b89\u5168\u6027\u3001\u6027\u80fd\u548c\u6613\u914d\u7f6e\u800c\u5e7f\u6cdb\u4f7f\u7528\u3002<\/p>\n<h5>1. \u5b89\u88c5 Postfix<\/h5>\n<p>\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u7684\u7cfb\u7edf\u8f6f\u4ef6\u5305\u5df2\u66f4\u65b0\uff0c\u7136\u540e\u5b89\u88c5 <strong>Postfix<\/strong>\u3002<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">[root@localhost ~]<span class=\"hljs-comment\"># yum -y update<\/span><br \/>\n[root@localhost ~]<span class=\"hljs-comment\"># yum -y install postfix<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u542f\u7528\u5e76\u542f\u52a8 Postfix \u670d\u52a1\u3002<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">[root@localhost ~]<span class=\"hljs-comment\"># systemctl enable postfix<\/span><br \/>\n[root@localhost ~]<span class=\"hljs-comment\"># systemctl start postfix<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<p>\u68c0\u67e5 Postfix \u670d\u52a1\u72b6\u6001\uff0c\u786e\u4fdd\u5b83\u6b63\u5728\u8fd0\u884c\u3002<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">[root@localhost ~]<span class=\"hljs-comment\"># systemctl status postfix<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<h5>2. \u914d\u7f6e Postfix<\/h5>\n<p>Postfix \u5b89\u88c5\u540e\uff0c\u914d\u7f6e\u6587\u4ef6\u901a\u5e38\u4f4d\u4e8e <code>\/etc\/postfix\/main.cf<\/code>\u3002\u4f60\u9700\u8981\u6839\u636e\u4f60\u7684\u9700\u6c42\u5bf9\u5176\u8fdb\u884c\u4fee\u6539\u3002<\/p>\n<p>1\uff09\u7f16\u8f91 <strong>main.cf<\/strong> \u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">[root@localhost ~]<span class=\"hljs-comment\"># vim \/etc\/postfix\/main.cf<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<p>\u786e\u4fdd\u914d\u7f6e\u6587\u4ef6\u4e2d\u5305\u542b\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\"><span class=\"hljs-comment\"># \u8bbe\u7f6e\u57df\u540d<\/span><br \/>\nmyhostname = mail.yangxingzhen.net<\/p>\n<p><span class=\"hljs-comment\"># \u914d\u7f6e\u90ae\u4ef6\u57df\u540d<\/span><br \/>\nmydomain = yangxingzhen.net<\/p>\n<p><span class=\"hljs-comment\"># \u914d\u7f6e\u90ae\u4ef6\u7cfb\u7edf\u7684\u4e3b\u673a\u540d<\/span><br \/>\nmyorigin = <span class=\"hljs-variable\">$mydomain<\/span><br \/>\n<span class=\"hljs-comment\"># \u5141\u8bb8\u7684\u57df\u540d\u548c\u90ae\u4ef6\u4e2d\u7ee7<\/span><br \/>\nmydestination = <span class=\"hljs-variable\">$myhostname<\/span>, localhost.<span class=\"hljs-variable\">$mydomain<\/span>, localhost, <span class=\"hljs-variable\">$mydomain<\/span><br \/>\n<span class=\"hljs-comment\"># \u90ae\u4ef6\u4f20\u8f93\u4ee3\u7406\u534f\u8bae<\/span><br \/>\ninet_interfaces = all<\/p>\n<p><span class=\"hljs-comment\"># \u90ae\u4ef6\u4ea4\u6362\uff08MX\uff09\u670d\u52a1\u5668\u8bbe\u7f6e<\/span><br \/>\nmynetworks = 127.0.0.0\/8 [::1]\/128<\/p>\n<p><span class=\"hljs-comment\"># \u914d\u7f6eSMTP\u7aef\u53e3<\/span><br \/>\nsmtp_tls_security_level = may<br \/>\nsmtp_tls_loglevel = 1<\/p>\n<p><span class=\"hljs-comment\"># \u914d\u7f6e Postfix SMTP \u8ba4\u8bc1<\/span><br \/>\nsmtpd_tls_security_level = may<br \/>\nsmtpd_tls_cert_file = \/etc\/ssl\/certs\/mail.crt<br \/>\nsmtpd_tls_key_file = \/etc\/ssl\/private\/mail.key<br \/>\n<\/code><\/div>\n<\/div>\n<p>\u89e3\u91ca\uff1a<\/p>\n<ul>\n<li><strong>myhostname<\/strong>\uff1a\u8bbe\u7f6e\u90ae\u4ef6\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\uff0c\u901a\u5e38\u662f\u4f60\u57df\u540d\u7684\u5b50\u57df\u540d\uff0c\u5982 <code>mail.yangxingzhen.net<\/code>\u3002<\/li>\n<li><strong>mydomain<\/strong>\uff1a\u8bbe\u7f6e\u90ae\u4ef6\u670d\u52a1\u5668\u7684\u57df\u540d\u3002<\/li>\n<li><strong>mydestination<\/strong>\uff1a\u6307\u5b9a\u5141\u8bb8\u63a5\u53d7\u90ae\u4ef6\u7684\u57df\u540d\uff0c\u901a\u5e38\u662f\u90ae\u4ef6\u670d\u52a1\u5668\u672c\u8eab\u53ca\u5176\u57df\u540d\u3002<\/li>\n<li><strong>inet_interfaces<\/strong>\uff1a\u51b3\u5b9a\u90ae\u4ef6\u670d\u52a1\u5668\u76d1\u542c\u7684\u63a5\u53e3\uff0c\u8bbe\u7f6e\u4e3a <code>all<\/code> \u8868\u793a\u6240\u6709\u63a5\u53e3\u3002<\/li>\n<li><strong>mynetworks<\/strong>\uff1a\u8bbe\u7f6e\u5141\u8bb8\u4e0e\u672c\u673a\u901a\u4fe1\u7684\u7f51\u7edc\uff08\u5982 localhost \u548c\u5c40\u57df\u7f51 IP\uff09\u3002<\/li>\n<li><strong>smtp_tls_security_level<\/strong> \u548c <strong>smtpd_tls_security_level<\/strong>\uff1a\u914d\u7f6e SSL\/TLS \u52a0\u5bc6\u4f20\u8f93\u90ae\u4ef6\u3002<\/li>\n<\/ul>\n<h5>3. \u914d\u7f6e\u90ae\u4ef6\u7528\u6237\u548c\u90ae\u7bb1<\/h5>\n<p>1\uff09\u521b\u5efa\u90ae\u4ef6\u7528\u6237\uff1a<\/p>\n<p>\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u5728\u7cfb\u7edf\u4e0a\u521b\u5efa\u4e86\u9002\u5f53\u7684\u7528\u6237\u5e10\u6237\u3002\u6bcf\u4e2a\u7528\u6237\u5c06\u5bf9\u5e94\u4e00\u4e2a\u90ae\u7bb1\u3002<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">[root@localhost ~]<span class=\"hljs-comment\"># useradd user1<\/span><br \/>\n[root@localhost ~]<span class=\"hljs-comment\"># passwd user1<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<p>2\uff09\u4e3a\u6bcf\u4e2a\u7528\u6237\u521b\u5efa\u90ae\u7bb1\uff1a<\/p>\n<p>\u521b\u5efa\u90ae\u7bb1\u7684\u65b9\u5f0f\u901a\u5e38\u662f\u901a\u8fc7\u521b\u5efa\u5bf9\u5e94\u7684\u76ee\u5f55\u3002\u4f8b\u5982\uff0c\u4e3a <code>user1<\/code> \u521b\u5efa\u4e00\u4e2a\u90ae\u7bb1\u76ee\u5f55\uff1a<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">[root@localhost ~]<span class=\"hljs-comment\"># mkdir \/var\/spool\/mail\/user1<\/span><br \/>\n[root@localhost ~]<span class=\"hljs-comment\"># chown user1:user1 \/var\/spool\/mail\/user1<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<h5>4. \u914d\u7f6e\u9632\u706b\u5899<\/h5>\n<p>\u5982\u679c\u7cfb\u7edf\u542f\u7528\u4e86\u9632\u706b\u5899\uff0c\u786e\u4fdd\u5141\u8bb8\u90ae\u4ef6\u670d\u52a1\u5668\u7684\u7aef\u53e3\uff08\u5982 <strong>25<\/strong>\u3001<strong>587<\/strong>\u3001<strong>465<\/strong>\uff09\u901a\u8fc7\u3002\u4f7f\u7528 <code>firewalld<\/code> \u6216 <code>iptables<\/code> \u914d\u7f6e\u9632\u706b\u5899\u89c4\u5219\u3002<\/p>\n<p>1\uff09\u5141\u8bb8 Postfix \u4f7f\u7528\u7684\u7aef\u53e3\uff1a<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">[root@localhost ~]<span class=\"hljs-comment\"># firewall-cmd --permanent --add-service=smtp<\/span><br \/>\n[root@localhost ~]<span class=\"hljs-comment\"># firewall-cmd --permanent --add-service=smtp-submission<\/span><br \/>\n[root@localhost ~]<span class=\"hljs-comment\"># firewall-cmd --permanent --add-port=587\/tcp<\/span><br \/>\n[root@localhost ~]<span class=\"hljs-comment\"># firewall-cmd --reload<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<p>2\uff09\u786e\u8ba4\u9632\u706b\u5899\u89c4\u5219\u751f\u6548\uff1a<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">[root@localhost ~]<span class=\"hljs-comment\"># firewall-cmd --list-all<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<h5>5. \u914d\u7f6e SSL\/TLS\uff08\u53ef\u9009\uff09<\/h5>\n<p>\u5982\u679c\u4f60\u60f3\u52a0\u5bc6\u90ae\u4ef6\u7684\u4f20\u8f93\uff0c\u751f\u6210\u6216\u4f7f\u7528 SSL\/TLS \u8bc1\u4e66\u6765\u52a0\u5bc6 SMTP \u8fde\u63a5\u3002<\/p>\n<p>1\uff09\u751f\u6210 SSL \u8bc1\u4e66\uff08\u53ef\u4f7f\u7528 Let&#8217;s Encrypt \u7b49\u5de5\u5177\uff0c\u6216\u8005\u4f7f\u7528\u81ea\u7b7e\u540d\u8bc1\u4e66\uff09\uff1a<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">[root@localhost ~]<span class=\"hljs-comment\"># mkdir \/etc\/ssl\/private<\/span><br \/>\n[root@localhost ~]<span class=\"hljs-comment\"># openssl genpkey -algorithm RSA -out \/etc\/ssl\/private\/mail.key<\/span><br \/>\n[root@localhost ~]<span class=\"hljs-comment\"># openssl req -new -key \/etc\/ssl\/private\/mail.key -out \/etc\/ssl\/certs\/mail.csr<\/span><br \/>\n[root@localhost ~]<span class=\"hljs-comment\"># openssl x509 -req -days 365 -in \/etc\/ssl\/certs\/mail.csr -signkey \/etc\/ssl\/private\/mail.key -out \/etc\/ssl\/certs\/mail.crt<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<p>2\uff09\u7f16\u8f91 <strong>main.cf<\/strong> \u914d\u7f6e\u6587\u4ef6\uff0c\u6307\u5b9a\u8bc1\u4e66\u548c\u79c1\u94a5\u7684\u8def\u5f84\uff1a<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">smtpd_tls_cert_file = \/etc\/ssl\/certs\/mail.crt<br \/>\nsmtpd_tls_key_file = \/etc\/ssl\/private\/mail.key<br \/>\n<\/code><\/div>\n<\/div>\n<h5>6. \u6d4b\u8bd5\u90ae\u4ef6\u53d1\u9001\u548c\u63a5\u6536<\/h5>\n<p>\u4e00\u65e6\u5b8c\u6210\u4e86\u914d\u7f6e\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 <code>telnet<\/code> \u6216 <code>swaks<\/code> \u5de5\u5177\u8fdb\u884c\u6d4b\u8bd5\uff0c\u6216\u8005\u76f4\u63a5\u4f7f\u7528\u90ae\u4ef6\u5ba2\u6237\u7aef\u53d1\u9001\u548c\u63a5\u6536\u90ae\u4ef6\u3002<\/p>\n<p>1\uff09\u4f7f\u7528 <code>telnet<\/code> \u6d4b\u8bd5 SMTP \u8fde\u63a5\uff1a<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\" aria-label=\"\u590d\u5236\">\u590d\u5236\u4ee3\u7801<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">[root@localhost ~]<span class=\"hljs-comment\"># telnet mail.yangxingzhen.net 25<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<p>\u5982\u679c\u80fd\u6210\u529f\u8fde\u63a5\u5e76\u5f00\u59cb\u4ea4\u4e92\uff0c\u8bf4\u660e Postfix \u914d\u7f6e\u6b63\u5e38\u3002<\/p>\n<p>2\uff09\u4ece\u5ba2\u6237\u7aef\u53d1\u9001\u90ae\u4ef6\uff1a<\/p>\n<p>\u914d\u7f6e\u4f60\u7684\u90ae\u4ef6\u5ba2\u6237\u7aef\uff08\u5982 Outlook \u6216 Thunderbird\uff09\u6307\u5411\u4f60\u7684\u90ae\u4ef6\u670d\u52a1\u5668\uff0c\u5e76\u5c1d\u8bd5\u53d1\u9001\u548c\u63a5\u6536\u90ae\u4ef6\u3002<\/p>\n<hr \/>\n<h4>\u4e09\u3001\u603b\u7ed3<\/h4>\n<p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u4f60\u5df2\u7ecf\u5728 CentOS 7.9 \u7cfb\u7edf\u4e0a\u642d\u5efa\u4e86\u4e00\u4e2a\u57fa\u672c\u7684 Postfix \u90ae\u4ef6\u670d\u52a1\u5668\u3002\u6b64\u90ae\u4ef6\u670d\u52a1\u5668\u914d\u7f6e\u4e86 DNS \u89e3\u6790\u3001Postfix \u5b89\u88c5\u548c\u57fa\u672c\u914d\u7f6e\u3001\u4ee5\u53ca SSL\/TLS \u52a0\u5bc6\u4f20\u8f93\u548c\u9632\u706b\u5899\u8bbe\u7f6e\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e\u66f4\u591a\u7684\u9ad8\u7ea7\u7279\u6027\uff08\u5982\u5783\u573e\u90ae\u4ef6\u8fc7\u6ee4\u3001SPF\u3001DKIM \u7b49\uff09\u6765\u8fdb\u4e00\u6b65\u589e\u5f3a\u90ae\u4ef6\u670d\u52a1\u5668\u7684\u529f\u80fd\u548c\u5b89\u5168\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CentOS 7.9 \u642d\u5efa Postfi&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[68],"tags":[],"class_list":["post-12864","post","type-post","status-publish","format-standard","hentry","category-zzjy"],"_links":{"self":[{"href":"https:\/\/www.aiersheng.cc\/index.php?rest_route=\/wp\/v2\/posts\/12864","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aiersheng.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aiersheng.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aiersheng.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aiersheng.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12864"}],"version-history":[{"count":0,"href":"https:\/\/www.aiersheng.cc\/index.php?rest_route=\/wp\/v2\/posts\/12864\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.aiersheng.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12864"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aiersheng.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12864"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aiersheng.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12864"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}