Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 02-15-2012, 09:17 AM   #1
LQ Newbie
Registered: Feb 2012
Posts: 8

Rep: Reputation: Disabled
Block outgoing mail for specific users

Good morning! I would like to make it so certain users can only send mail internally. I'm using postfix, spamassassin and amavis with procmail. I can't figure out how to simply filter outgoing mail with procmail. My intention was to use procmail to filter outgoing and write two rules for each of these users. The first rule would allow them to send to the local domain. The second would block anything else they send. Like this...

* ^
* ^To:.*


Can anyone help? This is a fix in lieu of building a separate secure email server with SSL, TLS and all that for secure communications only. I thought, theoretically, these rules should work as they are processed in order. If a mail matching the first rule goes through procmail stops processing, but postfix is obviously not using procmail for outbound. What's sad is I had this working at one point and now I don't know what I changed to break it.
Old 02-15-2012, 02:46 PM   #2
Senior Member
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
good morning, austin001, and welcome to lq.

regarding your question, you can't filter outgoing mail with procmail, since procmail is called at the time of delivery. you need to filter the mail at the time of submission. this may be sufficient for your needs.
Old 02-27-2012, 03:51 PM   #3
LQ Newbie
Registered: Feb 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
Spectactular! Works Beautifully! I read at least 50 other posts before posting this question. Everyone else leaves out the local_domains part, which is the key.


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
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
How to block users from sending e-mail to specific domain satish_k Linux - Newbie 1 03-12-2008 10:53 PM
Send outgoing mail to a specific IP address and port starkhorn Linux - Software 1 01-31-2008 05:20 PM
Iptables/Guarddog - how to block specific outgoing packets craftybytes Linux - Security 7 05-19-2006 12:26 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:58 PM.

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