Solved

Postfix+Spamassassin Disable outgoing check

Posted on 2004-04-17
12
1,407 Views
Last Modified: 2012-08-14

Hello,

is it possible to disable checking for outgoing messages in postfix/spamassassin because of it's blocking many mails which my clients are writing/sending via outlook?
It's achieving nearly 6 of 5.0 required points and after I'm using smtp-auth on this server it is better for me to disable this checking.

j79
0
Comment
Question by:j79
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
12 Comments
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10849428
How are you starting spamassassin from postfix? I'm also have psotvix/spamassassin on my machine, but here spamassassin is started from Procmail, so it only gets run for incomming mails.
0
 
LVL 2

Author Comment

by:j79
ID: 10849492

I'm starting it via postfix in master.cf:

smtp      inet  n       -       n       -       -       smtpd  
   -o content_filter=postfixfilter:


postfixfilter unix -    n       n       -       -       pipe
 flags=Rq user=filter argv=/usr/local/filter/postfixfilter -f ${sender} -- ${recipient}

0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10849542
Are you running Procmail as well on your server?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:j79
ID: 10849561

Procmail is available but it's not running with any command now.
Instead my postfixfilter-script is looking like:

#!/bin/sh

SENDMAIL=/usr/sbin/sendmail
SPAMASSASSIN=/usr/bin/spamc

EX_TEMPFAIL=75
EX_UNAVAILABLE=69

cat | $SPAMASSASSIN -f > out.$$ #|| # { echo Message content rejected; exit $EX_UNAVAILABLE; }

grep "^X-Spam-Status: Yes" out.$$ > /dev/null 2>&1

if [ $? -ne 0 ]
then
  $SENDMAIL "$@" < out.$$
fi


0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10849640
This is what I have in my /etc/procmailrc:

# SpamAssassin sample procmailrc
#
# Pipe the mail through spamassassin (replace 'spamassassin' with 'spamc'
# if you use the spamc/spamd combination)
#
# The condition line ensures that only messages smaller than 250 kB
# (250 * 1024 = 256000 bytes) are processed by SpamAssassin. Most spam
# isn't bigger than a few k and working with big messages can bring
# SpamAssassin to its knees.
#
# The lock file ensures that only 1 spamassassin invocation happens
# at 1 time, to keep the load down.
#
:0fw: spamassassin.lock
* < 256000
| spamassassin

# Work around procmail bug: any output on stderr will cause the "F" in "From"
# to be dropped.  This will re-add it.
:0
* ^^rom[ ]
{
  LOG="*** Dropped F off From_ header! Fixing up. "

  :0 fhw
  | sed -e '1s/^/F/'
}



This only marks spam and does not remove it. In my home directory's .procmailrc I have these rules:

# Mails with a score of 15 or higher are almost certainly spam (with 0.05%
# false positives according to rules/STATISTICS.txt). Let's put them in a
# different mbox. (This one is optional.)
:0:
* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
Mail/SPAM.almost-certainly-spam

# All mail tagged as spam (eg. with a score higher than the set threshold)
# is moved to "probably-spam".
:0:
* ^X-Spam-Status: Yes
Mail/SPAM.probably-spam
# Mails with a score of 15 or higher are almost certainly spam (with 0.05%
# false positives according to rules/STATISTICS.txt). Let's put them in a
# different mbox. (This one is optional.)
:0:
* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
Mail/SPAM.almost-certainly-spam

# All mail tagged as spam (eg. with a score higher than the set threshold)
# is moved to "probably-spam".
:0:
* ^X-Spam-Status: Yes
Mail/SPAM.probably-spam


You can remove the spam right in the /etc/procmailrc by redirecting it to /dev/null

:0:
* ^X-Spam-Status: Yes
/dev/null



0
 
LVL 2

Author Comment

by:j79
ID: 10849849

OK, another question.
Can I add my postfixfilter-script into the procmailrc? Is procmailrc accepting "/bin/sh" scripts?
I would like to let everything as it is.. only disable checking the outgoing mails.

j79
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10850588
No, you have to use valid procmail syntax for anything in the procmailrc file.
If I understand your script correctly, you are sending the received email via sendmail if it does not contain spam. If you do receive spam, the mail is not fowarded. YOu may have a small problem: It does not look like you are ever deleting the temporary files out.$$

My if you use the redirection to /dev/null that I mentioned in my last comment, you should have exactly the same behavior: No need to create user level .procmailrc files.

Give it a try.
0
 
LVL 2

Author Comment

by:j79
ID: 10852898

Let me think... is it correct if I give this to my procmailrc

:0 fw
| /usr/local/filter/postfixfilter

and let my postfixfilter (see copy above) not being started by postfix in master.cf ?
Procmail could start spamassassin by the script and my outgoing messages wouldn't be checked, or?


j79

0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10852914
This could work, but you probably should not start the filter as "filter" (the "f" flag). A filter is something that creates output and Procmail would then use the output and further process it. Because your filter is already sending the mail, you don't want to continue to process anything that the postfixfilter would create (potentially error messages). BUT: You need to make sure that anything that's already filtered will not processed by the filter again! If you don't do anything, the mail will be queued to sendmail in your postfixfilter, and will be received by Postfix again, and will be handed of to Procmail again.

I would not do this however. This will create more overhead, and potentially a mail loop. Just use the redirection to /dev/null for Spam. This much more efficient, and does not create any potential problems.
0
 
LVL 2

Author Comment

by:j79
ID: 10852981

I remember now why I didn't use procmail for this issue.
Procmail is checking only spam delivered to a mailbox and not to forwarding addresses.
So I would need to check the user mailbox for spam, to check forwarded addresses for spam but not outgoing messages.

j79

0
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 50 total points
ID: 10853238
You could whitelist the addresses of your clients, so that regardless of their content, these email messages will not get flagged as spam. (and not change your current setup at all).
0
 
LVL 2

Author Comment

by:j79
ID: 10853910

Good idea... I have now to make a script to autmatically add my domains into whitelist but it's not so bad.

Thank you
j79
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question