1

Topic: Local Subnet Delivery Only and Filtering

Hi:

I need to run iRemail in a unique development scenario.  No mail can leave the subnet and we need to filter internal mail based on source IP address.  We're a development shop and we need to test our software against an MTA but not send to real outside clients.

I've found a few generic solutions on Google but I need something iRedmail specific that deals with LDAP, Sieve and Header_Checks. So the following needs to happen:

1) Local subnet mail delivery only using iRedmail
2) If mail comes from a specific internal IP address on the subnet redirect it to a specific mail box on iRedmail server. (Note: The To: field can be anything, it's basically ignored).

Any help greatly appreciated.

Cheers,
Dave Cook
Director
Gridworkz

2

Re: Local Subnet Delivery Only and Filtering

quasimotoca wrote:

2) If mail comes from a specific internal IP address on the subnet redirect it to a specific mail box on iRedmail server. (Note: The To: field can be anything, it's basically ignored).

If postfix hosts domain example.com, all mails sent to XXX@example.com will be delivered to local mailboxes. So why not sent your testing mails to users under this virtual mail domain so that all mails won't be delivered to outside?

3

Re: Local Subnet Delivery Only and Filtering

Wow, thanks for the quick reply! Much appreciated.  How would that work?
Cheers,
Dave

4

Re: Local Subnet Delivery Only and Filtering

No addition work/modification is required.

- Create a virtual mail domain (such as abc.com, yes, the domain is not required to be an exist domain name)
- Craete several mail users under this domain
- Send your testing emails to these mail users, all mails will be delivered to local mailboxes.

5

Re: Local Subnet Delivery Only and Filtering

Sorry for the double post.  I forgot to add something.  I currently host internal.avema.net with iRedmail on the internal network. So should I create another internal domain?  The To: address can actually come from anywhere i.e fred@anywhere.com.  The mail needs to be routed based on the source IP of the developers machine (or) a server.  So I need to setup filtering something like this:

if header :contains: "Received" "192.168.4.215" {
    redirect "developer@internal.avema.net";
} elsif header contains: "Received" "192.168.4.31" {
    redirect "server@internal.avema.net";
} else {
    keep;
}

Something along those lines is what I'm trying to do. 

Cheers,
Dave

6

Re: Local Subnet Delivery Only and Filtering

You can try postfix header_checks with REDIRECT action. Reference: http://www.postfix.org/access.5.html

I didn't test this before, so i don't promise it will work for you as expected.

Good luck smile

7

Re: Local Subnet Delivery Only and Filtering

Thanks, do I edit header_checks or header_checks.pcre? Basically, how do I postmap it under iRedmail?
Cheers,
Dave

8

Re: Local Subnet Delivery Only and Filtering

You need to edit header_checks.pcre, after modification, run:

# postmap hash:/etc/postfix/header_checks.pcre

9

Re: Local Subnet Delivery Only and Filtering

I'm getting closer - How do I postmap an entry to: ldap_virtual_alias_maps.cf ?
Cheers,
Dave