Postfix relay to Exchange server

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Postfix relay to Exchange server

Alejandro Facultad
Dear all, I have a Postfix mail server that has to receive the incoming
mail from Internet for a domain called "alejandro.com" and them relay
the mail to an Exchamge server. I need to relay mail to ALL the accounts.

If I add these lines to main.cf:

relay_domains = alejandro.com
transport_maps = hash:/etc/postfix/transport

Does it work or do I have to also add:

relay_recipient_maps = hash:/etc/postfix/relay_recipients

I think I don't need a "relay_recipients" file containing the Exchange server accounts I want to relay mail to, because I want to relay mail to ALL the Exchange accounts.

Special thanks

Alejandro


Reply | Threaded
Open this post in threaded view
|

Re: Postfix relay to Exchange server

Joe-274
Alejandro Facultad wrote:

> Dear all, I have a Postfix mail server that has to receive the incoming
> mail from Internet for a domain called "alejandro.com" and them relay
> the mail to an Exchamge server. I need to relay mail to ALL the accounts.
>
> If I add these lines to main.cf:
>
> relay_domains = alejandro.com
> transport_maps = hash:/etc/postfix/transport
>
> Does it work or do I have to also add:
>
> relay_recipient_maps = hash:/etc/postfix/relay_recipients
>
> I think I don't need a "relay_recipients" file containing the Exchange
> server accounts I want to relay mail to, because I want to relay mail to
> ALL the Exchange accounts.


So, how will you know which addresses are valid and should be forwarded
to exchange, and which addresses are invalid and should be rejected? If
you forward everything to exchange, you will have created a backscatter
source.

Joe

Reply | Threaded
Open this post in threaded view
|

Re: Postfix relay to Exchange server

Alejandro Facultad
Joe Sloan escribió:

> Alejandro Facultad wrote:
>> Dear all, I have a Postfix mail server that has to receive the
>> incoming mail from Internet for a domain called "alejandro.com" and
>> them relay the mail to an Exchamge server. I need to relay mail to
>> ALL the accounts.
>>
>> If I add these lines to main.cf:
>>
>> relay_domains = alejandro.com
>> transport_maps = hash:/etc/postfix/transport
>>
>> Does it work or do I have to also add:
>>
>> relay_recipient_maps = hash:/etc/postfix/relay_recipients
>>
>> I think I don't need a "relay_recipients" file containing the
>> Exchange server accounts I want to relay mail to, because I want to
>> relay mail to ALL the Exchange accounts.
>
>
> So, how will you know which addresses are valid and should be
> forwarded to exchange, and which addresses are invalid and should be
> rejected? If you forward everything to exchange, you will have created
> a backscatter source.
>
> Joe
>
>
>
OK Joe, thanks.

And finally, what is the format of the relay_recipient file ???

Maybe this:

[hidden email]
[hidden email]
...
[hidden email]

Special thanks


Reply | Threaded
Open this post in threaded view
|

Re: Postfix relay to Exchange server

Bugzilla from j@mesrobertson.com
Hi Alejandro,

I use a perl script that I found on the net that does an LDAP query
against the DC's on your network and populates relay recipients in the
correct format.

http://www-personal.umich.edu/~malth/gaptuning/postfix/getadsmtp.pl

And then setup cron to update during the day and whatever interval you like.

There might be a better way to do it but it works for me and won't
reject mail if the Exchange Server is down and stops Back Scatter.

I use a script like this to update

#!/bin/bash

# exupdate.sh script
# Author James Robertson - 3rdmill
# Version 0.2 20080325

# update the backup file
rm -f /etc/postfix/exchange_recipients_old
cp /etc/postfix/exchange_recipients /etc/postfix/exchange_recipients_old

# Run getadsmtp.pl and populate exchange_recipients
cd /etc/postfix ; ./getadsmtp.pl

# Remove any duplicates
cat /etc/postfix/exchange_recipients_tmp |  awk ' !x[$0]++' >
/etc/postfix/exchange_recipients

# Create exchange_recipients.db
postmap /etc/postfix/exchange_recipients

