|
|
Last update : 2022/04/24 |
milter-blockdomain は、C言語で作成され、受信をブロックしたい数千のドメインを正規表現ではなく平易なテキストで管理する milter です。
milter-blockdomain と milter-greylist を併用するのが実用的な使い方です。
milter-greylist で、逆引きできないIPアドレス、不正なHELO/EHLO、GeoIP、正規表現による広範囲・汎用的なルール、S25R を処理します。
milter-blockdomain で、milter-greylist を通過した受信を希望しないドメインをブロックするように処理します。
milter-regex も、活用することもできます。
milter-blockdomain | example.com |
---|---|
milter-greylist | racl blacklist domain example.com racl blacklist helo /^(.+\.)?example\.com$/ racl blacklist from /@(.+\.)?example\.com>$/ |
milter-regex | connect /^(.+\.)?example\.com$/ie // and envrcpt /^<.*>$/ helo /^(.+\.)?example\.com$/ie and envrcpt /^<.*>$/ envfrom /@(.+\.)?example\.com>$/ie and envrcpt /^<.*>$/ |
このソフトウエア ( milter-blockdomain ) の著作権は、阿部孝夫が保有しています。
ライセンスは、GNUパブリック・ライセンス(GPLv3、または、それより新しい版)です。
ライセンスのもとで、どなたでも、個人利用/商用利用を問わず、ご自由にご活用いただけます。
各種ファイルのパスを決めます。パスは、自由に決定できます。
File or Dir | Path | パスを指定する関連ファイル |
---|---|---|
Exec file | /usr/local/sbin/milter-blockdomain | 起動スクリプト ( ex. /etc/rc.d/rc.milter-blockdomain ) |
Config file | /etc/mail/milter-blockdomain.conf | 起動スクリプト ( ex. /etc/rc.d/rc.milter-blockdomain ) |
Socket file | /var/spool/milter/milter-blockdomain.sock | 設定ファイル ( Keyword: socket ) sendmail.mc ( Keyword: INPUT_MAIL_FILTER ) |
PID file | /var/run/milter-blockdomain.pid | 設定ファイル ( Keyword: pidFile ) |
Domain list files | /var/lib/milter-blockdomain/* | 設定ファイル ( Keyword: whitelist, blacklist, greylist ) |
実行モジュールの生成とディレクトリを作成します。
$ cd /tmp $ tar jxf milter-blockdomain-M.NN.tar.bz2 $ cd milter-blockdomain-M.NN $ ./configure --sysconfdir=/etc/mail $ make $ su Password: ********** # make install # mkdir /var/lib/milter-blockdomain # mkdir /var/spool/milter # chown smmsp:smmsp /var/spool/milter # chmod o-rwx /var/spool/milter
sendmail.mc に "INPUT_MAIL_FILTER" を 追記します。
INPUT_MAIL_FILTER(`milter-blockdomain',`S=local:/var/spool/milter/milter-blockdomain.sock, F=, T=S:1m;R:1m')dnl
sendmail.mc から sendmail.cf を生成します。
Save current sendmail.cf as a backup. # cp -p /etc/mail/sendmail.cf /etc/mail/sendmail.cf-yyyymmdd-hhmm Change working directory # cd /usr/share/sendmail/cf/cf Generate sendmail.cf from sendmail.mc # m4 /etc/mail/sendmail.mc | cat -s > /etc/mail/sendmail.cf
ブロック・ドメイン・リストがなければ、空のファイルを作成します。
$ touch /var/lib/milter-blockdomain/xxxxxxxxxx.txt
milter-blockdomain [-c config-file-path] [-d] [-s] [-t Interval] [-v]
# /usr/local/sbin/milter-blockdomain If the config file is other than /etc/mail/milter-blockdomain.conf # /usr/local/sbin/milter-blockdomain -c config-file-path
# milter-blockdomain.conf ######################################## # user # Mandatory, No default user smmsp ######################################## # socket # Mandatory, No default # Correspond with INPUT_MAIL_FILTER of sendmail.mc socket /var/spool/milter/milter-blockdomain.sock ######################################## # pidFile # Mandatory, No default pidFile /var/run/milter-blockdomain.pid ######################################## # checkConnect, checkHelo, checkEnvFrom, checkEnvRcpt # 0 : Not checked # 1 : Checked ( Default ) checkConnect = 1 checkMacro_ = 1 checkHelo = 1 checkEnvFrom = 1 checkEnvRcpt = 0 ######################################## # checkOnAndAfter # 0 : Check on and after connect # 1 : Check on and after helo # 2 : Check on and after envfrom # 3 : Check on and after envrcpt ( Default ) # 4 : Check on and after header checkOnAndAfter = 3 ######################################## # Message messageTempfail "Refused connection temporarily. Be patient." messageReject "Refused connection by site policy." ######################################## # Syslog facility name # daemon, mail, user, local0 to local7 syslogFacility = mail ######################################## # Syslog priority debug # 0 : Do not write syslog priority=debug ( Default ) # 1 : Write syslog priority=debug syslogDebug = 0 ######################################## # Subdomain # 0 : Exact domain matching # 1 : Subdomain matching ( Domain boundary ) ( Default ) Subdomain = 1 ######################################## # whitelist, blacklist, greylist # Max 8 files # First match determine the result, accpet/reject/tempfail. # Insensitive lower/upper case letter. whitelist /var/lib/milter-blockdomain/whitelist.txt blacklist /var/lib/milter-blockdomain/blacklist.txt greylist /var/lib/milter-blockdomain/greylist.txt ######################################## # DO NOT USE THIS PARAMETER # testMode # 0 : Check ( Default ) # 1 : Logging only ( Alway "Not listed" result ) #testMode = 0 ######################################## # DO NOT USE THESE PARAMETERS # debugConfigFunction, debugCheckFunction # 0 : Disable debug log ( Default ) # 1 : Enable debug log #debugConfigFunction = 0 #debugCheckFunction = 0
2022/04/24 | 1.05 | GitHub https://github.com/t2750xurb/milter-blockdomain [Enhancement] Command line option -t Minimum interval of checking domain list file update. [Enhancement] Statistics information to syslog daily. Command line option -s for hourly statistics info. [Add] README.md |
2018/01/20 | 1.04 | [Change] Return previous TEMPFAIL or REJECT check result in the SMTP session preferentially. Add debug log when the mlfi_xxxx's return. milter-blockdomain.c [Change] Change leaf node anchors have every two characters of the beginning of the domain node name, from they have every one character of the beginning of the domain node name. milter-blockdomain.h blkdom_check.c blkdom_config.c [Change] Add following statistics information, Node/Leaf count, Node/Leaf average chain length. milter-blockdomain.h - domainListType blkdom_config.c - statDomainList, LoadDomainList |
2017/12/23 | 1.03 | [Bug fix] Avoid multiple reloading domain lists in race conditions. |
2016/11/03 | 1.02 | [Bug fix] Lost the first entry of unsorted domain list. |
2016/07/02 | 1.01 | Support GNU build procedure, ./configure, make, and make intall. Conf file new keyword 'syslogDebug'. Optional writing syslog priority=debug. Conf file new keyword 'checkMacro_'. Check value of the sendmail macro '_'. Return SMFIS_CONTINUE when smfi_getpriv returns NULL for the private data pointer. |
2016/06/05 | 1.00 | Published |