LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 08-22-2009, 02:20 PM   #1
Gethyn
Member
 
Registered: Aug 2003
Location: UK
Distribution: (X)Ubuntu 10.04/10.10, Debian 5, CentOS 5
Posts: 900

Rep: Reputation: 32
Rejecting mail where sender matches recipient in postfix


Hi all,

This seems like a relatively simple question, but I haven't been able to figure it out from the documentation after a couple of hours of searching. I'm running postfix on my mail server, and the vast majority of my spam has the sender address spoofed to match the recipient address. I've got spamassassin up and running, and very little gets through that, so it's not a serious problem, but if possible I would like to be able to reject the mail before it arrives to reduce the system load.

Mail is sent locally via webmail, relaying is denied, so the only way that mail should be sent from the domain is via a connection from localhost. The basic idea I'm thinking of is if the MAIL FROM sender claims to be an address at the receiving domain, but is connected from a remote IP, the mail should be rejected. Is there any way of doing this?

Thank you!
 
Old 08-22-2009, 02:37 PM   #2
walruz
Member
 
Registered: Aug 2009
Location: Buenos Aires
Distribution: Debian/GNU Linux
Posts: 35

Rep: Reputation: 17
Hello there, Gethyn. Do you use RBLs like zen.spamhaus? Do you make all your users validate through SASL? Is your mail server used ONLY by the webmail app?
 
Old 08-22-2009, 04:03 PM   #3
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
Hi, Gethyn.

As walruz mentions, spamhaus does eliminate a lot of spam. But, see below for the solution you wanted.

Quote:
The basic idea I'm thinking of is if the MAIL FROM sender claims to be an address at the receiving domain, but is connected from a remote IP, the mail should be rejected. Is there any way of doing this?
You could do something like this:
Code:
# main.cf

smtpd_sender_restrictions = 
  permit_mynetworks
  check_sender_access hash:/etc/postfix/sender_access
Code:
# sender_access

example.com    REJECT
The point is that local connections would be allowed by the permit_mynetworks, but remote connections would be subject to the check_sender_access.
Also take a look at reject_unlisted_sender, which does something a little different. See the postconf(5) man page.
 
Old 08-23-2009, 10:51 AM   #4
Gethyn
Member
 
Registered: Aug 2003
Location: UK
Distribution: (X)Ubuntu 10.04/10.10, Debian 5, CentOS 5
Posts: 900

Original Poster
Rep: Reputation: 32
Hey guys,

Thanks for your responses. I use RBLs in spamassassin, but I am very cagey about using them to reject messages outright at the postfix level because of the danger of losing mail. The people I'm working for at the moment have lost a number of messages from clients whose ISP mailservers have inadvertently ended up on a RBL somewhere (I didn't set up their mail system, I hasten to add!). However, the check_sender_access change suggested by Berhanie appears to be exactly what I want, I just tested it and it's looking good.

Thank you for showing me how to sort this problem out!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
POSTFIX how to block/delete mail from sender... hct224 Linux - Newbie 5 12-29-2009 10:11 PM
Split postfix sender mail traffic gabsik Linux - Server 3 07-04-2008 06:07 PM
Postfix: Is it possible to rewrite sender address only for selective recipient? Akhran Linux - Software 3 08-15-2006 10:48 AM
postfix problem:: Internet recipient cannot receive mail adrianmak Linux - Software 2 08-16-2005 05:30 AM
Help with Sendmail filters for outgoing mail by sender/recipient gljoe Linux - Software 18 08-12-2003 08:56 PM


All times are GMT -5. The time now is 04:05 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration