Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

postfix+spamassassin=endless loop

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
7 posts • Page 1 of 1
Author
Message
kikawala
n00b
n00b
User avatar
Posts: 41
Joined: Tue Aug 20, 2002 11:46 pm
Location: Dallas, TX

postfix+spamassassin=endless loop

  • Quote

Post by kikawala » Mon Oct 27, 2003 5:08 pm

I'm trying to setup a postfix/spamassasin/amavis box to scan email from outside and then relay it to an exchange server.

I have configured postfix/spamassassin/amavis according to this post: http://forums.gentoo.org/viewtopic.php?t=34390

When I send any mail to the server the filter script runs over and over again. It looks like after the script scans the email for spam it sends it back to postfix and scans it again, and it does this in an endless loop. I want it to scan mail once and then relay it to the exchange server.

I know there is something I must be missing, but I can't figure it out.

Any suggestions?
Top
kikawala
n00b
n00b
User avatar
Posts: 41
Joined: Tue Aug 20, 2002 11:46 pm
Location: Dallas, TX

bump/update

  • Quote

Post by kikawala » Tue Oct 28, 2003 4:17 pm

Of course it does work when it is not setup to filter. It forwards mail to exchange, just not with filtering enabled.
Top
vbwiz
n00b
n00b
Posts: 8
Joined: Tue Oct 28, 2003 5:08 pm
Location: Belgium
Contact:
Contact vbwiz
Website

  • Quote

Post by vbwiz » Tue Oct 28, 2003 5:31 pm

Here's a part of my working configuration

You should configure the amavis interface in /etc/postfix/master.cf :

Code: Select all

smtp-amavis     unix    -       -       y       -       2       lmtp
        -o smtp_data_done_timeout=1200
        -o disable_dns_lookups=yes

127.0.0.1:10025 inet    n       -       y       -       -       smtpd
        -o content_filter=
        -o local_recipient_maps=
        -o relay_recipient_maps=
        -o smtpd_restriction_classes=
        -o smtpd_client_restrictions=
        -o smtpd_helo_restrictions=
        -o smtpd_sender_restrictions=
        -o smtpd_recipient_restrictions=permit_mynetworks,reject
        -o mynetworks=127.0.0.0/8
        -o strict_rfc821_envelopes=yes
Activate also the LMTP daemon by uncommenting the line.
(Change the "n" by "y" if you've chrooted Postfix)

Code: Select all

lmtp      unix  -       -       n       -       -       lmtp
The filter should be set in /etc/postfix/main.cf as

Code: Select all

content_filter = smtp-amavis:[127.0.0.1]:10024
Then define how amavis will transmit back the message to Postfix by setting the following variables in /etc/amavisd.conf

Code: Select all

$forward_method = 'smtp:127.0.0.1:10025';
$notify_method = $forward_method; 
The LMTP solution is the most easiest and efficient solution to use Postfix+Amavis+SpamAssassin in a gateway configuration; it's described in details in the README.LMTP of Amavis.

It seems you've forgotten to add -o content_filter= to the amavis smtpd.

Gilles.
Top
kikawala
n00b
n00b
User avatar
Posts: 41
Joined: Tue Aug 20, 2002 11:46 pm
Location: Dallas, TX

  • Quote

Post by kikawala » Wed Oct 29, 2003 7:00 pm

Thanks for signing up on the forums so you could help me. I've configured everything as in your post and now I am getting this:

Code: Select all

<hrk@companyname.com>: mail transport unavailable
note: I changed the domain from what it really is to 'companyname' in this post.
Top
vbwiz
n00b
n00b
Posts: 8
Joined: Tue Oct 28, 2003 5:08 pm
Location: Belgium
Contact:
Contact vbwiz
Website

  • Quote

Post by vbwiz » Wed Oct 29, 2003 8:39 pm

Thanks for signing up on the forums so you could help me.
:) I really like the trio Postfix - Amavis - SpamAssassin

It will be better if you can post the result of postconf -v and a log snip, but I think your problem is comming from the mydestination parameter in /etc/postfix/main.cf

Code: Select all

myhostname    = mail.companyname.com
mydomain        = companyname.com
mydestination   = $myhostname,
                          $mydomain,
                          localhost.$mydomain,
                          localhost
relay_domains  = $mydestination
If you host virtual domains, you should add each of them to the mydestination; you should also set the relay_domains to indicate for which domains Postfix accept to receive emails.

relay_domains is used together with the transport table. This table instruct Postfix to which server it should relay emails for a particular domain, but it's off topic.

I've exactly the same configuration as you on a Gentoo production server, 6000 emails received per day and about 40% is rejected thanks to Postfix and SA; most of the spam is rejected by the SMTP restrictions of Postfix only 5% is catched by SA. And since the introduction of the bayesian engine in SA a false positive is very rare. Nice solution!

Good luck!

Gilles.
Top
vbwiz
n00b
n00b
Posts: 8
Joined: Tue Oct 28, 2003 5:08 pm
Location: Belgium
Contact:
Contact vbwiz
Website

  • Quote

Post by vbwiz » Wed Oct 29, 2003 8:41 pm

Thanks for signing up on the forums so you could help me.
:) I really like the trio Postfix - Amavis - SpamAssassin

It will be better if you can post the result of postconf -v and a log snip, but I think your problem is comming from the mydestination parameter in /etc/postfix/main.cf

Code: Select all

