QuickStart: 

Sendmail 8.8.x contains new sendmail rulesets to prevent spam.
To use this feature, you have to modify /etc/sendmail.cf
to add these rulesets to S98 (local additions) section, 
create database files containing the spammers, and then
restart the sendmail daemon. This package simplify these 
procedures.

For more information, refer to Red Hat Linux 5.0 User's Guide
http://www.redhat.com/support/docs/rhl/manual/manual/

(1) Modify /etc/sendmail.cf. Add the file check.m4 to S98 section.
    If you use Red Hat 5.0, you can SKIP this step.

(2) Modify /etc/mail/ip_allow, this is a flat text file that contains 
    the IP addresses or networks of hosts that are allowed to use your
    host as a relay. The format for this file is: 

    hhh.hhh.hhh.hhh
    ccc.ccc.ccc
    bbb.bbb
    aaa

(3) Modify /etc/mail/name_allow, this is a flat text file that contains 
    the hostnames or domain names of hosts that are allowed to use
    your host as a relay. The format for this file is: 

    hostname.domain.com
    domain.com

(4) Compile the program makedb by

    gcc -lstdc++ -ffor-scope makedb.cc -o makedb

    You need not to do this step if you use Red Hat 5.0.

(5) Modify /etc/mail/spammers, add the email addresses that send junk mails 
    to you.

(6) Modify /etc/mail/banned, add the domains that usually send junk mails 
    to you.

(7) /etc/mail/makedb -s. It will create the hash database files that contain
    all spammers and domains and the restart sendmail daemon.

(8) Once you get new spammers emails or domains, repeat step (5)-(7). 
    That's all!


The package alse contains two perl scripts cnt-spam.pl & smreject.pl, 
that count the rejected messages out of the mail log file.

The following texts are big5 code. Just ignore if you cannot read.


*-----------------------------------------------------------------------------*
pϥ sendmail.cf Ӿ׼siH  --  ֳtJ

Sendmail 8.8.x w[JsWhiHΨө׼siHCnϥΦ@SʡAA:
1. NsWh[J /etc/sendmail.cf  S98 (local additions) section.
2. إߥ]tMHosiHW(spammers)ƮwC
3. sҰ sendmail daemon.
{MA²ƳoǹL{C

QohTAаѦ Red Hat Linux 5.0 User's Guide:
http://www.redhat.com/support/docs/rhl/manual/manual/

(1) ק /etc/sendmail.cf, N{MҪɮ check.m4 [ S98 section
    CpGAϥ Red Hat 5.0, iHLBJA]w]tC

(2) ק /etc/mail/ip_allow, N\ϥΧA mail relay  IP addresses
    [JɮפCoOӯ¤rɡA榡:

    hhh.hhh.hhh.hhh
    ccc.ccc.ccc
    bbb.bbb
    aaa

(3) ק /etc/mail/name_allow, N\ϥΧA mail relay W
    [JɮפCoOӯ¤rɡA榡:

    hostname.domain.com
    domain.com

(4) sĶ makedb

    gcc -lstdc++ -ffor-scope makedb.cc -o makedb

    pGAϥ Red Hat 5.0 άO glibc2, iHLBJC

(5) ק /etc/mail/spammers, NMeUHA email addresses [JɡC

(6) Modify /etc/mail/banned, NMeUHA FQDN  domain
    name [JɡC

(7) /etc/mail/makedb -s. |ͥ]tҦ spammers  hash database,
    ísҰ sendmail daemon.

(8) pGAs spammers WA (5)-(7) BJYiCNoˤF!


{tt perl {Z cnt-spam.pl & smreject.pl iHέpQڵ
UH󦸼ơC


*-----------------------------------------------------------------------------*
pϥ sendmail.cf Ӿ׼siH  --  z

Red Hat 5.0 ϥ Claus Abetamann Ҽg sendmail rulesets Ӿ׼siHC
аѦ Claus :
http://www.informatik.uni-kiel.de/~ca/email/check.html

ϥΤFpU rulesets:

    junk 
    check_mail 
    check_rcpt 
    remove_local 
    junkIP 
    check_relay 

åѤUC /etc/mail ؿUɮרӱ:

    ip_allow 
    name_allow 
    relay_allow 
    deny 


* O mail relay ?

Mail relay NOl~C²檺ApGHzL smtp port sWA 
sendmail daemon, éROA sendmail oHYHAANF mail
relay. bAγ\ںs{booFAlH컷詹
ݭngLhD~H~F⤤C]Aj UNIX D
 sendmail w]iH䥦 mail relay. (oӭ]Oڲq
! pGHDu]AЧiDڡC)

o˪]wTMܤKAOoOyUsiH󺡤ѭ̤j]C
]AHiHsWAAö@ FROM }AñNHH
H⤤CANFݵosiHC

pGoӱpUӷUYAAi|QjaCڵӤAɧA
HoHNSH! ]A mail relay ]O沈nC

