[Wolves] Postfix aliasing

Adam Sweet adam at adamsweet.org
Fri May 23 11:20:33 BST 2008


Hi everyone

Is anyone here good with Postfix? I've been asked to look at something
and my Postfix knowledge was minimal last time I looked at it which was
about 4 years ago...

We have a system which accepts mail for domains according to:

virtual_alias_domains=mysql:/etc/postfix/sql/domains.cf

which contains:

user=postfix
password=xxxxxxxx
dbname=postfix
table=domains
select_field=domain
where_field=domain
hosts=localhost

The domains table is a simple list of domains and an ID:

mysql> select * from domains;
+----+--------------------+
| id | domain             |
+----+--------------------+
| 1 | domain.com          |
+----+--------------------+

The system then uses the following to rewrite the recipient address:

virtual_alias_maps=mysql:/etc/postfix/sql/aliases.cf

which contains:

user=postfix
password=xxxxxxxx
dbname=postfix
table=aliases
select_field=target
where_field=alias
hosts=localhost

mysql> select * from aliases;
+----+--------------------+-----------------------+
| id | alias              | target                |
+----+--------------------+-----------------------+
| 1  | user1 at domain.com   | user1 at otherdomain.com |
| 2  | user2 at domain.com   | user2 at otherdomain.com |
+----+--------------------+-----------------------+

We then have manually configured delivery destinations for some of these
specific addresses and domains in /etc/postfix/transport_map, where the
destinations should override what is in DNS, ie:

user1 at otherdomain.com	smtp:[123.123.123.123]
user2 at otherdomain.com	smtp:[234.234.234.234]
domain.com		smtp:[111.222.111.222]

Yes, I am running postmap /etc/postfix/transport_map and
/etc/init.d/postfix reload afterwards. This is on CentOS 4.6.

This appears to work fine where the address should be rewritten but
throws a 'User unknown in virtual alias table' when the address
shouldn't be rewritten. I have tried to work around this by adding for
example, user3 at domain.com should be forwarded to user3 at domain.com (ie
itself, thus risking a loop) but this still throws the same error.

The system was designed by somebody now departed, specifically to alias
addresses from one domain to another and my Postfix knowledge isn't
really up to figuring this one out quickly. I need to be able to rewrite
an address where it has an entry in the aliasing table and just relay it
on where it doesn't, does anybody know how to do this?

If you need more of the config I'll paste it in.

Yours optimistically,

Adam



More information about the Wolves mailing list