On 19-Mar-2009, at 04:14, Charles Marcus wrote:
On 3/19/2009 5:55 AM, LuKreme wrote:
I came up with this one liner:

$ ls -1 /usr/local/virtual/ | grep "@" | sed
's/^\([...@]*\)@\(.*\)$/\/^\1_\(.*\)@\2$\/ \1+$...@\2/'

testu...@example.com => /^testuser_(.*)@example.com$/
testuser+$...@example.com

But the sed works for dumping all the virtual users into a .pcre map for
postfix.

I guess I'll just have to wait and see if this ever gets support
natively... it isn't that big of a problem, but it is very annoying when I run into a site that doesn't allow using a plussed address, and having an optional character or two that I could designate on a per site basis
would be very convenient.

Well, the sed I posted can easily create the virtual table you need without causing backscatter.

$ ls -1 /usr/local/virtual/ | grep "@" | \
sed 's/^\([...@]*\)@\(.*\)$/\/^\1_\(.*\)@\2$\/ \1+$...@\2/' > \
/etc/postfix/virtual_address.pcre

main.cf:
virtual_alias_maps =
    hash:$config_directory/virtual
    pcre:$config_directory/virtual_address.pcre,
    mysql:$config_directory/mysql_virtual_alias_maps.cf

of course the sed will work for any input in the form of 'u...@example.com '

If your user list changes frequently you can put it in a crontab. Mine changes infrequently enough I can afford to run it manually.

--
Over 3,500 gay marriages and, what, no hellfire? I was promise
        hellfire. And riots. What gives?  -- Mark Morford

Reply via email to