Where to put the check_* rulesets in sendmail


check_* in .mc


Usually the

1
sendmail.cf

file should be built from a

1
.mc

file with help of the m4 macro language processor . Use the supplied HACKs or put the rules(e.g.,check_mail or check_rcpt ) as given into the .mc file. Make sure that you have the CODE>LOCAL_CONFIG and

1
LOCAL_RULESETS

in front of the respective sections, otherwise there will be some problems!


HACK() in .mc

A

1
.mc

file using the
HACKs
directly could look like this:


include(`../m4/cf.m4′)
VERSIONID(`@(#)solaris2.mc 8.1 (Berkeley) 6/7/93′)
OSTYPE(solaris2)dnl
DOMAIN(generic)dnl
MAILER(local)dnl
MAILER(smtp)dnl
define(`_IP_LOOKUP_‘,`1’)
define(`_DNSVALID_‘,`1′)
HACK(use_ip,`/etc/mail/LocalIP’)
HACK(use_relayto)
HACK(check_mail3)
HACK(check_rcpt4)


check_* directly in .mc

A

1
.mc

file using
check_mail
or
check_rcpt
could look like this:


include(`../m4/cf.m4′)
VERSIONID(`@(#)solaris2.mc 8.1 (Berkeley) 6/7/93′)
OSTYPE(solaris2)dnl
DOMAIN(generic)dnl
MAILER(local)dnl
MAILER(smtp)dnl

LOCAL_CONFIG
Kjunk dbm /etc/mail/junk
F{LocalIP} /etc/mail/LocalIP
F{RelayTo} /etc/mail/relayto

LOCAL_RULESETS
# check for junk domain/spammers
Sjunk
# ….

Scheck_mail
# ….

Scheck_rcpt
# ….

However, this isn’t recommended,
since only the
.m4
files
from the

distribution

are kept up-to-date.


check_* in .cf


If you want to modify your

1
sendmail.cf

directly,
put the file references
(e.g.,

1
F{LocalIP} /etc/mail/LocalIP

)
or map definitions
(e.g.,

1
Kjunk dbm /etc/mail/junk

)
at the end of the local info section


##################
# local info #
##################

but
before the version number

# Configuration version number
DZ8.8.8

The exact place doesn’t matter that much, but make sure
you can find it again.
Next,
put the new rulesets behind

1
S98

in

1
sendmail.cf


So your

1
sendmail.cf

may now look like this:


##################
# local info #
##################

Cwlocalhost
# file containing names of hosts for which we receive email
Fw/etc/sendmail.cw

# put the new definitions here, e.g.,
F{LocalIP} /etc/mail/LocalIP

# Configuration version number
DZ8.8.8

###############
# Options #
###############

and:


###################################################################
### Ruleset 98 — local part of ruleset zero (can be null) ###
###################################################################

S98

# your local additions and thereafter
# for example:
Scheck_rcpt
# make sure you have TABs here, not BLANKs! sendmail will complain otherwise…
# first: get client addr
R$+ $: $(dequote “” $&{client_addr} $) $| $1
# etc…..

Scroll to top