Virtual domains help

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Virtual domains help

Rupert Reid
Hello all,
I wan to set up an additional domain in postfix, whereby, to the outside world it is considered a separate and distinct postfix domain.  Internally I have two separate unix accounts set up: unixmaindomain and unixadditionaldomain.  I want that all mail (user1@additionaldomain, user2@addtionaldomain, etc...) for the additionaldomain to be delivered to the second unix account to be downloaded by my IMAP MTU account.

This is what I tried so far:-

1. mydestinations
All settings for main domain were left unchanged;
•  Added "additionaldomain.tld to mydestinations in main.cf;
Added  additionaldomain, comma separated, to RHS of etc/postfix/aliases: e.g. "admin: maindomain, additionaldomain"

The result
Continued to be able to send emails addressed from [hidden email] and [hidden email];
Continued ability to receive mail from [hidden email];
However, could only receive mail to [hidden email] (to the correct unix account).  All mail to other destinations (e.g. [hidden email]) is bounced "User unknown in local recipient table".

Is there something additional I am meant to do to achieve what I want, or is it not possible using mydestinations

 
2. Virtual alias domains
All settings for main domain were left unchanged;
removed all references to additionaldomain from main.cf
removed all references to additionaldomain from aliases file
postaliases hash...
Created virtual_alias_domains file containing: "additionaldomain.tld 2208081538"
Postmap hash...
Created virtual_alias_maps file containing: "additionaldomain.tld [hidden email],
... etc
postmap hash...
Edited main.cf -  added:  virtual_alias_domains = hash:/etc/postfix/virtual_alias_domains
virtual_alias_maps = hash:/etc/postfix/virtual_alias_maps
Postfix reload

The result
Incoming mail rejected for all mapped users of additionaldomain.  The mail failure error was:  User unknown in local recipient table
The logs error read: 
Aug 22 22:41:05 rosario postfix/error[28924]: 09B862667D7: to=<[hidden email]>, relay=none, delay=1, status=bounced (User unknown in virtual alias table)
Aug 22 22:41:05 rosario postfix/local[28926]: warning: database /etc/aliases.db is older than source file /etc/aliases

Is there something additional I am meant to do to achieve what I want, or is it not possible using virtual alias domains

3. Virtual Mailbox domains
was about to try this alternative but decided to stop and ask for help.
Please help!

Best Regards 
Rupert



Reply | Threaded
Open this post in threaded view
|

Re: Virtual domains help

mouss-2
Rupert Reid wrote:

> Hello all,
> I wan to set up an additional domain in postfix, whereby, to the outside
> world it is considered a separate and distinct postfix domain.  
> Internally I have two separate unix accounts set up: unixmaindomain and
> unixadditionaldomain.  I want that all mail (user1@additionaldomain,
> user2@addtionaldomain, etc...) for the additionaldomain to be delivered
> to the second unix account to be downloaded by my IMAP MTU account.
>
> This is what I tried so far:-
>
> 1. mydestinations
> •    All settings for main domain were left unchanged;
> •     Added "additionaldomain.tld to mydestinations in main.cf;
> •    Added  additionaldomain, comma separated, to RHS of
> etc/postfix/aliases: e.g. "admin: maindomain, additionaldomain"
>
> The result
> •    Continued to be able to send emails addressed from
> [hidden email] and [hidden email];
> •    Continued ability to receive mail from
> [hidden email];
> •    However, could only receive mail to
> [hidden email] (to the correct unix account).  All
> mail to other destinations (e.g. [hidden email]) is bounced
> "User unknown in local recipient table".
>
> Is there something additional I am meant to do to achieve what I want,
> or is it not possible using mydestinations
>
>
> 2.    Virtual alias domains
> •    All settings for main domain were left unchanged;
> •    removed all references to additionaldomain from main.cf
> •    removed all references to additionaldomain from aliases file
> •    postaliases hash...
> •    Created virtual_alias_domains file containing:
> "additionaldomain.tld    2208081538"

do not put the domain both in virtual_alias_maps and in mydestination.
chose one class.


>     •    Postmap hash...
> •    Created virtual_alias_maps file containing:
> "additionaldomain.tld    [hidden email],
>                                         [hidden email],
>                                         [hidden email],
>                                         [hidden email],
>                                         ... etc


so mail to
        addiotnaldomain.tld@yourdomain is delivered to the adresses that you
put on the right hand. not what you want...

Please read the "TABLE SEARCH ORDER" in
        http://www.postfix.org/virtual.5.html

do see the "@" at the beginning of "@domain"?


also note that

- you can use virtual_alias_maps without putting the domain in
virtual_alias_domains. virtual_alias_maps work for all domain.

- if the domain is a virtual alias domain, then its addresses must be
mapped to another domain. otherwise, postfix does not know how to deliver.

- if mail is delivered via local (mydestination), the domain part is
irrelevant at delivery time (so alias_maps do not distinguish between
different domains). you need to map the addresses using virtual_alias_maps:

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

do not use wildcard aliases unless you want to accept all addresses
(then you'll get a lot of spam).


>     •    postmap hash...
> •    Edited main.cf -  added:     virtual_alias_domains =
> hash:/etc/postfix/virtual_alias_domains
>                         virtual_alias_maps =
> hash:/etc/postfix/virtual_alias_maps
> •    Postfix reload
>
> The result
> •    Incoming mail rejected for all mapped users of additionaldomain.  
> The mail failure error was:  User unknown in local recipient table

we only trust logs. so I ignore the "error" above.

> •    The logs error read:
>     Aug 22 22:41:05 rosario postfix/error[28924]: 09B862667D7:
> to=<[hidden email]>, relay=none, delay=1, status=bounced
> (User unknown in virtual alias table)

the domain is listed as a virtual alias domain but the address is not
found in virtual_alias_maps.

>     Aug 22 22:41:05 rosario postfix/local[28926]: warning: database
> /etc/aliases.db is older than source file /etc/aliases

fix this. your postfix is using /etc/aliases while you think it should
use /etc/postfix/aliases. check the values of alias_maps and
alias_database using the postconf command.

>
> Is there something additional I am meant to do to achieve what I want,
> or is it not possible using virtual alias domains
>

it is better to explain your goal without implementation details (forget
about postfix for a few minutes and explain your goal in "functional"
terms). If I understand correctly, you want to add a domain named
new.example and you want all mail to this domain to go to the "newuser"
account. if so,

- add
new.example somestring
to virtual_alias_domains

- put
[hidden email] [hidden email]
[hidden email] [hidden email]
#@new.example [hidden email]
in your virtual_alias_maps. here, example.com is any domain listed in
mydestination. you can use "newuser" without a domain part, but you may
have problems if you play with myorigin. so it is safer to put the
domain part explicitely (or at least, make sure that $myorigin is listed
under mydestination).

if you want delivery to multiple accounts, adjust as needed.

if you uncomment the "#new.example" catchall line, all
[hidden email] addresses will be accepted, so you will get a lot of
spam. I wouldn't do this, but it's up to you.

Note that the "target" addresses (the addresses to which mail is
forwarded) are not in a virtual alias domain. they are in a local domain
(domain in mydestination). The idea is that after virtual alias
expansion (this is recursive. see the docs), postfix must know how to
deliver the address (either deliver to a mailbox, or pass the message to
another MTA).



> 3.    Virtual Mailbox domains
> •    was about to try this alternative but decided to stop and ask for
> help.
> •    Please help!
>
> Best Regards
> Rupert
>
>
>
>