anomy-list

Re: Filtering per user

From: James Nonya (114068@xyz.molar.is)
Date: Thu 05 Feb 2004 - 15:47:50 GMT

  • Next message: dap: "examples of using Anomy modules directly?"

    Josh,

    Actually, the point of the script below was to allow
    specific users to recieve certain attachments. In the
    wake of My.Doom I decided that even zip files
    shouldn't come through. Needless to say the rest of
    the company didn't agree with me, so I opted to get a
    list of what users get zip archives for BUSINESS
    PROCESSES only and then grep out the usernames from
    the stream. My only beef is that I have to grep the
    stream 3 times...once for spam checking to log,
    another for spam checking to delete or tag and send,
    and another for seeing if the user is authorized to
    get zips. I've added the "-m 1" to only match once
    and then stop, but still....I was wondering if there
    was a more efficient way to do this. And yes..I'd
    love to see your script =)

    James

    On Wed, 4 Feb 2004 12:57:08 -0600 (CST)
    "Josh Berry" <> wrote:

    > Do you really want to create different configs for
    each user? If so I
    > have a script that you could hack to work how you
    want. The script that I
    > had parsed the email for the Spam tag, if it had the
    spam tag then it
    > parsed the from: field, removing the sender (but
    keeping the
    > @domainname.com) and replacing it with spam.
    Basically they were
    > providing a spam filtering service and this enabled
    them to create a Spam
    > account for each of their customers that sent Spam
    mail to this special
    > account.
    >
    > > Hey all!
    > >
    > > Ok..here's what I got for my sidelinespamd.sh.
    First,
    > > pipes through spam assassin. This logs to syslog
    > > everytime an email is tagged as spam (delivered or
    > > not). Then it checks if the email gets tagged and
    > > delivered or nuked. After that it greps the email
    and
    > > sees who it is going to. If it matches ANY of
    > > "different|email|addresses|here" it uses a
    different
    > > sanitizer.cfg file. If it doesn't match it just
    sends
    > > using the default sanitizer.cfg. Can anyone see a
    > > better/different way to get this done? Thank!
    > >
    > >
    > > INSPECT_DIR=/var/spool/filter
    > > SENDMAIL="/usr/lib/sendmail -i"
    > > ANOMY=/usr/local/anomy
    > > ANOMY_CONF=/etc/sanitizer.cfg
    > > ANOMY_CONF_USER=/etc/sanitizer_user.cfg
    > > ANOMY_LOG=/dev/null
    > > SPAMASSASSIN=/usr/bin/spamc
    > > EGREP=/bin/egrep
    > >
    > > SIDELINE_DIR=/var/spool/spam
    > >
    > > SPAMLIMIT=7
    > > SPAM=4
    > > export ANOMY SPAMLIMIT
    > >
    > > EX_TEMPFAIL=75
    > > EX_UNAVAILABLE=69
    > >
    > > cd $INSPECT_DIR || { echo $INSPECT_DIR does not
    exist;
    > > exit $EX_TEMPFAIL; }
    > >
    > > trap "rm -f out.$$" 0 1 2 3 15
    > >
    > > cat | $SPAMASSASSIN -x > out.$$
    > >
    > > # Is this spam? If so log it to syslog:
    > > if $EGREP -q -m 1 "^X-Spam-Level: \*{$SPAM,}" <
    out.$$
    > > then
    > > logger /var/log/messages Spam Email Recieved
    > > fi
    > >
    > > # Are there more than $SPAMLIMIT stars in
    X-Spam-Level
    > > header? If so move to /var/spam:
    > > if $EGREP -q -m 1 "^X-Spam-Level: \*{$SPAMLIMIT,}"
    <
    > > out.$$
    > > then
    > > mv out.$$ $SIDELINE_DIR
    > > fi
    > >
    > > # See who this is
    > > if $EGREP -q -m 1 "different|email|addresses|here"
    <
    > > out.$$
    > > then
    > > $ANOMY/bin/sanitizer.pl $ANOMY_CONF_USER < out.$$
    > > 2>>$ANOMY_LOG | $SENDMAIL "$@"
    > > else
    > > $ANOMY/bin/sanitizer.pl $ANOMY_CONF < out.$$
    > > 2>>$ANOMY_LOG | $SENDMAIL "$@"
    > > fi
    > >
    > > exit 0
    > >
    > >
    > > __________________________________
    > > Do you Yahoo!?
    > > Yahoo! SiteBuilder - Free web site building tool.
    Try it!
    > > http://webhosting.yahoo.com/ps/sb/
    > >
    > >
    > >
    >
    >
    > Thanks,
    > Josh Berry, CISSP
    > CTO, VP of Product Development
    > LinkNet-Solutions
    > 469-831-8543
    > 114165@xyz.molar.is
    >

    __________________________________
    Do you Yahoo!?
    Yahoo! Finance: Get your refund fast by filing online.
    http://taxes.yahoo.com/filing.html



    hosted by molar.is