LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Block outgoing mail for specific users (https://www.linuxquestions.org/questions/linux-server-73/block-outgoing-mail-for-specific-users-929483/)

austin001 02-15-2012 09:17 AM

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...

:0:
* ^From.user@ourdomain.org
* ^To:.*ourdomain.org
${DEFAULT}


:0
*^From:.user@ourdomain.org
/dev/null

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.

Berhanie 02-15-2012 02:46 PM

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.

austin001 02-27-2012 03:51 PM

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.


All times are GMT -5. The time now is 02:32 AM.