Postfix catch-all alias problem (using mysql)
I am having a bit of problems with catch-all alias in postfix.
Today I finally got my postfix/dovecot setup working, using authentication via mysql.
But then I got into a problem, with catch-all alias.
In the database in my alias table I added:
The problem is that the alias is loaded before the regular adresses, so if someone tries to mail to firstname.lastname@example.org the mail is delivered to email@example.com.
While logging the mysql queries I can see that because it first looks at the aliases in many different ways and because it gets a result with @domain.com it accepts that.
Does anyone have any idea on how to either modify the query or modify postfix to read the aliases after the adresses?
Did you arrived to repaired that ?
Because I am facing the same problem
Answer to Postfix virtual alias catch-all problem
I know this thread is quite outdated, but it still appears on search results. I came up with a solution to this problem a few years ago, but was searching to see if anyone came up with a different approach, or if the How-To was updated.
The problem can be duplicated as follows:
* Postfix is set up to use virtual_alias_maps. An example would be as follows in the main.cf configuration file:
* An account user is created. For example: firstname.lastname@example.org.
* An account is added that will be used as a catch-all. For example: email@example.com.
* An alias is added as a catch-all account. For example, @example.com is aliased to firstname.lastname@example.org.
* Now, when mail is sent to email@example.com, it should be sent to firstname.lastname@example.org. However, it will end up in email@example.com. Thus, the problem arises.
The reason this happens is because Postfix first checks the virtual_alias_maps for an alias. @example.com matches as an alias. No other aliases exist. Therefore, the mail is sent to the catch-all account.
There are two possible solutions. The first would be to create an alias for each and every account. For example, your alias table would contain an alias of firstname.lastname@example.org, with a destination of email@example.com. This is inconvenient if you are using software such as Web-Cyradm to administer your accounts. You cannot tell Web-Cyradm to add this alias for every account without hacking Web-Cyradm.
The better solution would be to update your virtual_alias_maps file, in my case mysql-virtual.cf, to search the table holding your virtual e-mail account users. The change can be applied as follows:
Edit the virtual_alias_maps directive in main.cf configuration file as follows:
Be sure to reload the postfix configuration files before testing.
If you are more curious about the inner workings of this. You can turn on mysql logging and view the queries made both before and after the change. You will see what queries are made.
Please note that you may have to change the mysql-*.cf configuration files to correspond with your table structure. The tables I am using are the default tables used by Web-Cyradm.
If anyone has a better solution, please respond on here. I've used this method for several years without a problem. If you have any questions, please ask.
|All times are GMT -5. The time now is 07:39 PM.|