milter-greylist ã«ã¾ã¤ãããã®ä»è«¸ã
æ¬å½ã¯ãã£ã¨æ©ãæ¸ããªãããããªãã£ãäºãªã©ã諸ã ã¨ã
è¨å®ãã¡ã¤ã«ã®æ´æ°
greylist.conf ã®å¤æ´å¾ã«ãmilter-greylist ã®åèµ·åã¯å¿ è¦ãªããmilter-greylist ã MTA ããã®è¦æ±ãåããæã«ãã¡ã¤ã«ãæ´æ°ããã¦ããã¨ãåæã«èªã¿è¾¼ããgreylist.conf ã®ã·ã³ã¿ãã¯ã¹ãééã£ã¦ããªããã確èªããã«ã¯ãmilter-greylist -cãã¨ããã°ãã§ãã¯ãã¦ãããã
ãããmilter-greylist ãæ»ãã ã
milter-greylist ã«éãããMTA ãã milter ãå¼ã³åºãã®ã«å¤±æããå ´åãsendmail ã®ããã©ã«ãã§ã¯*1å¼ã³åºããªãã£ãã®ã¨åãã«ãªããã¤ã¾ããã¡ã¼ã«ãå±ããªãã¨ããé 延ãããã¨ãããã¨ã¯ãªãããã®ä»£ããã大éã« spam ãåãåããã¨ã«ãªãã
ãã ããPostfix ã§ã®ããã©ã«ãã§ã¯ä¸æã¨ã©ã¼æ±ãã«ãªãï¼åç §ï¼Postfix設定パラメータ:milter_default_actionï¼ã
ãããgreylist.conf ã®è¨è¿°ã«ã·ã³ã¿ãã¯ã¹ã«ééãããã£ãå ´åãmilter-greylist ãã¨ã©ã¼ãè¿ããsendmail ã®ããã©ã«ããªã spam ãæµãã¦ãããã¨ã«ãªããPostfix ã®ããã©ã«ããªãã¨ã©ã¼ã®åå ã解æ¶ããã¾ã§ãä¸åã®ã¡ã¼ã«ãåãä»ããªããªãããªã®ã§ãgreylist.conf ãæ¸ãæããããmilter-greylist -cãã§ãã§ãã¯ãå¿ããã«*2ã
ããã©ã«ãã®å¤æ´
ç¹ã«æéã«é¢ããããã©ã«ãå¤ã¯ãPostgrey ã®æ¹ãé©åãªæãããããåã« timeoutï¼Greylist ã«å ¥ã£ã¦ãããåéãç¡ãã¦ãGreylist ããåé¤ãããã¾ã§ã®æéï¼ã 5 æ¥ã¨ããã®ã¯é·ããã¨æ¸ããããä»ã«ããã¤ãã調æ´ããæ¹ãè¯ãã¨æããã©ã¡ã¼ã¿ããã*3ã
delay
Greylist ã«å ¥ã£ã¦ãããåéãæå¦ããæéã ããããã©ã«ã 45 åã¯é·ããCentOS 5.4 ã§çæãã sendmail ã§ããã° 30 åãPostfix ã®ããã©ã«ãã 1000 ç§ï¼16 å 40 ç§ï¼ã ããã45 åã§ã¯æåã®åéãæå¦ãããå¯è½æ§ãé«ããå®éãï¼åç¨åº¦ã§åéãã¦ãããã®ãããã®ã§ãPostgrey ã®ããã©ã«ãã«åããã¦ï¼åã§è¯ãã¨æãã
delay 5m
autowhite
ããã©ã«ãã§ï¼æ¥ã ããããã¯ãmilter-greylist ã®ç¨¼åç¶æ³ã«ãã©ãã ãæ°ãé ããã«ããã¨æãã
ï¼æ¥ã«ï¼åã/var/lib/milter-greylist/db/greylist.db ãè¦ã¦ãåéã«ãã£ã¦åä¿¡ãããã¡ã¼ã«ã確èªããå ´åã ã¨ãautowhite ã¯ï¼æ¥ã§ãè¯ãã ãããåéã§æããã¦ã¡ã¼ã«ããæ¬æ¥ãåä¿¡ãã¹ãã¡ã¼ã«ã§ãã£ãã®ãªãã°ããã¯ã¤ããªã¹ãã«è¿½å ãã¦é 延ãçºçãããªãããããã°è¯ãããspam ã ã£ãããå°ã£ããªããã¨(^^;ã
greylist.db ã§èªåãã¯ã¤ããªã¹ãã«å ¥ã£ã¦ãããã®ã¯ã
- çããããããããã©ãåä¿¡ããã¡ã¼ã«
ã«ãªãããã ãããããã«ãªã¹ãã¢ãããããã±ã¼ã¹ãå°ãªããªãããã«ãACL ã調æ´ããã®ãè¯ãã
subnetmatch
大è¦æ¨¡ãªã¡ã¼ã«ãµã¼ãã¹ãªã©ã®å ´åãåéæã® IP ã¢ãã¬ã¹ã¯å¿ ãããä¸è´ããªããmilter-greylist ã®ããã©ã«ãã§ã¯ãIP ã¢ãã¬ã¹ãå®å ¨ã«ä¸è´ãã¦ããªãã¨ãåéã¨èªèãããªããããããPostgrey ã®ããã©ã«ãã«ä¼ããã¦ã24 bit ã®ããããã¹ã¯ã§è©ä¾¡ããããã«ãã¦ãããæ¹ãè¯ãã
subnetmatch /24
Tarpitting
Tarpitting ã¯ãTCP ã®ã³ãã¯ã·ã§ã³ãç¶æããã¾ã¾ããµã¼ãããã®å¿çã¡ãã»ã¼ã¸ãããã¨é ãããææ³ãVer 4.3.4 ã§ä½¿ããããã«ãªã£ã¦ãã*4ããã ããVer 4.3.x ã¯éçºçã¨ããä½ç½®ã¥ãã§ããã
ãã®æ¹æ³ã¯åççã«çã«ããªã£ã¦ãããã¨ããã®ã¯ãspam ãéãå´ã«ã¨ã£ã¦ã¯å¤§éã«ã¡ã¼ã«ãéãå¿ è¦ãããã®ã§ããç¡è¨é»è©±ãã®ãããªæéã¯ãã£ãããªããä¸æ¹ãé常㮠MTA ã§ããã°ãæ°åã¯ç¡è¨é»è©±ã®ã¾ã¾ã§ãå¹³æ°ã
ãã ãç¡è¨é»è©±ã§ãé»è©±ä»£ã¯èª²éãããã®ã¨åæ§ã«ãç¡éä¿¡ã§ã TCP ã®ã³ãã¯ã·ã§ã³ãå¼µã£ã¦ãã以ä¸ããµã¼ãã®ãªã½ã¼ã¹ãé£ã£ã¦ãããã¨ã«ãªããæ¬æ¥ã§ããã°ãï¼éã®ã¡ã¼ã«ã®çºã«ä¿æãã¦ããã³ãã¯ã·ã§ã³ãªãã¦ããµã¤ãºã大ãããªããã°ï¼ç§ã§çµãããã®ããååä½ã§æ®ããã¨ã«ãªãã
ãªã®ã§ãããã Greylisting ã¨åæ§ãS25R ã DNSBL ã§å¼ã£ããã£ãç©ã対象㫠Tarpitting ããã®ãå¹æçãTarpitting ãèãããããã Greylisting ãã¦ãããã¨ããã°ãGreylist ã¨ãã¦ä¿æããã¨ã³ããªæ°ãå°ãªãããäºãåºæ¥ãã
greylist.conf ã®ãµã³ãã«
ã¨ã¾ãããããªæããè¯ãããªãã¨ã
socket "/var/run/milter-greylist/milter-greylist.sock" dumpfile "/var/lib/milter-greylist/db/greylist.db" 600 dumpfreq 1 user "smmsp" quiet subnetmatch /24 list "my network" addr { 127.0.0.1/8 192.168.1.0/24 } # SPF ã pass ã ã£ãæã«è¨±å¯ãããå·®åºäººã®ã¡ã¼ã«ã¢ãã¬ã¹ list "whitelist with spf" from { \ /[.@]docomo\.ne\.jp[> ]*$/ \ /[.@]gmail\.com[> ]*$/ \ /[.@]apple\.com[> ]*$/ \ } # DNSBL ã®çµæã OK ã ã£ãå ´åã«è¨±å¯ãããã¡ã¼ã«ã¢ãã¬ã¹ list "whitelist with dnsbl" from { \ /[.@]example\.co\.jp[> ]*$/ \ } # å·®åºäººãèªçµç¹ã®ã¡ã¼ã«ã¢ãã¬ã¹ list "my domain" from { \ /[.@]example\.com[> ]*$/ \ } # DNSBL ã« spamhaus ã® ZEN ãå®ç¾© dnsrbl "ZEN" zen.spamhaus.org 127.0.0.0/28 # æ¡å¼µæ£è¦è¡¨ç¾ã使ã extendedregex # åéãç¡ãã£ãã¨ãã« Greylist ããæ¶ããæé timeout 12h # åéããã¦ãæå¦ããæé delay 5m # localhost ãå é¨ããã®ã¡ã¼ã«ã¯ç¡æ¡ä»¶ã«è¨±å¯ racl whitelist list "my network" # SPF ã®è¨å®ã wide open ã«ãªã£ã¦ããç©ãæå¦ racl blacklist spf self msg "SPF is wide open" # SPF ã®çµæã pass ã«ãªããã®ãè¨±å¯ racl whitelist list "whitelist with spf" spf pass # DNSBL ã®çµæã OK ã ã£ãå ´åã«è¨±å¯ racl whitelist list "whitelist with dnsbl" no dnsrbl "ZEN" # èªåã®ãã¡ã¤ã³ããå±ãã®ã«ããã® IP ã DNSBL 㧠NG ã®ãã®ã¯æå¦ racl blacklist list "my domain" dnsrbl "ZEN" msg "Where are you?" # S25R ã«å¼ã£ããããã®ã¯ Greylisting racl greylist domain /^\[.+\]$/ msg "S25R rule 0" racl greylist domain /^[^.]*[0-9][^0-9.]+[0-9].*\./ msg "S25R rule 1" racl greylist domain /^[^.]*[0-9][0-9][0-9][0-9][0-9]/ msg "S25R rule 2" racl greylist domain /^([^.]+\.)?[0-9][^.]*\.[^.]+\..+\.[a-z]/ msg "S25R rule 3" racl greylist domain /^[^.]*[0-9]\.[^.]*[0-9]-[0-9]/ msg "S25R rule 4" racl greylist domain /^[^.]*[0-9]\.[^.]*[0-9]\.[^.]+\..+\./ msg "S25R rule 5" racl greylist domain /^(dhcp|dialup|ppp|[achrsvx]?dsl)[^.]*[0-9]/ msg "S25R rule 6" # DNSBL ã«å¼ã£ããã£ããã®ã¯ Greylisting racl greylist dnsrbl "ZEN" # ããã©ã«ãã¯è¨±å¯ racl whitelist default
Greylisting ã®ææ³
å½åãGreylisting ãã¦ããã»ã¨ãã©åéãããããããªãããã¨æã£ãããæå¤ãªãããã«åéãã¦æ¥ãªããåççã«ã¯ Tarpitting ã®æ¹ãå¹æçã ã¨æãããGreylisting ã ãã§ããããããéã£ã¦ãããããªãã®ã¯ãã»ã¨ãã©é²ãäºãåºæ¥ãã
spam ãéãå´ãããããã工夫ãã¦ããã¨ã¯æãããä»ã®ã¨ãã Greylisting ã®å¹æã¯é«ããåéãããã㪠spam ãå¢ãã¦ãããããµã¼ãã®ä½è£ãè¦ã¦ tarpitting ã使ããã¨ããæ¹åã§èãã¦ããã¨è¯ãããªã
*1:milter ããã°ã©ã ã®å¼ã³åºãã«å¤±æããæã«ã©ããããã¯ãINPUT_MAIL_FILTER ã§ãF=ãã®æå®ã§å¤æ´åºæ¥ããåç §ï¼つれづれ日記:sendmail の MAIL_FILTER で指定するオプション
*2:ãã®æãã-cããå¿ããã¨ãäºéèµ·åã«ãªã£ããã§ãå¾ ã¡åãã UNIX ãã¡ã¤ã³ã®ã½ã±ãããå¾ããèµ·åããããã»ã¹ã«åãããããããééã£ã¦èµ·åãã milter-greylist ã®ããã»ã¹ã殺ãã¨ãMTA ãã milter-greylist ã«ã¤ãªãããªããªã£ããã¨ãããã¨ã§ãã-cãã¯å¿ããã«ã
*3:調æ´ã®ä»æ¹ã¨ãã¦ã¯ãã°ãã¼ãã«ãªè¨å®ã¨ãã¦è¨å®ããæ¹æ³ã®ä»ã«ãACL ã®è¡ã§æå®ããæ¹æ³ãããããã®å ´åã ã¨ãããã®ã«ã¼ã«ã«å¼ã£ããã£ãæ㯠delay ã¯ï¼æéãã¨ãã£ãå ·åã«ãACL æ¯ã«æéãå¤ããäºãåºæ¥ãããã ããtimeout 㯠ACL ã§ã¯æå®åºæ¥ãªãã
*4:CVS ããå¼ã£å¼µãåºããã½ã¼ã¹ã«ä»ãã¦ãã ChangeLog ãè¦ãã¨ã4.3.5 㧠Tarpitting ã«é¢ãããããããã¯ã®ãã°ãç´ãããã¨æ¸ãã¦ããã