{"id":3146,"date":"2024-12-05T21:21:17","date_gmt":"2024-12-05T13:21:17","guid":{"rendered":"https:\/\/jir.idv.tw\/wordpress\/?p=3146"},"modified":"2024-12-05T21:21:58","modified_gmt":"2024-12-05T13:21:58","slug":"postfix%e9%83%b5%e4%bb%b6%e4%bc%ba%e6%9c%8d%e5%99%a8%ef%bc%8c%e6%9e%b6%e8%a8%admailscanner%e5%8f%af%e8%83%bd%e6%9c%83%e9%81%87%e5%88%b0opendkim%e8%a1%9d%e7%aa%81%e7%9a%84%e8%a7%a3%e6%b1%ba%e6%96%b9","status":"publish","type":"post","link":"https:\/\/jir.idv.tw\/wordpress\/?p=3146","title":{"rendered":"POSTFIX\u90f5\u4ef6\u4f3a\u670d\u5668\uff0c\u67b6\u8a2dMailscanner\u53ef\u80fd\u6703\u9047\u5230OpenDKIM\u885d\u7a81\u7684\u89e3\u6c7a\u65b9\u6cd5"},"content":{"rendered":"<p>\u9019\u4e00\u500b\u79ae\u62dc\u6642\u9593\uff0c\u88ab\u81ea\u5df1\u628a\u81ea\u5df1\u641e\u50bb\u4e86&#8230;<br \/>\n\u597d\u4e0d\u5bb9\u6613\u628a<a href=\"https:\/\/github.com\/MailScanner\/v5\/\" target=\"_blank\" rel=\"noopener\">Mailscanner<\/a>\u6574\u5408Clamav\u6383\u6bd2\u548cspamassassin\u9632\u5783\u573e\u4fe1\u7684\u5957\u4ef6\u67b6\u8a2d\u597d\uff0c\u5f37\u5316POSTFIX\u90f5\u4ef6\u4f3a\u670d\u5668\u7684\u529f\u80fd\u6027\u3002<br \/>\n\u537b\u53c8\u9047\u5230\u5361\u95dc\uff0c\u56e0\u70baMailscanner\u904e\u6ffe\u6703\u628aHeader\u683c\u5f0f\u7834\u58de\uff0c\u6703\u5f71\u97ff\u5230OpenDKIM\u7684\u7c3d\u540d\u8a8d\u8b49\uff0c\u9020\u6210\u5916\u9762\u4fe1\u7bb1\u670d\u52d9\u7684\u7db2\u7ad9\u90fd\u6703\u62d2\u7d55\u6536\u4fe1\u3002<br \/>\n\u82b1\u4e86\u5f88\u5927\u7684\u529b\u6c23\u518dGOOGLE\u627e\u7b54\u6848\u3001\u554fCHATGPT\uff0c\u6709\u9650\u7684\u77e5\u8b58\u548c\u7834\u82f1\u6587\uff0c\u4e00\u76f4\u7121\u6cd5\u9806\u5229\u5f04\u51fa\u6b63\u5e38\u7684\u529f\u80fd\u3002<\/p>\n<p>\u6700\u7d42\uff0c\u9084\u662f\u8b93\u6211\u641e\u61c2\u3001\u641e\u52d5POSFIX + OpenDKIM + Mailscanner\u5de5\u4f5c\u4e86\u3002<br \/>\n\u8d81\u73fe\u5728\u8a18\u61b6\u7336\u65b0\uff0c\u8d95\u5feb\u7d00\u9304\u4e00\u4e0b\u76f8\u95dc\u7d30\u7bc0\uff0c\u4ee5\u5f8c\u9047\u5230\u91cd\u704c\u6216\u67b6\u8a2d\uff0c\u81f3\u5c11\u9084\u80fd\u7d66\u81ea\u5df1\u7b46\u8a18\u3002<br \/>\n<!--more--><br \/>\n*** POSTFIX\u90e8\u5206\uff1a<br \/>\n\u56e0\u70ba\u6211\u7684\u88dd\u6cd5\u4e0d\u662f\u7528\u5b98\u7db2\u5efa\u8b70\u7684milter\u8a2d\u5b9a\uff0c\u800c\u662f\u5927\u90e8\u5206\u7db2\u7ad9\u8aaa\u660e\u7684\u3002<br \/>\n\u7528\/etc\/postfix\/header_checks\uff0c\u65b0\u589e\u4e00\u884c<strong>\/^Received:\/ HOLD<\/strong>\u555f\u7528\u529f\u80fd\u3002<br \/>\n\u9019\u500b\u6642\u5019\/etc\/postfix\/main.cf\u8a2d\u5b9a\u6a94\u8981\u7559\u610f\u547c\u53eb\u7684\u5148\u5f8c\u9806\u5e8f\u3002<br \/>\nDKIM\u7684\u8a8d\u8b49\u7c3d\u540d\u8981\u5148\u8b93POSTFIX\u8655\u7406\uff0c\u6700\u5f8c\u624d\u662f\u653e\u5230Mailscanner\u8655\u7406\u7684hold\u5f85\u6383\u63cf\u72c0\u614b\u3002<br \/>\n<code>...(\u4ee5\u4e0a\u7565)<br \/>\n### openDKIM \u9019\u500b\u8981\u5148\u547c\u53eb\u57f7\u884c<br \/>\nmilter_default_action = accept<br \/>\nmilter_protocol = 6<br \/>\n### openDKIM + OpenDMARC<br \/>\nsmtpd_milters = inet:localhost:8891, local:opendmarc\/opendmarc.sock<br \/>\nnon_smtpd_milters = $smtpd_milters<br \/>\n...(\u4e2d\u9593\u7565)<br \/>\n### Mailscanner function active \u9019\u500b\u653e\u5728\u6b64\u6a94\u6848\u6700\u5f8c\u9762\u547c\u53eb<br \/>\nheader_checks = regexp:\/etc\/postfix\/header_checks<br \/>\n#body_checks = regexp:\/etc\/postfix\/body_checks<br \/>\n###<\/code><\/p>\n<p>*** OPENDKIM\u90e8\u5206\uff1a<br \/>\n\u56e0\u70baMailscanner\u6703\u7834\u58deheader\u683c\u5f0f\uff0c\u8b93\u8655\u7406\u7684\u7a0b\u5f0f\u6216\u4fe1\u4ef6\u95b1\u8b80\u8005\u770b\u5230\u5df2\u7d93\u6709\u6383\u904e\u5b89\u5168\u6838\u767c\u3002<br \/>\n\u70ba\u4e86\u4e0d\u8981\u8b93\u5b83\u4e5f\u628a DKIM-Signature:\u9019\u6bb5\u91cd\u8981\u7684\u8fa8\u8b58\u7528\u8a0a\u606f\u7d66\u7be9\u9664\u3002<br \/>\n\u8a2d\u5b9a\u6a94\/etc\/opendkim.conf\u8981\u628a\u9019\u6bb5#\u5ffd\u7565\u522a\u9664\u548c\u4fee\u6539\u4f7f\u7528\u53c3\u6578\uff0c\u624d\u80fd\u4e0d\u88ab\u8aa4\u6d88\u9664\u3002<br \/>\n<code># Commonly-used options; the commented-out versions show the defaults.<br \/>\n#Canonicalization\tsimple<br \/>\n### for Mailscanner adjustment<br \/>\nCanonicalization\trelaxed<br \/>\nMode\t\t\tsv<br \/>\nSubDomains\t\tyes<\/code><\/p>\n<p>*** MAILSCANNER\u90e8\u5206\uff1a<br \/>\n\u5927\u90e8\u5206\u770b\u5230\u7684\u8aaa\u660e\uff0c\u8981\u4fee\u6539\u9019\u4e09\u500b\u5730\u65b9\u3002\u4f46\u662f\u6383\u63cf\u901a\u904e\u5f8c\u7684\u4fe1\u5c3e\u7c3d\u540d\u6a94\uff0c\u76ee\u524d\u9019\u6a23\u8a2d\u5b9a\u5f8c\uff0c\u555f\u7528\u72c0\u614b\u4e26\u4e0d\u5f71\u97ffDKIM\u8a8d\u8b49\u884c\u7684\u683c\u5f0f\u7834\u58de\u3002<br \/>\n<code># What to do when you get several MailScanner headers in one message,<br \/>\n# from multiple MailScanner servers. Values are<br \/>\n#      \"append\"  : Append the new data to the existing header<br \/>\n#      \"add\"     : Add a new header<br \/>\n#      \"replace\" : Replace the old data with the new data<br \/>\n# Default is \"append\"<br \/>\n# This can also be the filename of a ruleset.<br \/>\n#Multiple Headers = append<br \/>\n### avoid DKIM breaking.<br \/>\nMultiple Headers = add<\/p>\n<p># Some people prefer that message headers are added in strict order with<br \/>\n# the newest headers at the top and the oldest headers at the bottom.<br \/>\n# This is also required if you receive a message which is authenticated by<br \/>\n# DKIM, and you are forwarding that message onto somewhere else, and want<br \/>\n# not to break the DKIM signature.<br \/>\n# **Note**: To avoid breaking DKIM signatures, you *must* also set<br \/>\n#   Multiple Headers = add<br \/>\n# So if some of your users forward mail from PayPal, Ebay or Yahoo! to<br \/>\n# accounts stored on Gmail or Googlemail, then you need to set this to \"yes\"<br \/>\n# and \"Multiple Headers = add\" to avoid breaking the DKIM signature.<br \/>\n# It may be worth using a ruleset to just apply this to messages sent by<br \/>\n# the companies mentioned above.<br \/>\n# This can also be the filename of a ruleset.<br \/>\n#Place New Headers At Top Of Message = no<br \/>\n### avoid broken DKIM<br \/>\nPlace New Headers At Top Of Message = yes<\/p>\n<p># Add the \"Inline HTML Signature\" or \"Inline Text Signature\" to the end<br \/>\n# of uninfected messages?<br \/>\n# If you add your own signature in your email application, and include the<br \/>\n# magic token \"_SIGNATURE_\" in your email message, the signature will be<br \/>\n# inserted just there, rather than at the end of the message.<br \/>\n# This can also be the filename of a ruleset.<br \/>\nSign Clean Messages = yes<br \/>\n### DKIM is not influenced here<br \/>\n#Sign Clean Messages = no<\/code><\/p>\n<p>\u9019\u4e09\u500b\u670d\u52d9\u8a2d\u5b9a\u6a94\u90fd\u4fee\u6539\u4ee5\u5f8c\uff0c\u8a18\u5f97\u91cd\u555fOPENDKIM\u3001MAILSCANNER\u3001POSTFIX\u3002<br \/>\n<code>sudo systemctl restart opendkim mailscanner postfix<\/code><\/p>\n<p>\u9664\u4e86\u81ea\u5df1\u5bc4\u7d66\u81ea\u5df1\u770b\u4fe1\u4ef6header\u5167\u5bb9\u6709\u7121\u6b63\u5e38\u4ee5\u5916\uff0c\u4ee5\u4e0b\u5169\u500b\u7db2\u7ad9\u53ef\u4ee5\u5e6b\u5fd9\u78ba\u8a8d\u4fe1\u7bb1\u4f3a\u670d\u5668\u548cDNS\u4f3a\u670d\u5668\u662f\u5426\u6709SPF\u3001DKIM\u7684\u8a2d\u5b9a\u6b63\u78ba\u72c0\u614b\u3002<br \/>\n\u6e2c\u8a66\u9a57\u8b49\u7684\u7db2\u7ad9\uff1a1. <a href=\"https:\/\/dkimvalidator.com\/\" target=\"_blank\" rel=\"noopener\">https:\/\/dkimvalidator.com\/<\/a> \u3001<br \/>\n2. <a href=\"https:\/\/mxtoolbox.com\/\" target=\"_blank\" rel=\"noopener\">https:\/\/mxtoolbox.com\/<\/a>\u3002<\/p>\n<p>\u7e3d\u4e4b\uff0c\u51fa\u73fe\u9019\u5169\u4f4d\u7f6e\u7684\u95dc\u9375\u5b57\u5c31\u6210\u529f\u4e86\uff0c\u4e5f\u61c9\u8a72\u4e0d\u6703\u518d\u88abGMAIL\u3001YAHOO\u6216HOTMAIL\u7684\u90f5\u4ef6\u4f3a\u670d\u5668\u9000\u4fe1\u4e86\u3002<br \/>\n<strong>X-Spam-Status<\/strong>: No<br \/>\n<strong>X-yoursite-MailScanner<\/strong>-From:<br \/>\nX-yoursite-MailScanner: Found to be clean<br \/>\nX-yoursite-MailScanner-ID:<br \/>\nX-yoursite-MailScanner-Information: Please contact the ISP for more information<br \/>\nReceived: from  (localhost [127.0.0.1])<br \/>\n\tby  (Postfix) with ESMTPSA id ;<br \/>\n\tThu,  5 Dec 2024 19:56:38 +0800 (CST)<br \/>\n<strong>DKIM-Signature:<\/strong> v=1; a=rsa-sha256; c=relaxed\/simple; d=; s=2024;<br \/>\n\tt=1733399798; i=@;<br \/>\n\tbh=AdvQ&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;lw=<br \/>\nMIME-Version: 1.0<br \/>\nDate: Thu, 05 Dec 2024 19:56:38 +0800<br \/>\nFrom: jir<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9019\u4e00\u500b\u79ae\u62dc\u6642\u9593\uff0c\u88ab\u81ea\u5df1\u628a\u81ea\u5df1\u641e\u50bb\u4e86&#8230; \u597d\u4e0d\u5bb9\u6613\u628aMailscanner\u6574\u5408Clamav\u6383\u6bd2\u548cspamassassin\u9632\u5783\u573e\u4fe1\u7684\u5957\u4ef6\u67b6\u8a2d\u597d\uff0c\u5f37\u5316POSTFIX\u90f5\u4ef6\u4f3a\u670d\u5668\u7684\u529f\u80fd\u6027\u3002 \u537b\u53c8\u9047\u5230\u5361\u95dc\uff0c\u56e0\u70baMailscanner\u904e\u6ffe\u6703\u628aHeader\u683c\u5f0f\u7834\u58de\uff0c\u6703\u5f71\u97ff\u5230OpenDKIM\u7684\u7c3d\u540d\u8a8d\u8b49\uff0c\u9020\u6210\u5916\u9762\u4fe1\u7bb1\u670d\u52d9\u7684\u7db2\u7ad9\u90fd\u6703\u62d2\u7d55\u6536\u4fe1\u3002 \u82b1\u4e86\u5f88\u5927\u7684\u529b\u6c23\u518dGOOGLE\u627e\u7b54\u6848\u3001\u554fCHATGPT\uff0c\u6709\u9650\u7684\u77e5\u8b58\u548c\u7834\u82f1\u6587\uff0c\u4e00\u76f4\u7121\u6cd5\u9806\u5229\u5f04\u51fa\u6b63\u5e38\u7684\u529f\u80fd\u3002 \u6700\u7d42\uff0c\u9084\u662f\u8b93\u6211\u641e\u61c2\u3001\u641e\u52d5POSFIX + OpenDKIM + Mailscanner\u5de5\u4f5c\u4e86\u3002 \u8d81\u73fe\u5728\u8a18\u61b6\u7336\u65b0\uff0c\u8d95\u5feb\u7d00\u9304\u4e00\u4e0b\u76f8\u95dc\u7d30\u7bc0\uff0c\u4ee5\u5f8c\u9047\u5230\u91cd\u704c\u6216\u67b6\u8a2d\uff0c\u81f3\u5c11\u9084\u80fd\u7d66\u81ea\u5df1\u7b46\u8a18\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[4],"tags":[],"class_list":["post-3146","post","type-post","status-publish","format-standard","hentry","category-4"],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/jir.idv.tw\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3146","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jir.idv.tw\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jir.idv.tw\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jir.idv.tw\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jir.idv.tw\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3146"}],"version-history":[{"count":2,"href":"https:\/\/jir.idv.tw\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3146\/revisions"}],"predecessor-version":[{"id":3148,"href":"https:\/\/jir.idv.tw\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3146\/revisions\/3148"}],"wp:attachment":[{"href":"https:\/\/jir.idv.tw\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jir.idv.tw\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jir.idv.tw\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}