LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 05-10-2012, 09:25 AM   #1
bas_at_cipix
LQ Newbie
 
Registered: Jul 2011
Posts: 2

Rep: Reputation: Disabled
Postfix: block outgoing mail to any domain except one


We have a development server for web development. The websites may send (automatic) e-mails from time to time. We want to make sure that e-mails sent by these websites on the development server are blocked by postfix, so that they are never sent over port 25 at all, but simply discarded, except for if it is sent to our own domain XXXXX.nl.

I've tried to use postfix for this purpose but I just can't get it to work.

I tried rejecting everything in smtpd_sender_restrictions and smtpd_recipient_restrictions, but when I execute "mail someone@gmail.com" the e-mails are sent.

Is there ANY way to do this and how?

Last edited by bas_at_cipix; 05-10-2012 at 09:27 AM.
 
Old 05-10-2012, 04:13 PM   #2
ceyx
Member
 
Registered: May 2009
Location: Fort Langley BC
Distribution: Ubuntu 11, Arch, / Gnome 3.X, OSX,Windows
Posts: 179

Rep: Reputation: 37
You might look at iptables. Block port 25 to all but your specific IP.

There are lots of how-to's out there. This one may give you some hints : http://www.thegeekstuff.com/2011/06/...ules-examples/ ( ie modify # 9 from port 22 to port 25 )

Last edited by ceyx; 05-10-2012 at 04:15 PM.
 
Old 05-11-2012, 09:50 AM   #3
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Ubuntu 10.10, Slackware 64-current
Posts: 2,124

Rep: Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776
The problem with blocking the domains with IPTables is that you will build up a massive queue of outbound emails that Postfix will attempt to deliver for 60 days. You really need to get the Sender Restrictions to work. I realize that you tried this approach without success, but I can't comment on your approach without additional details. This will require a combination of a (outbound) recipient list that pattern matches the domain, followed by a reject everything else created with a combination of a filter file and the restrictions put in place in your main.cf file.
I think you want to use either "reject_unlisted_recipient" or "check_recipient_access". Whether or not these will block everything else will then depend upon your settings in main.cf. At a minimum, I think you will need to use "smtpd_reject_unlisted_recipient". See the following page for details: http://www.postfix.org/postconf.5.ht...sted_recipient
 
1 members found this post helpful.
  


Reply

Tags
email, outgoing, postfix


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
Block outgoing mail for specific users austin001 Linux - Server 2 02-27-2012 03:51 PM
How to block all outgoing port 25 except internal mail server. sattech2000 *BSD 9 04-25-2011 09:23 AM
how to do outgoing mail only to a specific domain orko Linux - Server 1 07-17-2010 01:49 PM
postfix filter outgoing mail by sender domain dmfelix Linux - Server 2 06-18-2010 03:32 AM
Postfix emails send outgoing mail with wrong domain name michael.smith Ubuntu 2 01-30-2010 12:23 AM


All times are GMT -5. The time now is 09:45 AM.

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