We help IT Professionals succeed at work.

Postfix Aliases table does not support user@domain aliasing?

jmicorp
jmicorp asked
on
Medium Priority
745 Views
Last Modified: 2013-12-16
I've switched a very old and heavily used sendmail server over to postfix for maildir support.

I'm having trouble with the aliases table which holds some 200 aliases. Some are written as:
"username:  username, username, username"

whereas others are written as:
"username: email@address.org, email@address.org"

some of which are local virtually hosted domains. this worked fine with sendmail, but seems to fail with postfix. Is there a workaround?
Comment
Watch Question

Maciej Ssysadmin
CERTIFIED EXPERT
Commented:
What error are you getting? Postfix has no problems at all with aliases in format you wrote (alias_name: user1@email, user2@email): http://www.postfix.org/aliases.5.html

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
example:

aliasname: user.one@domainone.com, user.two@domaintwo.com

This implies an alias name is delivered to TWO domains virtually hosted on this single postfix server. Domainone and domaintwo are both MX'd to this server, however neither are the hostname's domain.

Remember that I'm using domainnames outside of the system's hostname.
Maciej Ssysadmin
CERTIFIED EXPERT

Commented:
I asked for exact error message.
Your configuration isn't very unusual - I'm using something similar on one of my servers and it works perfectly.
More than this - for testing purposes, I configured such alias, which is pointing to another addresses in some virtual domains hosted on the same mailserver - works as expected.
So - as you wrote "seems to fail with postfix" - what does it mean exactly? Post appropriate part of maillog with some errors saying that it doesn't work.
David BeveridgeLinux Systems Admin
CERTIFIED EXPERT

Commented:

do you have the following in main.cf ?
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

have you then run
postalias /etc/aliases

and then
postfix reload
David BeveridgeLinux Systems Admin
CERTIFIED EXPERT

Commented:
You can also use the sendmail command 'newaliases'
David BeveridgeLinux Systems Admin
CERTIFIED EXPERT

Commented:

Author

Commented:
I don't have the specific error message as i've rewritten all the aliases in the format that it likes -- i couldn't go even an hour without them working.

The error message would rewrite the recipient domain. For example:

alias_to_test:     user1@centos.org, user2@fedorasolved.com, user3@cnn.com

error message:     550, message undeliverable to user1@localhostname.org
                          550, message undeliverable to user2@localhostname.org
                          550, message undeliverable to user3@localhostname.org

All three domain names are included in "mydestination = /etc/postfix/hostnames"
All aliases are referenced with "alias_maps = hash:/etc/aliases"
All aliases are built with "postalias hash:/etc/aliases"

Postfix has been reloaded as "/etc/init.d/postfix restart" numerous times during troubleshooting.

Thanks for your help. Sorry I'm not able to produce a more specific error message.

Author

Commented:
As a note explaining the error message,

A particular user on my network will have a username fitting a particular organization of first name letters and last name letters, sometimes followed by a number. Their virtusertable ("virtual_maps = hash:/etc/postfix/virtusertable") file will specify a publically recognizable name (full first name dot full last name at particular domain) and map it to the correct user account. We had been making aliases for the sake of multiple deliveries of a single message.

For example, we could make a virtusertable entry of:
rabidsportsfan@victoriassecret.com                             ridiculous_alias

Then an entry in aliases to distribute it:
ridiculous_alias:                    charlie.long@companyname.org, chuck.wagon@othercompanyhosted.com

Both "companyname.org" and "othercompanyhosted.com" are listed in my aforementioned "/etc/postfix/hostnames" file, and entries for charlie.long@companyname.org and chuck.wagon@othercompanyhosted.com are in the virtusertable pointing to valid local account names.

Though a bit complicated to explain, i hope that clears up any questions about how/what I'm doing here.
Linux Systems Admin
CERTIFIED EXPERT
Commented:
companyname.org and other companyhosted.com
should not be listed in /etc/postfix/hostnames, but rather in the virtual domains or the virtual file.

Read this carefully
http://www.postfix.org/VIRTUAL_README.html

Eg if you want to have
sales@companyname.org sales1user
sales@othercompanyhosted.com sales2user

then you cannot list these domains in /etc/postfix/hostnames.

See also
http://www.postfix.org/virtual.8.html

/etc/postfix/virtual
companyname.org
othercompanyhosted.com
sales@companyname.org           sales1user
sales@othercompanyhosted.com       sales2user


Author

Commented:
ok, so if i moved them to /etc/postfix/virtual -- then aliases can write to these names?
David BeveridgeLinux Systems Admin
CERTIFIED EXPERT

Commented:
I think so, but I haven't tried it.

I generally prefer to use the virtual table instead of aliases anyway.
The reason I do this is that I store my virtual table in a mysql database with a web interface for easy management.
I just use the aliases file in /etc to hold local system aliases such as
webmaster: root
postmaster: root
root: dave
Maciej Ssysadmin
CERTIFIED EXPERT

Commented:
For something like above, you don't need aliases at all.
You may do this in virtual:
rabidsportsfan@victoriassecret.com   charlie.long@companyname.org, chuck.wagon@othercompanyhosted.com

You need aliases only when you want to point some email address to command - this cannot be done with virtual.

Author

Commented:
sendmail didn't support multiple recipients in a virtual table. Are you certain this is OK in postfix?
Maciej Ssysadmin
CERTIFIED EXPERT

Commented:
Yes I am :)
I'm using such configuration. It's described in man virtual (http://www.postfix.org/virtual.5.html).
Maciej Ssysadmin
CERTIFIED EXPERT

Commented:
Almost all above posts are answers for initial question.
Maciej Ssysadmin
CERTIFIED EXPERT

Commented:
Hm.. as for initial question in very first jmicorp's post, correct answer is in my opinion http:#23653787
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.