You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Xavi Montero <xm...@dsitelecom.com> on 2006/12/12 10:45:09 UTC

Reject without accepting

Hello.

I have SpamassAssin running but I want to change its behaviour.

Although I'm subscribed to this list from time ago, but this is my first post 
(as far as I can remember). If this message is not adequate here, please, 
redirect me to the correct place.

I have SpamAssassin in my Debian box (with sendmail). I have config A) where 
spamassassin is run in the delivery stage of the sendmail (see the apendixes 
below) and I desire behaviour B) where it is run at the incoming stage so the 
spam is rejected and the sender cannot success at sending it.

QUESTION-1: Is this possible?
QUESTION-2: May I break this goal into small parts and achieve each separately?
QUESTION-3: Where do I have to start?

I ask this because I tried some variants but I did not get it running (see 
appendix E).

Thank you very much.
Xavi.

--------
Appendixes:

A) Current configuration:

- Mail arrives to my send-mail.
- In the home of my user "xavi", I have a .forward redirecting to maildrop (see 
below, appendix C).
- I have a .mailfilter saying that is size is less than xxx than xfilter with 
spamc (see below, appendix D).
- In the same block if I find X-Spam-Flag: YES then I send it to another folder 
(see below, appendix D).

This way, the sender "thinks" that the delivery has been correct and does not 
remove me from his list. I continue receiving spam again and again. In another 
folder, but hundreds, even thousands of spams per day to the same single 
destination address.

B) Desired config

When you send mail to a server to a wrong user, sometimes it re-sends you back 
an e-mail that says: "Cannot send because user does not exist". But sometimes 
you get this message DURING the connection so you know for sure that the mail 
was NOT delivered. I suspect that this is when the PHP mail() function, for 
example, fails.

My desired behaviour would be:

- Setup SpamAssassin at the "input" of the sendmail, so anybody sending spam to 
me gets a "send failure".
- Configure the message saying "Your are suspected to send spam, if you do not, 
go to this webpage (and give one under my apache) and enter your e-mail address".
- Provide a phpscript that if one is entering a good e-mail address by hand, the 
address is added to a "white-list" that allows his mails to arrive me.

I have more users in my system. I don't mind changing this behaviour for all of 
them at a time.

C) Current .forward:

xavi@inspire:~$ cat .forward
| /usr/bin/maildrop
xavi@inspire:~$

D) Current .mailfilter

xavi@inspire:~$ tail .mailfilter
if ( $SIZE < 262144 )
{
     ## 4.1 Spamassassin
     xfilter "/usr/bin/spamc"

     if (/^X-Spam-Flag: YES/)
     {
         to ".mail/zz_spam"
     }
}
xavi@inspire:~$

E) What did I try (and did not run).

if ( $SIZE < 262144 )
{
     ## 4.1 Spamassassin
     xfilter "/usr/bin/spamc"

     if (/^X-Spam-Flag: YES/)
     {
         echo "This server thinks this is spam."
         echo "If this is not spam, call me at +34 630 59 01 62"
         EXITCODE = 100
         exit
     }
}

So... Can anybody help me to configure this new behaviour?

THANK YOU IN ADVANCE!!!!
Xavi.

-- 
Xavier Montero - 93 589 71 91 - 630 59 01 62 - xmontero@dsitelecom.com

Re: Reject without accepting

Posted by SM <sm...@resistor.net>.
Hi Xavi,
At 01:45 12-12-2006, Xavi Montero wrote:
>I have SpamAssassin in my Debian box (with sendmail). I have config 
>A) where spamassassin is run in the delivery stage of the sendmail 
>(see the apendixes below) and I desire behaviour B) where it is run 
>at the incoming stage so the spam is rejected and the sender cannot 
>success at sending it.
>
>QUESTION-1: Is this possible?

Yes.

>QUESTION-2: May I break this goal into small parts and achieve each 
>separately?

Yes.

>QUESTION-3: Where do I have to start?

See below.

>Appendixes:
>
>B) Desired config
>
>When you send mail to a server to a wrong user, sometimes it 
>re-sends you back an e-mail that says: "Cannot send because user 
>does not exist". But sometimes you get this message DURING the 
>connection so you know for sure that the mail was NOT delivered. I suspect

See http://wiki.apache.org/spamassassin/IntegratedInMta  There are 
several milters which allow SpamAssassin to be called during the SMTP 
phase instead of the delivery stage (Appendix A).

>My desired behaviour would be:
>
>- Setup SpamAssassin at the "input" of the sendmail, so anybody 
>sending spam to me gets a "send failure".

That's how it works when you use a milter.

>- Configure the message saying "Your are suspected to send spam, if 
>you do not, go to this webpage (and give one under my apache) and 
>enter your e-mail address".

You should be able to tailor the reject message to say that.

>- Provide a phpscript that if one is entering a good e-mail address 
>by hand, the address is added to a "white-list" that allows his 
>mails to arrive me.

See http://wiki.apache.org/spamassassin/UsingSQL  Your PHP script can 
add the whitelisted address to the SQL db.

>E) What did I try (and did not run).
>
>if ( $SIZE < 262144 )
>{
>     ## 4.1 Spamassassin
>     xfilter "/usr/bin/spamc"
>
>     if (/^X-Spam-Flag: YES/)
>     {
>         echo "This server thinks this is spam."
>         echo "If this is not spam, call me at +34 630 59 01 62"
>         EXITCODE = 100
>         exit
>     }
>}

You cannot set a message during the delivery stage.

Regards,
-sm 


Re: Reject without accepting

Posted by John Rudd <jr...@ucsc.edu>.
Xavi Montero wrote:
> Hello.
> 
> I have SpamassAssin running but I want to change its behaviour.
> 
> Although I'm subscribed to this list from time ago, but this is my first 
> post (as far as I can remember). If this message is not adequate here, 
> please, redirect me to the correct place.
> 
> I have SpamAssassin in my Debian box (with sendmail). I have config A) 
> where spamassassin is run in the delivery stage of the sendmail (see the 
> apendixes below) and I desire behaviour B) where it is run at the 
> incoming stage so the spam is rejected and the sender cannot success at 
> sending it.
> 
> QUESTION-1: Is this possible?

Yes.  There's a group of utilities for sendmail called "milters", which 
are "mail filters" that run during the STMP session.

There are 2 I can directly think of that would help you.

mimedefang is the first one.  It's a great, and very flexible, utility 
... but it requires some expertise with the perl programming language.

amavis is the other one.  I know very little about amavis, but I know it 
has a milter capability, and can be used with spam assassin.

I think there's also a more direct "spam assassin milter", but I don't 
have any details about it.


> QUESTION-2: May I break this goal into small parts and achieve each 
> separately?

I'm not sure what you mean.  Do you mean a gradual phasing in of the new 
method?  You could, for example:

1) install mimedefang, and keep using spam assassin the way you currently do
2) move spam assassin to mimedefang instead of during delivery
3) change mimedefang's mimedefang-filter so that it rejects during SMTP 
instead of just adding headers

> QUESTION-3: Where do I have to start?

Google search for mimedefang and amavis and "spamassassin milter". 
Investigate each.  Find mailing lists for each.  As for help on those 
mailing lists.