|
|
Last update : 2022/04/24 |
The milter-blockdomain is a simple milter written in C to maintain thousands of block domains in simple plain expression.
It is a practical use that making use of both the milter-blockdomain and the milter-greylist.
The milter-greylist works for unsolved IP address, malformed HELO/EHLO, GeoIP, widely applied rule by regular expression, and/or S25R.
It is good that the milter-blockdomain handle undesirable domain which is allowed by auto-whitelist of the milter-greylist.
The milter-regex is also useful.
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 /^<.*>$/ |
The "milter-blockdomain" is copyright 2016 by Takao Abe. All rights reserved.
This software is free software, you can use and redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software Foundation,
either version 3 of the License, or any later version.
Determine path. You may change them as you like.
File or Dir | Path | Related files which specifies this path. |
---|---|---|
Exec file | /usr/local/sbin/milter-blockdomain | Start script ( ex. /etc/rc.d/rc.milter-blockdomain ) |
Config file | /etc/mail/milter-blockdomain.conf | Start script ( ex. /etc/rc.d/rc.milter-blockdomain ) |
Socket file | /var/spool/milter/milter-blockdomain.sock | Config file ( Keyword: socket ) sendmail.mc ( Keyword: INPUT_MAIL_FILTER ) |
PID file | /var/run/milter-blockdomain.pid | Config file ( Keyword: pidFile ) |
Domain list files | /var/lib/milter-blockdomain/* | Config file ( Keyword: whitelist, blacklist, greylist ) |
Build and create directory
$ 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
Add "INPUT_MAIL_FILTER" to sendmail.mc
INPUT_MAIL_FILTER(`milter-blockdomain',`S=local:/var/spool/milter/milter-blockdomain.sock, F=, T=S:1m;R:1m')dnl
Generate sendmail.cf from sendmail.mc
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
If you don't have any block domain list at this time, just create empty file.
$ 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 |