Red Hat 5.0 ĥ /etc/mail U ip_allow, name_allow, relay_allow 
 mail relay. ]NOAuCboɮפ IP addresses 
domain names ~iHAӰ mail relay host. oɮת榡A
аѦҤW"ֳtJ"AάO Red Hat Linux 5.0 User's Guide.

 IP  domain names ӥ[oɮפ? ҦppGxAHD
AiHO] DOS, Win95/NT, OS/2 Ψ䥦 UNIX based AW
ϥΪ̨ϥ Netscape  MUA, ñN Outgoing mail server 񬰧AD
AAANӱNox IP  domain names [JWXɮפC
@ӻAA LAN W IP addresses iH[J(DHqA LAN 
osiH)C~A䥦 IP  domain names ̦nn[J!

pGYxCW椤QΧAD mail relay, |o
"we do not relay" TAæbA maillog dUO:

Nov 25 05:28:28 dns sendmail[4448]: FAA04448: ruleset=check_rcpt, arg1=<chuckd@w
eirdness.com>, relay=a23.pm3-16.theriver.com [206.26.123.215], reject=550 <chuck
d@weirdness.com>... we do not relay


* Spammers ?

MݵoUH bad users O]CܦhɭԳoةUHҨϥΪ FROM
쳣OyAάOMӽХΨӵosiH domain names  email 
addresses. Red Hat 5.0 ĥγo˪WhөڦUH:

1. FROM DWٵLk resolved Cmaillog |pUT:

Jan 21 01:12:45 dns sendmail[6750]: BAA06750: ruleset=check_mail, arg1=<3w@bbcal
l.060169070>, relay=root@ms1.hinet.net [168.95.4.10], reject=451 <3w@bbcall.0601
69070>... unresolvable host name bbcall.060169070, see RFC 1123, sections 5.2.2
and 5.2.18.

2. FROM email addresses  domain names C /etc/mail/deny C
   ڦTp:

Jan 21 02:08:16 dns sendmail[6785]: CAA06785: ruleset=check_mail, arg1=<ftp@ms2.
hinet.net>, relay=root@ms2.hinet.net [168.95.4.20], reject=501 <ftp@ms2.hinet.ne
t>... You are banned, contact your local admin.

/etc/mail/deny 榡O:

junk.domain "Error-Code Error-Text"
spammer@address.domain "Error-Code Error-Text"
junk.domain JUNK
spammer@address.domain SPAMMER


* makedb

] /etc/mail/deny 榡O: "ڦ email  domain"<tab>"ڦz".
o˦h֦ǤKA]AiHqeqWo spammer lists u]
tĤ@CӥBs觹oɮ׫A٭n makemap  hash database file,
ísҰ sendmail daemon. ҥHڼgFӵ{ makedb ²ƳoӹL{C

DA] Red Hat 5.0 Φ glibc2, MANnۤvsĶ makedb, ]M
ɻݭn libc.so.6.

    gcc -lstdc++ -ffor-scope makedb.cc -o makedb

An gcc 2.7.x ӽsĶ~A]ڥΤF C++ STL :)

makedb ΪkO:

  makedb [-o outputfile] [-s] [file1 file2 file3...]

         -o:  specify the output file   Default: /etc/mail/deny
         -s:  restart sendmail

file1, file2 OAڦ email  domain CCCu]t@NFC
pGAwӷɡAh makedb |ŪJ /etc/mail/deny.conf, ھڸ̭e
ŪJӷɮסC

M makedb |NGgJ -o ѼƫwɮפCYwAw] 
/etc/mail/deny, ͪ hash file  /etc/mail/deny.db.

pG[W -s ѼơAmakedb |sҰ sendmail daemon.

аѦҥMdҦb /etc/mail U deny.conf, spammers, banned
ɮסC䤤 spammers ]tFڦ email addresses CAbanned ]t
Fڦ domain names CC

аO: @ALoǳ]w ip_allow, name_allow, deny A@wn
sҰ sendmail ~|ͮġAi /etc/mail/makedb -s, άO

kill -HUP `head -1 /var/run/sendmail.pid`


Ow Red Hat 5.0, ƹWiAΩ] sendmail 8.8.x
 UNIX based OS WCun"ֳtJ"@`ק /etc/sendmail.cf,
ýsһݪɮקYiC

Miۦo:
ftp://ftp.phys.ntu.edu.tw/pub/os/linux/packages/sendmail-antispam-0.1.tar.gz
ftp://ftp.phys.ntu.edu.tw/pub/os/linux/packages/sendmail-antispam-0.1-1.i386.rpm

--
C.W.Huang        mailto:cwhuang@phys.ntu.edu.tw
Coordinator of Linux HOWTOs Chinese Translation
http://www.phys.ntu.edu.tw/~cwhuang/pub/os/linux/CLDP/
CLDP mailing list: ldp-trans@linux.org.tw