myhostname    = mail.companyname.com
mydomain        = companyname.com
mydestination   = $myhostname,
                          $mydomain,
                          localhost.$mydomain,
                          localhost
relay_domains  = $mydestination
If you host virtual domains, you should add each of them to the mydestination; you should also set the relay_domains to indicate for which domains Postfix accept to receive emails.

relay_domains is used together with the transport table. This table instruct Postfix to which server it should relay emails for a particular domain, but it's off topic.

I've exactly the same configuration as you on a Gentoo production server, 6000 emails received per day and about 40% is rejected thanks to Postfix and SA; most of the spam is rejected by the SMTP restrictions of Postfix only 5% is catched by SA. And since the introduction of the bayesian engine in SA a false positive is very rare. Nice solution!

Good luck!

Gilles.
Top
Dr_Stein
Guru
Guru
Posts: 303
Joined: Fri Mar 21, 2003 3:12 am
Location: Mountain View, CA
Contact:
Contact Dr_Stein
Website

I've got the same problem

  • Quote

Post by Dr_Stein » Sun Dec 07, 2003 7:14 am

... works great when it's *not* set to relay, but once I tell Postfix to relay mail to its final destination, amavisd & spamassassin quits adding the appropriate headers.

Full headers:
Return-Path: <jnichols@exile.pbp.net>
Received: from test.pbp.net (unknown [192.168.10.41])
by mail.pbp.net (Postfix) with ESMTP id 4222711E0
for <jnichols@matrixdatatech.com>; Sat, 6 Dec 2003 23:08:22 -0800 (PST)
Received: from localhost (localhost [127.0.0.1])
by test.pbp.net (Postfix) with ESMTP id 2EC783C389
for <jnichols@matrixdatatech.com>; Sat, 6 Dec 2003 23:08:23 -0800 (PST)
Received: from test.pbp.net ([127.0.0.1])
by localhost (test [127.0.0.1]) (amavisd-new, port 10024) with LMTP
id 13600-01 for <jnichols@matrixdatatech.com>;
Sat, 6 Dec 2003 23:08:22 -0800 (PST)
Received: from exile.pbp.net (unknown [63.192.52.209])
by test.pbp.net (Postfix) with ESMTP id 882DF392E6
for <jnichols@matrixdatatech.com>; Sat, 6 Dec 2003 23:08:22 -0800 (PST)
Received: by exile.pbp.net (Postfix, from userid 1000)
id 0054622DF6; Sat, 6 Dec 2003 23:08:20 -0800 (PST)
To: jnichols@matrixdatatech.com
Subject: junk
Message-Id: <20031207070820.0054622DF6@exile.pbp.net>
Date: Sat, 6 Dec 2003 23:08:20 -0800 (PST)
From: jnichols@exile.pbp.net (Jonathan Nichols)
X-Virus-Scanned: by amavisd-new at test.pbp.net

Subject: Test spam mail (GTUBE)
Message-ID: <GTUBE1.1010101@example.net>
Date: Wed, 23 Jul 2003 23:30:00 +0200
From: Sender <sender@example.net>
To: Recipient <recipient@example.net>

-----
See? It adds the "X-Virus-Scanned" header before relaying it to the final destination.
Now, see what happens if I send to a "local" address. This is the *exact same* test spam sent from the same remote machine.

Return-Path: <jnichols@exile.pbp.net>
X-Original-To: jnichols@test.pbp.net
Delivered-To: jnichols@test.pbp.net
Received: from localhost (localhost [127.0.0.1])
by test.pbp.net (Postfix) with ESMTP id 9F1A73C389
for <jnichols@test.pbp.net>; Sat, 6 Dec 2003 23:12:07 -0800 (PST)
Received: from test.pbp.net ([127.0.0.1])
by localhost (test [127.0.0.1]) (amavisd-new, port 10024) with LMTP
id 13601-02 for <jnichols@test.pbp.net>;
Sat, 6 Dec 2003 23:12:07 -0800 (PST)
Received: from exile.pbp.net (unknown [63.192.52.209])
by test.pbp.net (Postfix) with ESMTP id 623BA392E6
for <jnichols@test.pbp.net>; Sat, 6 Dec 2003 23:12:07 -0800 (PST)
Received: by exile.pbp.net (Postfix, from userid 1000)
id D4EE822DF6; Sat, 6 Dec 2003 23:12:05 -0800 (PST)
To: jnichols@test.pbp.net
Subject: ***SPAM*** junk
Message-Id: <20031207071205.D4EE822DF6@exile.pbp.net>
Date: Sat, 6 Dec 2003 23:12:05 -0800 (PST)
From: jnichols@exile.pbp.net (Jonathan Nichols)
X-Virus-Scanned: by amavisd-new at test.pbp.net
X-Spam-Status: Yes, hits=1000.0 tagged_above=-999.0 required=5.0 tests=GTUBE
X-Spam-Level: ********************************************************
X-Spam-Flag: YES

Subject: Test spam mail (GTUBE)
Message-ID: <GTUBE1.1010101@example.net>
Date: Wed, 23 Jul 2003 23:30:00 +0200
From: Sender <sender@example.net>
To: Recipient <recipient@example.net>

------

It adds the headers!! But it will NOT add the headers/subject line when being sent to a "relayed" domain!!
It drives me nuts. My current solution is the amavis/anomy solution, but it is *not* scalable and quite easily overcome. The box scans & relays mail for about 15 domains at the present time.

Help? :)
Top
Post Reply

7 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic