Postfix having trouble with local usernames containing "%"

I have set up a test domain on my Virtualmin test installation, named "test.tianet.de". The administrative user is named "tiatest".

I created an email user "test1" under that domain. The user naming scheme is set to "user%domain" with "domain" being configured as "Username or first part of domain". So my "test1" becomes "test1%tiatest".

That system user has been correctly created. An entry in Postfix' "Virtual domain mapping" config has been added as "test1@test.tianet.de -> test1%tiatest". Looks all okay.

When mail (here: the "new email account created" confirmation auto-mail) gets send to this user though, Postfix does this:

Oct 21 01:35:35 lyra postfix/pickup[8531]: EF27A1412EF: uid=0 from=<admin@tianet.de>
Oct 21 01:35:35 lyra postfix/cleanup[9081]: EF27A1412EF: message-id=<1287617735.9067.1@lyra.tianet.de>
Oct 21 01:35:35 lyra postfix/qmgr[3378]: EF27A1412EF: from=<admin@tianet.de>, size=812, nrcpt=2 (queue active)
Oct 21 01:35:36 lyra postfix/smtp[9083]: EF27A1412EF: to=<test1@tiatest>, orig_to=<test1@test.tianet.de>, relay=none, delay=0.02, delays=0.02/0/0/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=tiatest type=A: Host not found)

It would seem as if Postfix replaced the % with an @, interpreting the username part after the % as a domain name, which naturally cannot be resolved. When I use a dot "." as naming scheme separator instead of "%", Postfix operates as expected and delivers the mail to the local user.

If this is a known issue and can't be worked around, there should be an appropriate warning in VM's config that the "%" naming scheme options must not be selected when using Postfix.

Status: 
Closed (fixed)

Comments

Additional info:

I just found the setting in Postfix' configuration Rewrite "user%domain" to "user@domain", which is set to Yes, and which would quite explain the behavior I observed. I'm quite positive though that I did not turn this option on myself.

So I guess either the VM installation script incorrectly turned it on, or incorrectly did not turn it off. :)

Which Postfix setting was that exactly? I'm certain Virtualmin doesn't turn it on, but maybe it doesn't turn it off at install time ..

I looked it up in Webmin... Postfix Mail Server / Address Rewriting and Masquerading. Not sure yet which setting in the config files it is.

Found it. In main.cf it would seem to be allow_percent_hack = no. At least that's what gets added when I turn this rewriting option off. And with that option missing, it seems to be interpreted as yes.

Interesting, looks like on some systems that is enabled by default in Postfix.

I will update the virtualmin installer to turn it off. Thanks for finding this!

Thanks, and glad to be useful! :)

Automatically closed -- issue fixed for 2 weeks with no activity.