LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Sendmail access.db question (https://www.linuxquestions.org/questions/linux-server-73/sendmail-access-db-question-805778/)

snorket27 05-04-2010 02:00 AM

Sendmail access.db question
 
Hello. I've got a request from one of my company's subsidiaries to block all incoming and outgoing mail for a group of users. I've read up some guides on access.db and I know how to do that, but now they want to allow these users to receive emails from a few select domains, and block the rest.

To summarize:

1) Block all incoming and outgoing email to users in team A, except mail from gooddomain.com.
2) All other users can receive and send mail from/to any domain.

How do I do that?

bathory 05-04-2010 07:15 AM

Hi and welcome to LQ

For the incoming you'll need procmail, that comes with most distros. Create or edit /etc/procmailrc (if teamA has a homedir it's better to use ~/.procmailrc) and use the following:
Code:

:0
* ! ^From:.*gooddomain.com
To: teamA@mydomain.com
/dev/null

If you use ~/.procmailrc the line "To: ..." is not needed

For the outgoing, edit /etc/mail/access and use
Code:

From:teamA@mydaomain.com REJECT
The run
Code:

makemap hash /etc/mail/access < /etc/mail/access
Regards

snorket27 05-05-2010 03:15 AM

Thanks bathory. I'll give it a try.


All times are GMT -5. The time now is 01:16 AM.