From: Jonathan Amiez on
Hello everyone.

I'm trying to set up a specific mail server configuration on 3 sites.
The first one is hosting a mailhub (with spam filter, etc.) and the
2 others are agencies.
The 2 agencies use the same domain (eg. edatis.com) for mailing.
I'm currently working on the first agency's server.
Accounts are stored in MySQL db replicated on the 2 sites from the hub.

So, my problem is : if I don't care about "transport" statements, all mail is
delivered on the local agency server, and if I do, mail is directly sent to
the other agency, without passing by the mailhub.
I need all outgoing email (remote agency or internet) to pass by the hub.

I found very few inaccurate info about this setup (seems kind of unusual) so
I'm asking for help. The objective is also supporting an undefined number of
agency with this principle.

Here are my conf files :
#####################################
#### main.cf ####
smtpd_banner = $myhostname ESMTP
biff = no
append_dot_mydomain = no

mydomain = edatis.net
myhostname = hermes-test.$mydomain
myfullhostname = $myhostname
mynetworks = 127.0.0.0/8 192.168.0.0/22
myorigin = $myhostname
mydestination = $myhostname, localhost.$mydomain, , localhost
inet_interfaces = all

#virtual_alias_domains
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virt-users.cf
proxy:mysql:/etc/postfix/mysql-virt-aliases.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virt-domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virt-boxes.cf
virtual_mailbox_base = /home/mail
virtual_uid_maps = static:103
virtual_gid_maps = static:107
relay_transport = smtp:mxhub.edatis.com
#relayhost = mxhub.edatis.com
transport_maps = proxy:mysql:/etc/postfix/mysql-virt-transports.cf

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mailbox_size_limit = 0
recipient_delimiter = +

#### mysql-virt-aliases.cf ####
hosts = 127.0.0.1
user = x
password = y
dbname = maildbs
query = SELECT dest FROM aliases, domains WHERE aliases.local_part='%u' AND
domains.name='%d' AND aliases.domain_id=domains.id

#### mysql-virt-boxes.cf ####
hosts = 127.0.0.1
user = x
password = y
dbname = maildbs
query = SELECT CONCAT(domains.name,'/',users.local_part,'/') FROM users,
domains WHERE users.local_part='%u' AND domains.name='%d' AND
users.domain_id=domains.id

#### mysql-virt-domains.cf ####
hosts = 127.0.0.1
user = x
password = y
dbname = maildbs
query = SELECT name FROM domains WHERE name='%s'

#### mysql-virt-transports.cf ####
hosts = 127.0.0.1
user = x
password = y
dbname = maildbs
query = SELECT CONCAT('smtp:',agences.server) FROM agences,users,domains WHERE
agences.id=users.server_id and domains.id=users.domain_id and
domains.name='%d' and users.local_part='%u'

#### mysql-virt-users.cf ####
hosts = 127.0.0.1
user = x
password = y
dbname = maildbs
query = SELECT CONCAT(users.local_part, '@', domains.name) FROM users, domains
WHERE users.local_part='%u' AND domains.name='%d' AND
users.domain_id=domains.id
#####################################

Let me know if you need more details
Thanks by advance
Regards
--
***************************
Jonathan Amiez
Administrateur système
ja(a)edatis.com
it-paris(a)edatis.com
admin(a)edatis.com
***************************

From: mouss on
Jonathan Amiez a �crit :
> Hello everyone.
>
> I'm trying to set up a specific mail server configuration on 3 sites.
> The first one is hosting a mailhub (with spam filter, etc.) and the
> 2 others are agencies.
> The 2 agencies use the same domain (eg. edatis.com) for mailing.
> I'm currently working on the first agency's server.
> Accounts are stored in MySQL db replicated on the 2 sites from the hub.
>
> So, my problem is : if I don't care about "transport" statements, all mail is
> delivered on the local agency server, and if I do, mail is directly sent to
> the other agency, without passing by the mailhub.
> I need all outgoing email (remote agency or internet) to pass by the hub.
>
> I found very few inaccurate info about this setup (seems kind of unusual) so
> I'm asking for help. The objective is also supporting an undefined number of
> agency with this principle.
>
> Here are my conf files :
> [snip]

by default, mail goes to the MX of the domain. you can override that
with local transport maps, but these maps only apply to you infrastructure.

if you want mail to go to joe.example.com, you need to configure an MX
record in DNS:

example.com. MX 10 joe.example.com.

(Warning: the leading dots aren't just for decoration).

an excellent DNS resource is:
http://www.zytrax.com/books/dns/

From: Jonathan Amiez on
Hello,

First of all, thanks mouss for the reply.

I have made few steps forward in my hub and spoke setup.
I set up the hub which is forwarding mail to the agencies' server based on a
MySQL table.

The problem is located on agencies' servers. As I first said, I have only 1
domain.
When I want to send a mail to a user from the other site (and same domain), I
get this error:
"Recipient address rejected: User unknown in virtual mailbox table".

Indeed, the 2 agencies' servers are setup to be the final destination for the
same domain.
I tried the "relay_recipient_maps" directive with no success.

Could someone help me please?
Let me know if you need more accurate details.
Best regards.
--
***************************
Jonathan Amiez
Administrateur système
ja(a)edatis.com
it-paris(a)edatis.com
admin(a)edatis.com
***************************
Le samedi 26 juin 2010 00:01:27, mouss a écrit :
> Jonathan Amiez a écrit :
> > Hello everyone.
> >
> > I'm trying to set up a specific mail server configuration on 3 sites.
> > The first one is hosting a mailhub (with spam filter, etc.) and the
> > 2 others are agencies.
> > The 2 agencies use the same domain (eg. edatis.com) for mailing.
> > I'm currently working on the first agency's server.
> > Accounts are stored in MySQL db replicated on the 2 sites from the hub.
> >
> > So, my problem is : if I don't care about "transport" statements, all
> > mail is delivered on the local agency server, and if I do, mail is
> > directly sent to the other agency, without passing by the mailhub.
> > I need all outgoing email (remote agency or internet) to pass by the hub.
> >
> > I found very few inaccurate info about this setup (seems kind of unusual)
> > so I'm asking for help. The objective is also supporting an undefined
> > number of agency with this principle.
> >
> > Here are my conf files :
> > [snip]
>
> by default, mail goes to the MX of the domain. you can override that
> with local transport maps, but these maps only apply to you infrastructure.
>
> if you want mail to go to joe.example.com, you need to configure an MX
> record in DNS:
>
> example.com. MX 10 joe.example.com.
>
> (Warning: the leading dots aren't just for decoration).
>
> an excellent DNS resource is:
> http://www.zytrax.com/books/dns/

 | 
Pages: 1
Prev: performance tuning - relay
Next: Mail discarded