From: Daniel L'Hommedieu on
Hi again all.

Been a while. Anyway, today I think I am trying to do something similar to what Bob Eastbrook was discussing in late December. Here is what he said back then:
> Forgive me if this is a FAQ, but I've looked all over and I don't see it addressed.
>
> I have a wildcard MX record for *.example.com which points to mail.example.com. I know how to configure postfix to accept
> individual virtual domains such as host1.example.com, but how can I set it up to handle any domains which match the wildcard MX record?
> e.g.:
>
> bob(a)host1.example.com
> bob(a)host2.example.com
> bob(a)gibberish.example.com
>
> ... should all map to bob(a)mail.example.com. I'm only concerned about the user "bob" if that matters. I won't know in advance all the hosts in example.com, so I can't add them one at a time.
>
> Any ideas?
>
> Bob

Specifically, I am trying to build a mail catcher for all of my servers. My production servers run sendmail for outbound mail delivery, but on every one of them I am blocking inbound mail connections. I have set up another system, running postfix, for the purpose of catching mail to all of my production server systems. (My production server systems are database and web servers.)

I implemented the solution suggested by Wietse, which I quote here:
> APPEND a regular expression map to your virtual_alias_maps
> definition.
>
> /etc/postfix/main.cf:
> virtual_alias_maps =
> ...stuff you perhaps already have...
> pcre:/etc/postfix/virtual_alias.pcre
>
> /etc/postfix/virtual_alias.pcre:
> # Send bob(a)whatever.example.com to bob(a)example.com.
> /^bob@([^.]+\.)+example\.com$/ bob(a)example.com
>
> Further reading:
> man 5 virtual (http://www.postfix.org/virtual.5.html)
> man 5 pcre_table (http://www.postfix.org/pcre_table.5.html)
> man pcrepattern (http://www.pcre.org/pcre.txt, look for section "PCREPATTERN")


I am interested in catching mail to root, not "bob," but I'm sure that that is immaterial. ;) I have root aliased as follows:
root: root-list(a)lists.example.com

The idea I have is that root(a)foo.example.com will get caught by this mail catcher, which will then redirect it to the mailing list on the mail list server.

I have an MX record for one of my systems, and I sent email to root(a)foo.example.com to test it. The mail did get handled by the mail catcher, but instead of accepting the mail and forwarding it on, it rejected it with "554 5.7.1 Relay access denied." In another test, I found that this solution does work great for users with permission to relay on the mail catcher (e.g., when I send to root(a)foo.example.com through my mail catcher, it redirects as desired), but not when the mail originates elsewhere.

There is a single MX record for my servers, and it points to my mail catcher, so I would've thought that mail for root(a)foo.example.com, for which my mail catcher is the lone MX handler, would get handled by postfix without issue, instead of postfix seeing it as a relay.

I'm sure I'm missing a simple step, but I'm not sure what. I seem to recall that members of the postfix-users list typically want the output of postconf or something similar, but I forget exactly what. Let me know, and I'll send it.

Thanks for any assistance you can provide.

Daniel