Hi all,

Recent developments have prompted me to reconfigure a few bits in my sendmail server. Those who use sendmail will be familiar with the
'access' database. This deals only with SMTP data, i.e. IP addresses and the MAIL FROM: & RCPT TO: info. It cannot deal with what is actually IN the 'envelope', so it's time to break out the editor and
edit /etc/mail/sendmail.cf.


Warning, looking too closely at this file can cause mental instability.

#include <disclaimer.h>

OK, we are looking for a bit in sendmail.cf that looks like this...

#########################
#   Format of headers   #
#########################

H?P?Return-Path: <$g>
etc etc

Add these 2 lines on the end
HFrom: $>CheckEnvelopeSender
HSubject: $>CheckEnvelopeSubject

This means that the header line From: will be subjected to a (new) ruleset called CheckEnvelopeSender, and the header 'Subject:' a ruleset called CheckEnvelopeSubject.

Rulesets are defined next, mine look like this...

######################################################################
######################################################################
#####
#####                   REWRITING RULES
#####
######################################################################
######################################################################

SCheckEnvelopeSender
R$* vatsalaji $*        $#error $: 553 EIVEHADENOUGHGOAWAY
R$*                     $@ OK

Note, these 2 fields are TAB separated, miss this point and it won't work. The first field is called the LHS and must match the token passed to the ruleset for RHS to be invoked. R means it's a Ruleset line, $* is a sequence of 0 or more characters, the rest is simply fields to be matched.

The other ruleset looks like this...

SCheckEnvelopeSubject
R$* iso-8859-1 $*   $#error $: 553 PlainText Subject Please
R$* VIAGRA $*       $#error $: 553 Go away
R$* VIAGRA $*       $#error $: 553 Go away
R$* V1AGRA $*       $#error $: 553 Go away
R$* [EMAIL PROTECTED] $*       $#error $: 553 Go away
R$* [EMAIL PROTECTED] $*       $#error $: 553 Go away
R$* VIAGR@ $*       $#error $: 553 Go away
R$* V1AGR@ $*       $#error $: 553 Go away
R$* [EMAIL PROTECTED]@ $*       $#error $: 553 Go away
R$* [EMAIL PROTECTED]@ $*       $#error $: 553 Go away
R$* Viagra $*       $#error $: 553 Go away
R$* V1agra $*       $#error $: 553 Go away
R$* [EMAIL PROTECTED] $*       $#error $: 553 Go away
R$* [EMAIL PROTECTED] $*       $#error $: 553 Go away
R$* Viagr@ $*       $#error $: 553 Go away
R$* V1agr@ $*       $#error $: 553 Go away
R$* [EMAIL PROTECTED]@ $*       $#error $: 553 Go away
R$* [EMAIL PROTECTED]@ $*       $#error $: 553 Go away
R$* viagra $*       $#error $: 553 Go away
R$* v1agra $*       $#error $: 553 Go away
R$* [EMAIL PROTECTED] $*       $#error $: 553 Go away
R$* [EMAIL PROTECTED] $*       $#error $: 553 Go away
R$* [EMAIL PROTECTED] $*       $#error $: 553 Go away
R$* viagr@ $*       $#error $: 553 Go away
R$* v1agr@ $*       $#error $: 553 Go away
R$* [EMAIL PROTECTED]@ $*       $#error $: 553 Go away
R$* [EMAIL PROTECTED]@ $*       $#error $: 553 Go away
R$* CIALIS $*       $#error $: 553 Go away
R$* CIA1IS $*       $#error $: 553 Go away
R$* C1ALIS $*       $#error $: 553 Go away
R$* C1A1IS $*       $#error $: 553 Go away
R$* [EMAIL PROTECTED] $*       $#error $: 553 Go away
R$* [EMAIL PROTECTED] $*       $#error $: 553 Go away
R$* [EMAIL PROTECTED] $*       $#error $: 553 Go away
R$* [EMAIL PROTECTED] $*       $#error $: 553 Go away
R$* Cialis $*       $#error $: 553 Go away
R$* Cia1is $*       $#error $: 553 Go away
R$* C1alis $*       $#error $: 553 Go away
R$* C1a1is $*       $#error $: 553 Go away
R$* [EMAIL PROTECTED] $*       $#error $: 553 Go away
R$* [EMAIL PROTECTED] $*       $#error $: 553 Go away
R$* [EMAIL PROTECTED] $*       $#error $: 553 Go away
R$* [EMAIL PROTECTED] $*       $#error $: 553 Go away
R$* cialis $*       $#error $: 553 Go away
R$* cia1is $*       $#error $: 553 Go away
R$* c1alis $*       $#error $: 553 Go away
R$*                                     $@ OK

Some (most) distributions use a .mc file to regenerate the .cf file.
There are examples of how to embed these changes into your .mc
file, so they are recreated.

Cheers, Rex

Reply via email to