Will Berry wrote:

Is this what you are after, Mathew?
This configuration tells Postfix which email addreses are local recipients
for which it should accept and deliver mail.



in main.cf
=======
local_recipient_maps = mysql:/etc/postfix/mailbox.cf


where mailbox.cf looks like this:
====================
user = dbmail
password = dbmail
dbname = dbmail
hosts = localhost
table = dbmail_aliases
select_field = alias
where_field = alias


Mike

I know the Postfix people keep saying never to add virtual domains to $mydestination. I never quite figured out why, nor did I find a thorough explanation anywhere. And this is the first example I've seen of any other configuration that looks like it would actually function with DBMail.

So my question is, if DBMail is exclusively used for mailboxes on a virtual host system, what reasons are there for using the above scheme instead of just adding all the virtual domains to $mydestination? Under the latter scheme, you can still configure it so that mail to non-existent addresses still rejects, only local deliveries are allowed, etc. which seems to be what you need to prevent open relaying.

Just wondering...


Well. That leads to a pretty cool thought, Will ... could be the tip of a cure for Matt whose frustrating problem becomes a little better defined with each Post :o)

Firstly, IMHO Will, you might be in the mindst of "Postfix people" using Postfix for UNIX system accounts for local mailbox deliveries in a virtual MAILBOX domain environment where ("Postfix people keep saying never to add virtual domains to $mydestination." ) your statement is true when it means that the domain cannot be in both places. It can only be in one.

And (" instead of just adding all the virtual domains to $mydestination? "): There is no "instead of" but you are on to something there. Both are in play. In the order of things, Postfix, early in the receive process, needs a definitive instruction to know beyond itself what domains it accepts mail for as a final or relay destination. (That can be a destination or virtual domain.) Then it checks if the user exists. It must be told both.

And you are right, add all the domains to mydestinations will work fine with DbMail. Postfix doesn't need to know any more than that if all it is doing is passing accepted mail to DBMail. DbMail provides information about which 'users' it will accept mail for which is where the referenced mailbox.cf comes in.

Then DBMail delivers on the basis of alias = deliver_to where deliver_to is a user id number (user_idnr) or a mail address (forward).

With your suggestion hints at, and this would solve Matt's issue, if I understand it correctly: every user (in DBMAIL) needs to have an account and the mailbox.cf would point to the user NOT THE ALIAS. The Virtual tables can be config'd to handle domains along with $mydestinations.

 virtual_alias_domains = example.com ...other hosted domains...
 virtual_alias_maps = hash:/etc/postfix/virtual

etc.

Conceivably you don't need to enter a unique domain alias for each of hundreds of users as Matt referred to in his last post. Postfix must be told to accept mail for john at Virtual domains: foo.com or foobar.com or ? or ? and redirect it to [EMAIL PROTECTED] lmtpd:24 where DbMail has one user named John having one alias, [EMAIL PROTECTED]

(I haven't tried virtual mailboxes with DBMail but it could be made to work, but why bother?):
virtual_mailbox_domains = example.com ...more domains...
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
read further in Postfix docs...

When Postfix is pointed to a user name and not an alias it is important that all DbMail 'users' have an account in DbMail including pseudo-accounts. For example, 'postmaster' cannot just be an alias of a real person but must be a user account. Any other account can have its alias but the account must exist. Mail is accepted on the first_part but delivered by DBMail on where the alias points to. This structure is likely the most versatile method for exploiting DBMail's extensibility and can be used in either configuration where the MTA is pointed to either alias or userid. I have used this for very large systems. Perhaps it more closely resembles Postfix working in its traditional native UNIX environment and you can bring back all you ever learned about Virtual Hosting in Postfix :o).

example mailbox.cf
=======
user = dbmail
password = dbmail
dbname = dbmail
hosts = localhost
table = dbmail_users
select_field = userid
where_field = userid

This works very well but there are a few rules to follow in DbMail which must be adhered to or delivery breaks.

Do I recall that Matt needs to have same names, different domains, different users? The login name would need to be unique but the first_part of the alias can be the same on multiple domains because whereas Postix will accept on the first part, DBMail will deliver on the whole address.

(What most people seem to do is use full email addresses as the userid (user name) and alias which is functional.)

If Matt has, for example, a John Doe and a John Smith as accounts on two domains, each wanting "john" as the first_part in their mail addresses, the (login) names will need to be different, something like john and johns and the aliases can be john at domdoe.com and john at domsmith.com respectively. There must be at least one John configured as a DBMail user so Postfix will accept mail for that name. (This is a common setup on very large enterprise setups.) When DBMail gets the message it reads the alias and sends the message to the INBOX which matches the dbmail_aliases.deliver_to which is either a user_idnr or a "forward" mail address.

Meanwhile Postfix is configured in the more tradional way where hosted addresses are aliased just like is done with a local UNIX system account or to a remote address by using the "virtual" table.

I have spelled this out correctly. This is not the only way to accomplish this goal. I have used it with good success. Remembering all the bits is half the batttle. It is spelled out in the help files for DBMA (http://dbma.ca) as an alternative to the recommended DBMail (point to alias) configuration and is more like the traditional Postfix in a UNIX system account environment.

best...
Mike









Reply via email to