HP-UX Mailing Services Administrator's Guide (B2355-91064)
Checking Headers
With header checking, you can reject mail messages based on the contents of their mail
headers. Sendmail provides the syntax for limited header syntax checking. A
configuration line of the form: HHeader: $>Ruleset causes the specified ruleset to
be invoked on the header when read. Following is an example of header checking:
Validity of a Message-ID: header
#LOCAL_RULESETS
HMessage-Id: $>CheckMessageId
SCheckMessageId
R< $+ @ $+ > $@ OK
R$* $#error $: 553 Header Error
If the previous lines are included in the sendmail.cf file, then all header messages
of the form Message-Id: will call the ruleset SCheckMessageID, which checks for
the validity of the Message-Id header.
Discard Mailer
Sendmail has defined a special internal delivery agent calleddiscard. You can use
this agent with the header-checking ruleset and check rulesets: check_mail,
check_rcpt, check_relay, or check_compat.
If any of the check rulesets (check_mail, check_rcpt, check_relay, or
check_compat) or the header-checking ruleset resolves a mail address to the
$#discard mailer, then all the SMTP commands are accepted, but the message is
discarded. If only one of message recipients address resolves to the $#discard mailer,
none of the recipients will receive the mail message.
Regular Expressions
You can use regular expressions with the new map class regex. Use the regex map
to see if an address matches a certain regular expression. By using such a map in a
check rulesets (check_mail, check_rcpt, check_relay, or check_compat), you
can block a certain range of addresses that would otherwise be considered valid.
For example, if you want to block all senders with all numeric user names, such as
2312343@bigisp.com, you would use SLocal_check_mail and the new regex
map:
#LOCAL_CONFIG
Kallnumbers regex -a@MATCH ^[0-9]+$
LOCAL_RULESETS
SLocal_check_mail # check address against
various regex checks
R$* $: $>Parse0 $>3 $1
R$+ < @ bigisp.com. >48 $: $(allnumbers $1 $)
R@MATCH $#error $:553 Header Error
Configuring Sendmail to Reject Unsolicited Mail 89