This file contains several "HACK"s for sendmail 8.8 to reject e-mails
from spammers and to prevent the abuse of your machine as a mail
relay.

An explanation can be found at:
<URL: http://www.informatik.uni-kiel.de/%7Eca/email/check.html >

The HACKs are:
check_mail.m4	(use a newer version)
check_mail2.m4
check_mail3.m4
check_rcpt.m4	(don't use this any more!)
check_rcpt3.m4	(use a newer version)
check_rcpt4.m4
check_rcpt5.m4
check_relay.m4
check_relay3.m4
spamdoms.m4
spammers.m4
use_ip.m4
use_names.m4
use_relayto.m4

and are used as follows:
1a) check_mail (uses plain files for matching):
HACK(spammers)
HACK(spamdoms)
Both take an optional argument (the file to use).
The default filenames are listed below.

HACK(check_mail)

1b) check_mail2 (uses databases for matching):
HACK(check_mail2)

1c) check_mail3 (uses unified database with check_relay3 for matching):
HACK(check_mail3)

2a) check_rcpt4:
HACK(use_ip)
HACK(use_names)
HACK(use_relayto)

HACK(check_rcpt4)

2b) check_rcpt (old version, use check_rcpt4):
HACK(use_ip)
HACK(use_names)
HACK(use_relayto)

HACK(check_rcpt)

The first ones may have a parameter to define the name of the file to
be used.

2c) check_rcpt5:
HACK(use_ip)
HACK(use_names)
HACK(use_relayto)

HACK(check_rcpt5)

The first ones may have a parameter to define the name of the file to
be used.


3) check_relay, check_relay3
These work only if you have a patch (see above URL) or 8.8.6 (or better).
HACK(check_relay)
or
HACK(check_relay3)


Some more explanations:

1a)
If you want to use check_mail, do the following: Put

HACK(spammers)
HACK(spamdoms)
HACK(check_mail)

in your .mc file. Put addresses of well-known spammers (e-mail addresses,
domains) in the appropriate files [default]:
spammers	[/etc/mail/Spammer]	
spamdomains	[/etc/mail/SpamDomains]	

1b)
If you want to use check_mail2, do the following: Put

HACK(check_mail2)
[This has also an optional argument, the default is given below.]

in your .mc file. Put addresses of well-known spammers (e-mail addresses,
domains) in the appropriate database [default]:
junk	[dbm /etc/mail/junk]	

The format is:
junk.domain JUNK
spammer@address.domain SPAMMER
Create the database (man makemap) in the chosen format.

PS: You can activate the reverse IP lookup and the
validity check of the FROM address by
define(`_IP_LOOKUP_',1)dnl
define(`_DNSVALID_',1)dnl
respectively.

PPS: check_mail2 and check_mail3 have a "backdoor" to accept
some addresses without checking them. This can be activated with:
define(`_ACCEPT_SOME_',`1')
Default for the database is: dbm -o /etc/mail/accept
Other values can be given as argument, e.g.,
define(`_ACCEPT_SOME_',`hash /etc/AcceptIt')
Entries must have the form:
user@address	OK
domain	OK


1c)
This is a variant of check_mail2, where the RHS of the map
is used to specify an error code (which is only used in the
text) and an error text.
If you want to use check_mail3, do the following: Put

HACK(check_mail3)
[This has also an optional argument, the default is given below.]

in your .mc file. Put addresses of well-known spammers (e-mail addresses,
domains) in the appropriate database [default]:
junk	[dbm -a@JUNK /etc/mail/junk]	
(if you use another database format or another file, make sure you
specify the option -a@JUNK !)

The format is:
junk.domain "Error-Code Error-Text"
spammer@address.domain "Error-Code Error-Text"
Create the database (man makemap) in the chosen format.

Example:
cyberpromo.com "571 Sorry, Spamford, no e-mail from your place."
honey@sweeties.com "571 Honey, you're a spammer, go away."

PS: You can activate the reverse IP lookup and the
validity check of the FROM address by
define(`_IP_LOOKUP_',1)dnl
define(`_DNSVALID_',1)dnl
respectively.

2a)
If you want to use check_rcpt, do the following: Decide whether you
wan to use the check for local machines by IP number (use_ip) or by
name (use_names). Next, decide whether you want also allow relay to
several machines in addition to those you accept as local (class w).
Depending on your selection, put some of the first three HACKs into
your .mc file, and always use the last one.
HACK(use_ip)
HACK(use_names)
HACK(use_relayto)
All take an optional argument (the file to use).
The default filenames are listed below.

HACK(check_rcpt4)

Put the appropriate values in the files:
use_ip		[/etc/mail/LocalIP]	
use_names	[/etc/mail/LocalNames]	
use_relayto	[/etc/mail/RelayTo]	

1997-03-16: check_rcpt4 can now make use of use_ip and use_names.
It replaces check_rcpt3, which is still available if there is
a problem with the new version.


2c)
check_rcpt5 is a variant of check_rcpt4, so the instructions
above apply here too.
In addition, it has a `backdoor': it allows relaying also
based on the envelope from address (given in MAIL FROM:).
It uses a map (allow) to give the domains and addresses
which may use your mail server as a relay.
The format is simple
user@address.domain	allow
another.domain		allow
A parameter for HACK(check_rcpt5) can be used to specify
a different map type or location than the default:
allow	[dbm -a@ALLOWED /etc/mail/allow]
(if you use another database format or another file, make sure you
specify the option -a@ALLOWED !)

3a)
If you want to use check_relay, do the following: Put

HACK(check_relay)
[This has also an optional argument, the default is given below.]

in your .mc file. Put the IP numbers of well-known spammers 
in the appropriate database [default]:
junk	[dbm /etc/mail/junk]	

The format is:
D.X.Y.Z IP
C.X.Y IP
B.X IP
A IP
(full addresses, class C, B, or A nets)
Create the database (man makemap) in the chosen format.

3b)
If you want to use check_relay3, do the following: Put

HACK(check_relay3)
[This has also an optional argument, the default is given below.]

in your .mc file. Put the IP numbers of well-known spammers 
in the appropriate database [default]:
junk	[dbm -a@JUNK /etc/mail/junk]	
(if you use another database format or another file, make sure you
specify the option -a@JUNK !)

The format is:
D.X.Y.Z "Error text"
C.X.Y "Error text"
B.X "Error text"
A "Error text"
(full addresses, class C, B, or A nets)
Create the database (man makemap) in the chosen format.

This is the same database as used for check_mail3,
just with the addition of IP numbers.

Conclusion:

Make sure you understand what you do and you test this stuff
before you use it on a production machine!
See:
<URL: http://www.informatik.uni-kiel.de/%7Eca/email/chk-dbg.html >
for a debugging guide.
I don't guarantee for anything!
If you have any suggestions, comments, enhancements,
please let me know.

Claus Assmann	<ca@informatik.uni-kiel.de>
Last update: 1997-09-25
