Got it.

I created /etc/exim/email_users containing a list of acceptable local parts of 
email addresses and full names
eg [email protected]<mailto:[email protected]> => abc

- - 8< - - - email_users - - - - - - - - - - - - -
abc: Abel Cain
john: John Doe
jane: Jane Doe
...
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

...and added the following line to the acl_check_rcpt: section of the 
/etc/exim/exim.conf file
drop      message              = DROPPED - Recipient NOT ON accept list
                !local_parts        = lsearch;/etc/exim/email_users

Now telnet into port 25 to create email gives....

220 Baruwa 2.0 Wed, 19 Jun 2013 10:49:05 +0100
helo rpf-ext
250 marge.mydomain.ext Hello rpf-ext [192.168.0.109]
mail from: [email protected]
250 OK
rcpt to: [email protected]
550 DROPPED - Recipient NOT ON accept list

ALTERNATIVE
added these lines to exim.conf instead of the above ones...
discard
                !local_parts        = lsearch;/etc/exim/email_users

220 Baruwa 2.0 Wed, 19 Jun 2013 10:57:35 +0100
helo rpf-ext
250 marge.mydomain.ext Hello rpf-ext [192.168.0.109]
mail from: [email protected]
250 OK
rcpt to: [email protected]
250 Accepted
data
354 Enter message, ending with "." on a line by itself
subject: I think I've sent this

I think I sent this
.
250 OK id=1UpF9c-0001cu-JY

BUT THE MESSAGE IS SILENTLY DROPPED... tail /var/log/exim/main.log shows...
2013-06-19 11:04:30 H=(rpf-ext) [192.168.0.109] F=<[email protected]> 
rejected RCPT [email protected]: discarded by RCPT ACL
2013-06-19 11:04:47 1UpF9c-0001cu-JY <= [email protected] H=(rpf-ext) 
[192.168.0.109] P=smtp S=224
2013-06-19 11:04:47 1UpF9c-0001cu-JY => blackhole (RCPT ACL discarded 
recipients)
2013-06-19 11:04:47 1UpF9c-0001cu-JY Completed

Ritchie

From: [email protected] [mailto:[email protected]] 
On Behalf Of Ritchie P. Fraser
Sent: 18 June 2013 16:19
To: Baruwa users list
Subject: Re: [Baruwa] Rejecting mail for unrecognised recipients

thanks,

I've got exim rather than postfix, but I'll give it a go...

R

From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of marco rosenstein
Sent: 18 June 2013 15:50
To: Baruwa users list
Subject: Re: [Baruwa] Rejecting mail for unrecognised recipients

if you are using postfix like I am, you can set up a list called 
relay_recipients with all your users in it in this format:

[email protected]<mailto:[email protected]>          OK

add the line to your postfix main.cf file like this

relay_recipient_maps = hash:/etc/postfix/relay_recipients

pointing to where ever your file is.

Then after you compile the list, run

postmap /etc/postfix/relay_recipients

run that any time you edit the list.

You can pull your AD users and export them to the list also.  Follow point 17 
of this tutorial:

http://www.howtoforge.com/the-perfect-spamsnake-ubuntu-jeos-12.04-lts-precise-pangolin-p4

You can set this to run as a script to keep this list updated and automatically 
"postmapped".

I imagine you can use a similar setup for exim or whatever mail you are using.
________________________________
From: [email protected]<mailto:[email protected]>
To: [email protected]<mailto:[email protected]>
Date: Tue, 18 Jun 2013 11:13:16 +0000
Subject: [Baruwa] Rejecting mail for unrecognised recipients
Hi,

How do I set up Baruwa to reject / not accept email for addresses that are NOT 
on a list (or in the Baruwa DB)?

Kind Regards,
Ritchie Fraser
Systems Administrator

T : +44 (0) 1304 840506
F : +44 (0) 1304 840075
W : http://www.marinesoftware.co.uk

Marine Software Limited
Planned Maintenance, Stock Control, Project (Refit) Management, Purchasing,
Safety and ISM Document Management systems for the Marine Industry since 1991.
---------------------------------------------------------------------------------------------------------------------------
Unless otherwise agreed expressly in writing by Marine Software Limited, This 
communication and attachments are to be treated as confidential and the 
information in it may not be used or disclosed except for the purpose for which 
it was sent. If you are not the intended recipient of this communication you 
should notify the sender immediately, then destroy it without copying, 
disclosing or otherwise using its contents. Marine Software Limited. Registered 
in England & Wales. No 2576494 Registered Office. 4 Ozengell Place, Eurokent 
Business Park, Ramsgate. Kent. United Kingdom. Internet communications cannot 
be guaranteed to be secure or error-free as information could be intercepted, 
corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. 
Therefore, we do not accept responsibility for any errors or omissions that are 
present in this message, or any attachment, that have arisen as a result of 
e-mail transmission. Any views or opinions presented are solely those of the 
author and do not necessarily represent those of the company.


_______________________________________________ 
http://pledgie.com/campaigns/12056
_______________________________________________
http://pledgie.com/campaigns/12056

Reply via email to