Re: Per User Relay to From Old to New Postfix

2019-10-17 Thread Asai

Use a HASH table before implementing this in SQL.

/etc/postfix/main.cf:
 transport_maps =
hash:/etc/postfix/transport ..whatever you already have...

/etc/postfix/transport:
 u...@test.comsmtp:[the old machine]

# postmap hash:/etc/postfix/transport
# postfix reload
# postmap -q u...@test.com hash:/etc/postfix/transport
smtp:[the old machine]

Once you have that working, start playing with SQL.

Wietse


Thank you, Wietse, using a hash table worked;



Re: Per User Relay to From Old to New Postfix

2019-10-17 Thread Wietse Venema
Asai:
> 
> > The following uses two transport maps and no changes in
> > relay_recipient_maps:
> >
> > Assuming that both machines will accept mail for every
> > user@the-domain-in-question:
> >
> > - One transport map on the new machine, that sends mail for
> > non-migrated user@the-domain-in-question to the old machine.
> >
> > - One transport map on the old machine, that sends mail for migrated
> > user@the-domain-in-question to the new machine.
> >
> > To migrate a user, delete her from the transport map on the new
> > machine before adding her to the transport map on the old machine,
> > otherwise mail will loop.
> >
> > Wietse
> 
> Thank you, Wietse,
> 
> In testing this, on the old server I have my transport_maps directive 
> pointing to a mysql table, with the following query and table:
> 
> /SELECT nexthop FROM transport_map WHERE user = '%u'/
> 
> /transport_map table below:/
> 
> usernexthop
> 
> u...@test.comsmtp:[10.10.10.199]

Use a HASH table before implementing this in SQL.

/etc/postfix/main.cf:
transport_maps = 
hash:/etc/postfix/transport ..whatever you already have...

/etc/postfix/transport:
u...@test.comsmtp:[the old machine]

# postmap hash:/etc/postfix/transport
# postfix reload
# postmap -q u...@test.com hash:/etc/postfix/transport
smtp:[the old machine]

Once you have that working, start playing with SQL.

Wietse


Re: Per User Relay to From Old to New Postfix

2019-10-17 Thread Jaroslaw Rafa
Dnia 16.10.2019 o godz. 15:46:19 Asai pisze:
> 
> Our organization is deploying a new upgraded Postfix server and
> we're looking for various options to migrate users from the old to
> the new.  One possibility, we hope, is to do it on a per user basis
> rather than doing it all at once for a whole domain (which is also
> viable, but seems to result in more downtime for users until IT
> staff can make their rounds to their computers).

Do you really have to change anything on users' computers?
I would suggest the following approach:
1) Find some time when the mail system is relatively quiet, and sync the
mail storage from the old server to the new one. Then, make the old server
use the new storage (depends on how you store the mail: if you use regular
directories on filesystem, NFS mount them from new server to old one; if you
use some kind of database, change config on the old server to use database
from the new one - might require shutting down the mail system for a short
while). You've done the hardest part IMHO :)
2) Sync user database from the old server to the new one and make the old
server use the new database (again, depends on how you store the user
information - plain /etc/passwd&/etc/shadow, NIS, some kind of virtual users
in a SQL database etc.)
3) Change the entries in DNS so that A/MX records that were used by the old
server point to new IP address.

As DNS change propagates, new server should graually take over handling mail
with almost nobody noticing it :)
-- 
Regards,
   Jaroslaw Rafa
   r...@rafa.eu.org
--
"In a million years, when kids go to school, they're gonna know: once there
was a Hushpuppy, and she lived with her daddy in the Bathtub."


Re: Per User Relay to From Old to New Postfix

2019-10-16 Thread Asai



The following uses two transport maps and no changes in
relay_recipient_maps:

Assuming that both machines will accept mail for every
user@the-domain-in-question:

- One transport map on the new machine, that sends mail for
non-migrated user@the-domain-in-question to the old machine.

- One transport map on the old machine, that sends mail for migrated
user@the-domain-in-question to the new machine.

To migrate a user, delete her from the transport map on the new
machine before adding her to the transport map on the old machine,
otherwise mail will loop.

Wietse


Thank you, Wietse,

In testing this, on the old server I have my transport_maps directive 
pointing to a mysql table, with the following query and table:


/SELECT nexthop FROM transport_map WHERE user = '%u'/

/transport_map table below:/

user                        nexthop

u...@test.com    smtp:[10.10.10.199]

However, this doesn't seem to be doing anything.  Sending email to the 
user results in delivery to the user on the old server and does not 
trigger a relay to the new server.


I have been trying to understand what others have been saying about this 
on the various threads, but I'm unable to clarify in my limited 
understanding.  What am I missing here?





Re: Per User Relay to From Old to New Postfix

2019-10-16 Thread Wietse Venema
Asai:
> Greetings,
> 
> Our organization is deploying a new upgraded Postfix server and we're 
> looking for various options to migrate users from the old to the new.? 
> One possibility, we hope, is to do it on a per user basis rather than 
> doing it all at once for a whole domain (which is also viable, but seems 
> to result in more downtime for users until IT staff can make their 
> rounds to their computers).? I have done some reading of documentation, 
> but I'm not clear on whether using relay_recipient_maps is an option, or 
> perhaps the transport_maps directive.
> 
> So, is this possible in Postfix, to relay email from the old to the new 
> Postfix server on a per user basis, if so, what are some good options?

The following uses two transport maps and no changes in
relay_recipient_maps:

Assuming that both machines will accept mail for every
user@the-domain-in-question:

- One transport map on the new machine, that sends mail for
non-migrated user@the-domain-in-question to the old machine.

- One transport map on the old machine, that sends mail for migrated
user@the-domain-in-question to the new machine.

To migrate a user, delete her from the transport map on the new
machine before adding her to the transport map on the old machine,
otherwise mail will loop.

Wietse


Per User Relay to From Old to New Postfix

2019-10-16 Thread Asai

Greetings,

Our organization is deploying a new upgraded Postfix server and we're 
looking for various options to migrate users from the old to the new.  
One possibility, we hope, is to do it on a per user basis rather than 
doing it all at once for a whole domain (which is also viable, but seems 
to result in more downtime for users until IT staff can make their 
rounds to their computers).  I have done some reading of documentation, 
but I'm not clear on whether using relay_recipient_maps is an option, or 
perhaps the transport_maps directive.


So, is this possible in Postfix, to relay email from the old to the new 
Postfix server on a per user basis, if so, what are some good options?


Thank you,
Asai