Vulnerability Development mailing list archives

Re: Sendmail vs *.vbs


From: sean () ESCAPE CA (Sean A. Walberg)
Date: Mon, 8 May 2000 20:47:49 -0500


Per Hedeland came up with the following in comp.mail.sendmail, thread
"sendmail 8.9.3: blocking attachements" (sic).  In preliminary testing I
have it working on my sendmail server.  YYMV.

The first bit goes in your .mc file, don't forget the tabs! :)

FEATURE(`mailertable')
MAILER(`procmail')
...

LOCAL_CONFIG
CP PROCMAIL

LOCAL_RULE_0
R$*                             $: <> $1                        mark all
R<> < @ $* > $*                 $: < @ $1 > $2          skip route-addr
R<> $* < @ $* . PROCMAIL . >    $: $>3 $1 @ $2          already filtered
R<> $* < @ PROCMAIL . >         $: $1                   already filtered
R<> $* < @ $* . >               $: <> $1 < @ $2 >               remove dot
R<> $* < @ $* >         $: $1 < @ $2 . PROCMAIL . >     send to procmail
R<> $*                          $: $1 < @ PROCMAIL . >  send to procmail

And in mailertable:

PROCMAIL   procmail:/etc/procmailrcs/some.rc
.PROCMAIL  procmail:/etc/procmailrcs/some.rc

Then, use the recipes that jhardin wrote, the URL was posted earlier to
the list.

Sean

On Mon, 8 May 2000, Gert-Jan Hagenaars wrote:

Apparently, Todd Garrison wrote:
% I was really bummed when I saw how they did it... I want to be able to
% block all *attachments* that have the string .vbs in the name - I don't
% want to rely on subject headers alone, but I haven't quite figured out
% how yet.  I played with my .mc/.cf configs in sendmail for about six
% hours trying to get it to play nice, but the problem seems to be that
% all the different mailers describe their attachments differently.  I
% must be pretty thick in the head, but the fact that I know others want
% to do the same thing and I have yet to see a filter that does it (in
% sendmail that is) bums me out.
%
% I could just use procmail, but that only seems to work for local
% delivery and is not any good for a relay server (for example - reducing
% the risks of running MS-Exchange as the front-line mail exchanger on the
% internet by relaying through sendmail).  Maybe I am wrong on this though
% - can procmail be configured to process mail that isn't delivered locally?
%
% Any sendmail gurus out there that can help enlighten us lesser beings?

I'm no sendmail guru, not by a long shot, but in the scenario you
describe, provided you're willing to do put some time into it, I think
this can work.

Set up all your local users with their own home directory on your relay
host (this means you have an extra layer of system administration for
your email to look after).  Write a procmail rule that looks for the
attachments and strips them out when a mail is about to be delivered to
a local user (via procmail), and then make sure that procmail does _not_
write the mail to a mailbox, but forwards it to your MS-Exchange box.

Ok, after writing this I did a little search and found the following
site that has all the good stuff.

http://www.wolfenet.com/~jhardin/procmail-security.html

CHeers,
Gert-Jan.

--
+++++++++++++ -------- +++++ --- ++ - +0+ + ++ +++ +++++ ++++++++ +++++++++++++
sed '/^[when][coders]/!d         G.J.W. Hagenaars -- gj at hagenaars dot com
    /^...[discover].$/d          Remembering Mike Carty 1968-1994
   /^..[real].[code]$/!d         UltrixIrixAIXHPUXSunOSLinuxBSD, nothing but nix
' /usr/dict/words                I'm Dutch, what's _your_ excuse?


-------------------------------------------------------------------
Sean Walberg <sean () escape ca>            http://www.escape.ca/~sean
"Fore yeers ago I kudn't spel Engineer.  Now I are won."


Current thread: