Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: DBMail: users

recipient redirect

 

 

DBMail users RSS feed   Index | Next | Previous | View Threaded


george.vieira at djtremors

Aug 29, 2009, 5:16 AM

Post #1 of 11 (1980 views)
Permalink
recipient redirect

Hi all,



I tried searching but couldn’t find anything close to what i’m looking for so if it was mentioned before, sorry.



I’ve been wanting to try and build a mail system where there can be 2 mail store and/or 2 server, eg domain.tld in Melbourne and Sydney. Each has a list of the total user list but with a transport for the users in the other network.



I thought using dbmail-lmtp and point a users mail to the opposite server would be the trick but i can’t see how i can implement this, only domains can be done on the postfix level so i’m resorting to dbmail lmtp. I was hoping for basically some sort of recipient transport map.



Can this be done for multisite servers?



George.


george.vieira at djtremors

Aug 30, 2009, 4:16 AM

Post #2 of 11 (1912 views)
Permalink
Re: recipient redirect [In reply to]

Ok i’m close to what I want but postfix lacks in providing what it does in other lookups (so this isn’t a dbmail problem but maybe someone could help).



I’m currently using this



mydestination = $myhostname, localhost, mysql:/etc/postfix/mydestination.mysql

alias_maps = mysql:/etc/postfix/alias_maps.mysql

local_recipient_maps = mysql:/etc/postfix/local_recipient_maps.mysql

mailbox_transport_maps = mysql:/etc/postfix/mailbox_transport_maps.mysql



the mailbox_transport_map can deliver mail based on the user account. Now my problem is that i’m trying to see about using dbmail at it’s full potential buy making it host multiple domains and across multiple sites.



To eliminate the John Doe in 2 domains, I used john.doe [at] domain1 and john.doe [at] domain2 as login accounts (dbmail_users).



This is where I now run into a snag, mailbox_transport_maps only passes the username part of the email as %s and i cannot get the full email address on this lookup.



# host and port were added to dbmail_users for the transport testing...

query = SELECT CONCAT( "dbmail-lmtp:", u.host, ":", u.port ) FROM dbmail_aliases AS a, dbmail_users AS u WHERE alias like "%s@%%" AND deliver_to = u.user_idnr AND active=1 LIMIT 1



So i have no clean way to map email address for a domain to multiple lmtp servers for domains that run in multiple locations/servers.



Anyone implement a similar setup?





George Vieira.



From: dbmail-bounces [at] dbmail [mailto:dbmail-bounces [at] dbmail] On Behalf Of George Vieira
Sent: Saturday, 29 August 2009 10:16 PM
To: 'dbmail [at] dbmail'
Subject: [Dbmail] recipient redirect



Hi all,



I tried searching but couldn’t find anything close to what i’m looking for so if it was mentioned before, sorry.



I’ve been wanting to try and build a mail system where there can be 2 mail store and/or 2 server, eg domain.tld in Melbourne and Sydney. Each has a list of the total user list but with a transport for the users in the other network.



I thought using dbmail-lmtp and point a users mail to the opposite server would be the trick but i can’t see how i can implement this, only domains can be done on the postfix level so i’m resorting to dbmail lmtp. I was hoping for basically some sort of recipient transport map.



Can this be done for multisite servers?



George.


jesse at kci

Aug 31, 2009, 10:58 AM

Post #3 of 11 (1904 views)
Permalink
Re: recipient redirect [In reply to]

On Sun, 2009-08-30 at 21:16 +1000, George Vieira wrote:
>
> This is where I now run into a snag, mailbox_transport_maps only
> passes the username part of the email as %s and i cannot get the full
> email address on this lookup.
>
>
>
> # host and port were added to dbmail_users for the transport
> testing...
>
> query = SELECT CONCAT( "dbmail-lmtp:", u.host, ":", u.port ) FROM
> dbmail_aliases AS a, dbmail_users AS u WHERE alias like "%s@%%" AND
> deliver_to = u.user_idnr AND active=1 LIMIT 1

Maybe try %u@%d (see http://www.postfix.org/mysql_table.5.html).

--
Jesse Norell
Kentec Communications, Inc.
jesse [at] kci
_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


george.vieira at djtremors

Sep 5, 2009, 7:40 PM

Post #4 of 11 (1878 views)
Permalink
Re: recipient redirect [In reply to]

This doesn't work. As I said, unfortunately in postfix as a normal local user is assumed to be a name and the mailbox_transport_map is passed only the username, so it strips the domain out.
http://www.irbs.net/internet/postfix/0602/0122.html

The dead giveaway also is the bounce message below (ie accounts not accounts [at] domain).
Sep 1 19:32:16 serapis postfix/local[24480]: 7823E6B57: to=<accounts [at] domain>, relay=local, delay=0.09, delays=0.03/0.04/0/0.03, dsn=5.1..1, status=bounced (unknown user: "accounts")

I even thought i'd try virtual, but virtual is worse as it doesn't actually have a virtal_mailbox_transport_map so I'm stuffed either way.

I have to either change to using username_domain.tld or using subdomain domain_maps and aliases to redirect them. Ie accounts [at] domain -> accounts [at] server1


George
-----Original Message-----
From: dbmail-bounces [at] dbmail [mailto:dbmail-bounces [at] dbmail] On Behalf Of Jesse Norell
Sent: Tuesday, 1 September 2009 3:58 AM
To: DBMail mailinglist
Subject: Re: [Dbmail] recipient redirect

On Sun, 2009-08-30 at 21:16 +1000, George Vieira wrote:
>
> This is where I now run into a snag, mailbox_transport_maps only
> passes the username part of the email as %s and i cannot get the full
> email address on this lookup.
>
>
>
> # host and port were added to dbmail_users for the transport
> testing...
>
> query = SELECT CONCAT( "dbmail-lmtp:", u.host, ":", u.port ) FROM
> dbmail_aliases AS a, dbmail_users AS u WHERE alias like "%s@%%" AND
> deliver_to = u.user_idnr AND active=1 LIMIT 1

Maybe try %u@%d (see http://www.postfix.org/mysql_table.5.html).

--
Jesse Norell
Kentec Communications, Inc.
jesse [at] kci
_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


vulture at netvulture

Sep 6, 2009, 12:55 PM

Post #5 of 11 (1875 views)
Permalink
Re: recipient redirect [In reply to]

Ok,
I will chime in now with your answer,

In your databases create the view to merge users with their aliases:
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY
DEFINER VIEW `dbmail_postfix_map` AS select `dbmail_users`.`userid` AS
`user`,`dbmail_users`.`passwd` AS `passwd` from `dbmail_users` union
select `dbmail_aliases`.`alias` AS `alias`,`dbmail_users`.`passwd` AS
`passwd` from (`dbmail_aliases` join `dbmail_users`
on((`dbmail_users`.`user_idnr` = `dbmail_aliases`.`deliver_to`)));

I use a full primary email address as my username, but then have
multiple alliases with full email address pointing to my users.
vulture [at] netvulture (my login)
jon [at] netvulture (alias to user_idnr 5)

The view will let me lookup user='either address' to get the answer.

You will want to have the user created only once, not on both servers,
otherwise mail will default to the first server listed.

In main.cf:
mydestination = $myhostname, localhost, mail.domain.tld (if dns name
different than hostname), listofdomainsweacceptmailfor.tlds...
transport_maps = mysql:/etc/postfix/dbmail_relay_transports_server_a.cf,
mysql:/etc/postfix/dbmail_relay_transports_server_b.cf,
local_recipient_maps = mysql:/etc/postfix/dbmail_mailboxes_server_a.cf,
mysql:/etc/postfix/dbmail_mailboxes_server_b.cf

If you need to check that a sender is a valid user you will also need:
smtpd_sender_login_maps =
mysql:/etc/postfix/dbmail_mailboxes_server_a.cf,
mysql:/etc/postfix/dbmail_mailboxes_server_b.cf


dbmail_mailboxes_server_x.cf:
user = dbmail
password = dbmail
dbname = dbmail
hosts = server_a/b's IP
query = SELECT user FROM dbmail_postfix_map WHERE user='%s'

dbmail_relay_transports_server_x.cf:
user = dbmail
password = dbmail
dbname = dbmail
hosts = server_a/b's IP
query = SELECT 'lmtp:server_a/b_ip:24' FROM dbmail_postfix_map WHERE
user='%s'

The result is that mail will be directed to the correct lmtp based on
what user it is destined for.

server_a_user [at] domain -> server_a:24
server_b_user [at] domain -> server_b:24


Further postfix stuff you might need if you use smtp auth for sending
smtp_sasl_type = cyrus
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_authenticated_header = yes

smtpd_recipient_restrictions =
permit_mynetworks,
reject_invalid_hostname,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unknown_recipient_domain,
reject_unauth_pipelining,
reject_unknown_sender_domain,
permit_sasl_authenticated,
reject_rbl_client sbl-xbl.spamhaus.org,
reject_rbl_client bl.spamcop.net,
check_helo_access hash:/etc/postfix/helo_access,
reject_unauth_destination,
check_recipient_access hash:/etc/postfix/access,
check_policy_service unix:private/policy
smtpd_sender_restrictions =
permit_mynetworks,
check_helo_access hash:/etc/postfix/helo_access,
reject_authenticated_sender_login_mismatch,
permit_sasl_authenticated,
reject_sender_login_mismatch,
reject_unknown_sender_domain,
check_sender_access
hash:/etc/postfix/sender_access


sender_access: (tabs not spaces between key and value)
mydomain.tld 553 not logged in
my2nddomain.tld 553 not logged in
* OK

sasl2/smtpd.conf:
pwcheck_method: auxprop
auxprop_plugin: sql
allowanonymouslogin: no
allowplaintext: yes
mech_list: PLAIN LOGIN
srp_mda: md5
password_format: crypt
srvtab: /dev/null
opiekeys: /dev/null
sql_engine: mysql
sql_hostnames: server_ip
sql_user: dbmail
sql_passwd: dbmail
sql_database: dbmail
sql_verbose: yes
sql_select: SELECT passwd FROM dbmail_postfix_map WHERE (user) = ('%u@%r')
log_level: 10
sql_verbose: yes


With this setup, all of my users need to use smtp auth to send mail out.
If someone tries to send mail from one of my valid users with out it,
the message is rejected with the 553. I can use a helo or network_table
to allow those matching to send with out auth. Mail coming in un-auth
must come from some other domain to a valid users bases on the view. For
simplicity all my users have plaintext passwords. During my last
upgrade, I lost the ability to get my sasl to match a crypt password and
had to change.

This should solve your receiving issue. If you have postfix on both
sites, then you can just have users send through their local postfix to
solve the problem of the sasl lookup only going to one server.

Let me know how that turns out.

-Jon

George Vieira wrote:
> This doesn't work. As I said, unfortunately in postfix as a normal local user is assumed to be a name and the mailbox_transport_map is passed only the username, so it strips the domain out.
> http://www.irbs.net/internet/postfix/0602/0122.html
>
> The dead giveaway also is the bounce message below (ie accounts not accounts [at] domain).
> Sep 1 19:32:16 serapis postfix/local[24480]: 7823E6B57: to=<accounts [at] domain>, relay=local, delay=0.09, delays=0.03/0.04/0/0.03, dsn=5.1..1, status=bounced (unknown user: "accounts")
>
> I even thought i'd try virtual, but virtual is worse as it doesn't actually have a virtal_mailbox_transport_map so I'm stuffed either way.
>
> I have to either change to using username_domain.tld or using subdomain domain_maps and aliases to redirect them. Ie accounts [at] domain -> accounts [at] server1
>
>
> George
> -----Original Message-----
> From: dbmail-bounces [at] dbmail [mailto:dbmail-bounces [at] dbmail] On Behalf Of Jesse Norell
> Sent: Tuesday, 1 September 2009 3:58 AM
> To: DBMail mailinglist
> Subject: Re: [Dbmail] recipient redirect
>
> On Sun, 2009-08-30 at 21:16 +1000, George Vieira wrote:
>
>> This is where I now run into a snag, mailbox_transport_maps only
>> passes the username part of the email as %s and i cannot get the full
>> email address on this lookup.
>>
>>
>>
>> # host and port were added to dbmail_users for the transport
>> testing...
>>
>> query = SELECT CONCAT( "dbmail-lmtp:", u.host, ":", u.port ) FROM
>> dbmail_aliases AS a, dbmail_users AS u WHERE alias like "%s@%%" AND
>> deliver_to = u.user_idnr AND active=1 LIMIT 1
>>
>
> Maybe try %u@%d (see http://www.postfix.org/mysql_table.5.html).
>
>


--
Scanned for viruses and dangerous content by MailScanner

_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


george.vieira at djtremors

Sep 7, 2009, 2:36 AM

Post #6 of 11 (1871 views)
Permalink
Re: recipient redirect [In reply to]

That looks great, i'm trying that within minutes.

With the lookups (mainly lmtp one), I was doing it this way (which probably caused me the headaches.

query = SELECT CONCAT( "dbmail-lmtp:", host, ":", port ) FROM dbmail_users WHERE userid="%s" AND active=1 LIMIT 1

I added 3 fields, active="0|1", host="127.0.0.1|{remoteip}", port="24" (port to keep consistant)..

So local users are mapped to 127.0.0.1 (which is the default in the table, so adding always is local and you can redirect to the other host).
I was wanting to do it this way also to eliminate making the multiple lookup files as you've shown but until i get it working I'll try out your method until I understand my problem better as why it wasn't working.

I'll give it a try and post back with notes and maybe wiki page.

George.

-----Original Message-----
From: dbmail-bounces [at] dbmail [mailto:dbmail-bounces [at] dbmail] On Behalf Of Jonathan Feally
Sent: Monday, 7 September 2009 5:55 AM
To: DBMail mailinglist
Subject: Re: [Dbmail] recipient redirect

Ok,
I will chime in now with your answer,

In your databases create the view to merge users with their aliases:
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY
DEFINER VIEW `dbmail_postfix_map` AS select `dbmail_users`.`userid` AS
`user`,`dbmail_users`.`passwd` AS `passwd` from `dbmail_users` union
select `dbmail_aliases`.`alias` AS `alias`,`dbmail_users`.`passwd` AS
`passwd` from (`dbmail_aliases` join `dbmail_users`
on((`dbmail_users`.`user_idnr` = `dbmail_aliases`.`deliver_to`)));

I use a full primary email address as my username, but then have
multiple alliases with full email address pointing to my users.
vulture [at] netvulture (my login)
jon [at] netvulture (alias to user_idnr 5)

The view will let me lookup user='either address' to get the answer.

You will want to have the user created only once, not on both servers,
otherwise mail will default to the first server listed.

In main.cf:
mydestination = $myhostname, localhost, mail.domain.tld (if dns name different than hostname), listofdomainsweacceptmailfor.tlds...
transport_maps = mysql:/etc/postfix/dbmail_relay_transports_server_a.cf,
mysql:/etc/postfix/dbmail_relay_transports_server_b.cf,
local_recipient_maps = mysql:/etc/postfix/dbmail_mailboxes_server_a.cf,
mysql:/etc/postfix/dbmail_mailboxes_server_b.cf

If you need to check that a sender is a valid user you will also need:
smtpd_sender_login_maps = mysql:/etc/postfix/dbmail_mailboxes_server_a.cf, mysql:/etc/postfix/dbmail_mailboxes_server_b.cf


dbmail_mailboxes_server_x.cf:
user = dbmail
password = dbmail
dbname = dbmail
hosts = server_a/b's IP
query = SELECT user FROM dbmail_postfix_map WHERE user='%s'

dbmail_relay_transports_server_x.cf:
user = dbmail
password = dbmail
dbname = dbmail
hosts = server_a/b's IP
query = SELECT 'lmtp:server_a/b_ip:24' FROM dbmail_postfix_map WHERE user='%s'

The result is that mail will be directed to the correct lmtp based on
what user it is destined for.

server_a_user [at] domain -> server_a:24
server_b_user [at] domain -> server_b:24


Further postfix stuff you might need if you use smtp auth for sending
smtp_sasl_type = cyrus
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_authenticated_header = yes

smtpd_recipient_restrictions =
permit_mynetworks,
reject_invalid_hostname,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unknown_recipient_domain,
reject_unauth_pipelining,
reject_unknown_sender_domain,
permit_sasl_authenticated,
reject_rbl_client sbl-xbl.spamhaus.org,
reject_rbl_client bl.spamcop.net,
check_helo_access hash:/etc/postfix/helo_access,
reject_unauth_destination,
check_recipient_access hash:/etc/postfix/access,
check_policy_service unix:private/policy
smtpd_sender_restrictions =
permit_mynetworks,
check_helo_access hash:/etc/postfix/helo_access,
reject_authenticated_sender_login_mismatch,
permit_sasl_authenticated,
reject_sender_login_mismatch,
reject_unknown_sender_domain,
check_sender_access
hash:/etc/postfix/sender_access


sender_access: (tabs not spaces between key and value)
mydomain.tld 553 not logged in
my2nddomain.tld 553 not logged in
* OK

sasl2/smtpd.conf:
pwcheck_method: auxprop
auxprop_plugin: sql
allowanonymouslogin: no
allowplaintext: yes
mech_list: PLAIN LOGIN
srp_mda: md5
password_format: crypt
srvtab: /dev/null
opiekeys: /dev/null
sql_engine: mysql
sql_hostnames: server_ip
sql_user: dbmail
sql_passwd: dbmail
sql_database: dbmail
sql_verbose: yes
sql_select: SELECT passwd FROM dbmail_postfix_map WHERE (user) = ('%u@%r')
log_level: 10
sql_verbose: yes


With this setup, all of my users need to use smtp auth to send mail out.
If someone tries to send mail from one of my valid users with out it,
the message is rejected with the 553. I can use a helo or network_table
to allow those matching to send with out auth. Mail coming in un-auth
must come from some other domain to a valid users bases on the view. For
simplicity all my users have plaintext passwords. During my last
upgrade, I lost the ability to get my sasl to match a crypt password and
had to change.

This should solve your receiving issue. If you have postfix on both
sites, then you can just have users send through their local postfix to
solve the problem of the sasl lookup only going to one server.

Let me know how that turns out.

-Jon

George Vieira wrote:
> This doesn't work. As I said, unfortunately in postfix as a normal local user is assumed to be a name and the mailbox_transport_map is passed only the username, so it strips the domain out.
> http://www.irbs.net/internet/postfix/0602/0122.html
>
> The dead giveaway also is the bounce message below (ie accounts not accounts [at] domain).
> Sep 1 19:32:16 serapis postfix/local[24480]: 7823E6B57: to=<accounts [at] domain>, relay=local, delay=0.09, delays=0.03/0.04/0/0.03, dsn=5..1..1, status=bounced (unknown user: "accounts")
>
> I even thought i'd try virtual, but virtual is worse as it doesn't actually have a virtal_mailbox_transport_map so I'm stuffed either way.
>
> I have to either change to using username_domain.tld or using subdomain domain_maps and aliases to redirect them. Ie accounts [at] domain -> accounts [at] server1
>
>
> George
> -----Original Message-----
> From: dbmail-bounces [at] dbmail [mailto:dbmail-bounces [at] dbmail] On Behalf Of Jesse Norell
> Sent: Tuesday, 1 September 2009 3:58 AM
> To: DBMail mailinglist
> Subject: Re: [Dbmail] recipient redirect
>
> On Sun, 2009-08-30 at 21:16 +1000, George Vieira wrote:
>
>> This is where I now run into a snag, mailbox_transport_maps only
>> passes the username part of the email as %s and i cannot get the full
>> email address on this lookup.
>>
>>
>>
>> # host and port were added to dbmail_users for the transport
>> testing...
>>
>> query = SELECT CONCAT( "dbmail-lmtp:", u.host, ":", u.port ) FROM
>> dbmail_aliases AS a, dbmail_users AS u WHERE alias like "%s@%%" AND
>> deliver_to = u.user_idnr AND active=1 LIMIT 1
>>
>
> Maybe try %u@%d (see http://www.postfix.org/mysql_table.5.html).
>
>


--
Scanned for viruses and dangerous content by MailScanner

_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail

_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


george.vieira at djtremors

Sep 7, 2009, 3:19 AM

Post #7 of 11 (1867 views)
Permalink
Re: recipient redirect [In reply to]

OK, this works only when aliases is for 1 person. I cannot get this method to work when 2 people are in a sales@ mail alias group.
Since the domain is not in mydestination, i think alias_maps doesn't get used so it gets bypassed, am I right? Because i just tried it and it complained of no user when i switched away from your views and used an alias_map. :(
This sounds more like a postfix issue again.lol

I have look up which result with multiple users listed when searching alias maps and the mail deliver to both but with this new setup i can't seem to get that to work now.

Any ideas?

George
-----Original Message-----
From: dbmail-bounces [at] dbmail [mailto:dbmail-bounces [at] dbmail] On Behalf Of George Vieira
Sent: Monday, 7 September 2009 7:36 PM
To: 'DBMail mailinglist'
Subject: Re: [Dbmail] recipient redirect

That looks great, i'm trying that within minutes.

With the lookups (mainly lmtp one), I was doing it this way (which probably caused me the headaches.

query = SELECT CONCAT( "dbmail-lmtp:", host, ":", port ) FROM dbmail_users WHERE userid="%s" AND active=1 LIMIT 1

I added 3 fields, active="0|1", host="127.0.0.1|{remoteip}", port="24" (port to keep consistant)..

So local users are mapped to 127.0.0.1 (which is the default in the table, so adding always is local and you can redirect to the other host).
I was wanting to do it this way also to eliminate making the multiple lookup files as you've shown but until i get it working I'll try out your method until I understand my problem better as why it wasn't working.

I'll give it a try and post back with notes and maybe wiki page.

George.

-----Original Message-----
From: dbmail-bounces [at] dbmail [mailto:dbmail-bounces [at] dbmail] On Behalf Of Jonathan Feally
Sent: Monday, 7 September 2009 5:55 AM
To: DBMail mailinglist
Subject: Re: [Dbmail] recipient redirect

Ok,
I will chime in now with your answer,

In your databases create the view to merge users with their aliases:
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY
DEFINER VIEW `dbmail_postfix_map` AS select `dbmail_users`.`userid` AS
`user`,`dbmail_users`.`passwd` AS `passwd` from `dbmail_users` union
select `dbmail_aliases`.`alias` AS `alias`,`dbmail_users`.`passwd` AS
`passwd` from (`dbmail_aliases` join `dbmail_users`
on((`dbmail_users`.`user_idnr` = `dbmail_aliases`.`deliver_to`)));

I use a full primary email address as my username, but then have
multiple alliases with full email address pointing to my users.
vulture [at] netvulture (my login)
jon [at] netvulture (alias to user_idnr 5)

The view will let me lookup user='either address' to get the answer.

You will want to have the user created only once, not on both servers,
otherwise mail will default to the first server listed.

In main.cf:
mydestination = $myhostname, localhost, mail.domain.tld (if dns name different than hostname), listofdomainsweacceptmailfor.tlds...
transport_maps = mysql:/etc/postfix/dbmail_relay_transports_server_a.cf,
mysql:/etc/postfix/dbmail_relay_transports_server_b.cf,
local_recipient_maps = mysql:/etc/postfix/dbmail_mailboxes_server_a.cf,
mysql:/etc/postfix/dbmail_mailboxes_server_b.cf

If you need to check that a sender is a valid user you will also need:
smtpd_sender_login_maps = mysql:/etc/postfix/dbmail_mailboxes_server_a.cf, mysql:/etc/postfix/dbmail_mailboxes_server_b.cf


dbmail_mailboxes_server_x.cf:
user = dbmail
password = dbmail
dbname = dbmail
hosts = server_a/b's IP
query = SELECT user FROM dbmail_postfix_map WHERE user='%s'

dbmail_relay_transports_server_x.cf:
user = dbmail
password = dbmail
dbname = dbmail
hosts = server_a/b's IP
query = SELECT 'lmtp:server_a/b_ip:24' FROM dbmail_postfix_map WHERE user='%s'

The result is that mail will be directed to the correct lmtp based on
what user it is destined for.

server_a_user [at] domain -> server_a:24
server_b_user [at] domain -> server_b:24


Further postfix stuff you might need if you use smtp auth for sending
smtp_sasl_type = cyrus
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_authenticated_header = yes

smtpd_recipient_restrictions =
permit_mynetworks,
reject_invalid_hostname,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unknown_recipient_domain,
reject_unauth_pipelining,
reject_unknown_sender_domain,
permit_sasl_authenticated,
reject_rbl_client sbl-xbl.spamhaus.org,
reject_rbl_client bl.spamcop.net,
check_helo_access hash:/etc/postfix/helo_access,
reject_unauth_destination,
check_recipient_access hash:/etc/postfix/access,
check_policy_service unix:private/policy
smtpd_sender_restrictions =
permit_mynetworks,
check_helo_access hash:/etc/postfix/helo_access,
reject_authenticated_sender_login_mismatch,
permit_sasl_authenticated,
reject_sender_login_mismatch,
reject_unknown_sender_domain,
check_sender_access
hash:/etc/postfix/sender_access


sender_access: (tabs not spaces between key and value)
mydomain.tld 553 not logged in
my2nddomain.tld 553 not logged in
* OK

sasl2/smtpd.conf:
pwcheck_method: auxprop
auxprop_plugin: sql
allowanonymouslogin: no
allowplaintext: yes
mech_list: PLAIN LOGIN
srp_mda: md5
password_format: crypt
srvtab: /dev/null
opiekeys: /dev/null
sql_engine: mysql
sql_hostnames: server_ip
sql_user: dbmail
sql_passwd: dbmail
sql_database: dbmail
sql_verbose: yes
sql_select: SELECT passwd FROM dbmail_postfix_map WHERE (user) = ('%u@%r')
log_level: 10
sql_verbose: yes


With this setup, all of my users need to use smtp auth to send mail out.
If someone tries to send mail from one of my valid users with out it,
the message is rejected with the 553. I can use a helo or network_table
to allow those matching to send with out auth. Mail coming in un-auth
must come from some other domain to a valid users bases on the view. For
simplicity all my users have plaintext passwords. During my last
upgrade, I lost the ability to get my sasl to match a crypt password and
had to change.

This should solve your receiving issue. If you have postfix on both
sites, then you can just have users send through their local postfix to
solve the problem of the sasl lookup only going to one server.

Let me know how that turns out.

-Jon

George Vieira wrote:
> This doesn't work. As I said, unfortunately in postfix as a normal local user is assumed to be a name and the mailbox_transport_map is passed only the username, so it strips the domain out.
> http://www.irbs.net/internet/postfix/0602/0122.html
>
> The dead giveaway also is the bounce message below (ie accounts not accounts [at] domain).
> Sep 1 19:32:16 serapis postfix/local[24480]: 7823E6B57: to=<accounts [at] domain>, relay=local, delay=0.09, delays=0.03/0.04/0/0.03, dsn=5...1..1, status=bounced (unknown user: "accounts")
>
> I even thought i'd try virtual, but virtual is worse as it doesn't actually have a virtal_mailbox_transport_map so I'm stuffed either way.
>
> I have to either change to using username_domain.tld or using subdomain domain_maps and aliases to redirect them. Ie accounts [at] domain -> accounts [at] server1
>
>
> George
> -----Original Message-----
> From: dbmail-bounces [at] dbmail [mailto:dbmail-bounces [at] dbmail] On Behalf Of Jesse Norell
> Sent: Tuesday, 1 September 2009 3:58 AM
> To: DBMail mailinglist
> Subject: Re: [Dbmail] recipient redirect
>
> On Sun, 2009-08-30 at 21:16 +1000, George Vieira wrote:
>
>> This is where I now run into a snag, mailbox_transport_maps only
>> passes the username part of the email as %s and i cannot get the full
>> email address on this lookup.
>>
>>
>>
>> # host and port were added to dbmail_users for the transport
>> testing...
>>
>> query = SELECT CONCAT( "dbmail-lmtp:", u.host, ":", u.port ) FROM
>> dbmail_aliases AS a, dbmail_users AS u WHERE alias like "%s@%%" AND
>> deliver_to = u.user_idnr AND active=1 LIMIT 1
>>
>
> Maybe try %u@%d (see http://www.postfix.org/mysql_table.5.html).
>
>


--
Scanned for viruses and dangerous content by MailScanner

_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail

_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail

_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


george.vieira at djtremors

Sep 7, 2009, 3:37 AM

Post #8 of 11 (1871 views)
Permalink
Re: recipient redirect [In reply to]

My correction, alias doesn't work because it's matching username only..argh, forgot. Damnit, gonna patch one thing or another.
GV

-----Original Message-----
From: dbmail-bounces [at] dbmail [mailto:dbmail-bounces [at] dbmail] On Behalf Of George Vieira
Sent: Monday, 7 September 2009 8:19 PM
To: 'DBMail mailinglist'
Subject: Re: [Dbmail] recipient redirect

OK, this works only when aliases is for 1 person. I cannot get this method to work when 2 people are in a sales@ mail alias group.
Since the domain is not in mydestination, i think alias_maps doesn't get used so it gets bypassed, am I right? Because i just tried it and it complained of no user when i switched away from your views and used an alias_map. :(
This sounds more like a postfix issue again.lol

_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


vulture at netvulture

Sep 7, 2009, 9:43 PM

Post #9 of 11 (1867 views)
Permalink
Re: recipient redirect [In reply to]

You can try to make your distribution lists using an external forward,
and set postfix to send the message to each recipient instead of trying
to group them into a single message. This would effectively make the
message be received by dbmail-lmtpd and then resend the messages back to
postfix for each of the users. Then postfix will re-deliver the message
to each of the real recipients on the correct servers. This will avoid
postfix needing to do anything with aliases keeping postfix as dumb as
possible. With this approach you don't need to worry about keeping both
databases synced as there is nothing to sync from a to b.

main.cf:
sendmail_destination_recipient_limit = 1

dbmail-users -x sales [at] domain -t
john [at] domain,jane [at] domain,theotherdoes [at] domain

-Jon

George Vieira wrote:
> My correction, alias doesn't work because it's matching username only..argh, forgot. Damnit, gonna patch one thing or another.
> GV
>
> -----Original Message-----
> From: dbmail-bounces [at] dbmail [mailto:dbmail-bounces [at] dbmail] On Behalf Of George Vieira
> Sent: Monday, 7 September 2009 8:19 PM
> To: 'DBMail mailinglist'
> Subject: Re: [Dbmail] recipient redirect
>
> OK, this works only when aliases is for 1 person. I cannot get this method to work when 2 people are in a sales@ mail alias group.
> Since the domain is not in mydestination, i think alias_maps doesn't get used so it gets bypassed, am I right? Because i just tried it and it complained of no user when i switched away from your views and used an alias_map. :(
> This sounds more like a postfix issue again.lol
>
> _______________________________________________
> DBmail mailing list
> DBmail [at] dbmail
> http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail
>
>


--
Scanned for viruses and dangerous content by MailScanner

_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


vulture at netvulture

Sep 7, 2009, 9:50 PM

Post #10 of 11 (1854 views)
Permalink
Re: recipient redirect [In reply to]

sendmail_destination_recipient_limit = 1
This could be the wrong option, but I'm not sure of the right one if it
is needed at all.

Jonathan Feally wrote:
> You can try to make your distribution lists using an external forward,
> and set postfix to send the message to each recipient instead of trying
> to group them into a single message. This would effectively make the
> message be received by dbmail-lmtpd and then resend the messages back to
> postfix for each of the users. Then postfix will re-deliver the message
> to each of the real recipients on the correct servers. This will avoid
> postfix needing to do anything with aliases keeping postfix as dumb as
> possible. With this approach you don't need to worry about keeping both
> databases synced as there is nothing to sync from a to b.
>
> main.cf:
> sendmail_destination_recipient_limit = 1
>
> dbmail-users -x sales [at] domain -t
> john [at] domain,jane [at] domain,theotherdoes [at] domain
>
> -Jon
>
> George Vieira wrote:
>
>> My correction, alias doesn't work because it's matching username only..argh, forgot. Damnit, gonna patch one thing or another.
>> GV
>>
>> -----Original Message-----
>> From: dbmail-bounces [at] dbmail [mailto:dbmail-bounces [at] dbmail] On Behalf Of George Vieira
>> Sent: Monday, 7 September 2009 8:19 PM
>> To: 'DBMail mailinglist'
>> Subject: Re: [Dbmail] recipient redirect
>>
>> OK, this works only when aliases is for 1 person. I cannot get this method to work when 2 people are in a sales@ mail alias group.
>> Since the domain is not in mydestination, i think alias_maps doesn't get used so it gets bypassed, am I right? Because i just tried it and it complained of no user when i switched away from your views and used an alias_map. :(
>> This sounds more like a postfix issue again.lol
>>
>> _______________________________________________
>> DBmail mailing list
>> DBmail [at] dbmail
>> http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail
>>
>>
>>
>
>
>


--
Scanned for viruses and dangerous content by MailScanner

_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


george.vieira at djtremors

Sep 8, 2009, 2:10 AM

Post #11 of 11 (1863 views)
Permalink
Re: recipient redirect [In reply to]

Nah, i got it to work very well,thanks. I will post soon. Got a lot on and working on documentation for it as well.

-----Original Message-----
From: dbmail-bounces [at] dbmail [mailto:dbmail-bounces [at] dbmail] On Behalf Of Jonathan Feally
Sent: Tuesday, 8 September 2009 2:51 PM
To: DBMail mailinglist
Subject: Re: [Dbmail] recipient redirect

sendmail_destination_recipient_limit = 1
This could be the wrong option, but I'm not sure of the right one if it
is needed at all.

Jonathan Feally wrote:
> You can try to make your distribution lists using an external forward,
> and set postfix to send the message to each recipient instead of trying
> to group them into a single message. This would effectively make the
> message be received by dbmail-lmtpd and then resend the messages back to
> postfix for each of the users. Then postfix will re-deliver the message
> to each of the real recipients on the correct servers. This will avoid
> postfix needing to do anything with aliases keeping postfix as dumb as
> possible. With this approach you don't need to worry about keeping both
> databases synced as there is nothing to sync from a to b.
>
> main.cf:
> sendmail_destination_recipient_limit = 1
>
> dbmail-users -x sales [at] domain -t
> john [at] domain,jane [at] domain,theotherdoes [at] domain
>
> -Jon
>
> George Vieira wrote:
>
>> My correction, alias doesn't work because it's matching username only..argh, forgot. Damnit, gonna patch one thing or another.
>> GV
>>
>> -----Original Message-----
>> From: dbmail-bounces [at] dbmail [mailto:dbmail-bounces [at] dbmail] On Behalf Of George Vieira
>> Sent: Monday, 7 September 2009 8:19 PM
>> To: 'DBMail mailinglist'
>> Subject: Re: [Dbmail] recipient redirect
>>
>> OK, this works only when aliases is for 1 person. I cannot get this method to work when 2 people are in a sales@ mail alias group.
>> Since the domain is not in mydestination, i think alias_maps doesn't get used so it gets bypassed, am I right? Because i just tried it and it complained of no user when i switched away from your views and used an alias_map.. :(
>> This sounds more like a postfix issue again.lol
>>
>> _______________________________________________
>> DBmail mailing list
>> DBmail [at] dbmail
>> http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail
>>
>>
>>
>
>
>


--
Scanned for viruses and dangerous content by MailScanner

_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail

DBMail users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.