# Remove the temporary file
rm -f /etc/postfix/exchange_recipients_tmp

Alejandro Facultad wrote:

> Joe Sloan escribió:
>> Alejandro Facultad wrote:
>>> Dear all, I have a Postfix mail server that has to receive the
>>> incoming mail from Internet for a domain called "alejandro.com" and
>>> them relay the mail to an Exchamge server. I need to relay mail to
>>> ALL the accounts.
>>>
>>> If I add these lines to main.cf:
>>>
>>> relay_domains = alejandro.com
>>> transport_maps = hash:/etc/postfix/transport
>>>
>>> Does it work or do I have to also add:
>>>
>>> relay_recipient_maps = hash:/etc/postfix/relay_recipients
>>>
>>> I think I don't need a "relay_recipients" file containing the
>>> Exchange server accounts I want to relay mail to, because I want to
>>> relay mail to ALL the Exchange accounts.
>>
>>
>> So, how will you know which addresses are valid and should be
>> forwarded to exchange, and which addresses are invalid and should be
>> rejected? If you forward everything to exchange, you will have
>> created a backscatter source.
>>
>> Joe
>>
>>
>>
> OK Joe, thanks.
>
> And finally, what is the format of the relay_recipient file ???
>
> Maybe this:
>
> [hidden email]
> [hidden email]
> ...
> [hidden email]
>
> Special thanks
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Postfix relay to Exchange server

Victor Duchovni
In reply to this post by Alejandro Facultad
On Tue, Jun 24, 2008 at 11:43:37PM -0300, Alejandro Facultad wrote:

> Does it work or do I have to also add:
>
> relay_recipient_maps = hash:/etc/postfix/relay_recipients
>

main.cf
        parent_domain_matches_subdomains = smtpd_access_maps
        # Domain only, not sub-domains.
        relay_domains = example.com
        relay_recipient_maps = ldap:/etc/postfix/ad.cf

ad.cf:
        # Standard for querying Active Directory.
        version = 3
        query_filter = proxyAddresses=smtp:%s
        result_attribute = mail
        # Adjust these to match your site:
        domain = example.com
        server_host = ad1.example.com ad2.example.com
        bind_dn = query_user
        bind_pw = query_password
        search_base = dc=example, dc=com

If the query load is too high from dictionary attacks, deploy a dedicated
replica server for Postfix to query.

--
        Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:[hidden email]?body=unsubscribe%20postfix-users>

If my response solves your problem, the best way to thank me is to not
send an "it worked, thanks" follow-up. If you must respond, please put
"It worked, thanks" in the "Subject" so I can delete these quickly.
Reply | Threaded
Open this post in threaded view
|

Re: Postfix relay to Exchange server

Joe-274
In reply to this post by Alejandro Facultad
Alejandro Facultad wrote:

> Joe Sloan escribió:
>> Alejandro Facultad wrote:
>>> Dear all, I have a Postfix mail server that has to receive the
>>> incoming mail from Internet for a domain called "alejandro.com" and
>>> them relay the mail to an Exchamge server. I need to relay mail to
>>> ALL the accounts.
>>>
>>> If I add these lines to main.cf:
>>>
>>> relay_domains = alejandro.com
>>> transport_maps = hash:/etc/postfix/transport
>>>
>>> Does it work or do I have to also add:
>>>
>>> relay_recipient_maps = hash:/etc/postfix/relay_recipients
>>>
>>> I think I don't need a "relay_recipients" file containing the
>>> Exchange server accounts I want to relay mail to, because I want to
>>> relay mail to ALL the Exchange accounts.
>>
>>
>> So, how will you know which addresses are valid and should be
>> forwarded to exchange, and which addresses are invalid and should be
>> rejected? If you forward everything to exchange, you will have created
>> a backscatter source.
>>
>> Joe
>>
>>
>>
> OK Joe, thanks.
>
> And finally, what is the format of the relay_recipient file ???
>
> Maybe this:
>
> [hidden email]
> [hidden email]
> ...
> [hidden email]


The relay_recipient file should be like this -
---
[hidden email] OK
[hidden email] OK
....
[hidden email] OK
---

Joe