Re: [ILUG] I thought you didn't have to fight postfix...

From: Conor Daly (conor.daly at domain oceanfree.net)
Date: Thu 06 Jun 2002 - 17:40:22 IST


On Mon, Jun 03, 2002 at 03:28:41PM +0100 or so it is rumoured hereabouts,
Gary Coady thought:
> On Sun, Jun 02, 2002 at 08:22:58PM +0100, Conor Daly wrote:
> > Well, I'm fighting with it.
> >
> > setup I have is a dialup internet account with a single email address. I
> > want to use that email address with "+" extensions to provide mail for
> > multiple users (eg. "mailaccount+user at domain isp.net" to be delivered to
> > "user at domain server.localdomain").
>
> Okay, firstly I haven't had to do any of this before, but it might actually
> be correct, and it should give you an idea of how to solve your problem :)
 
That pretty much did it... Only thing is it's rewriting the addresses for
mail from local users to local users where it shouldn't. I'll have to
figure that out next.

Two caveats...

1. my version of postfix (postfix-1.1.7-6 in RH RPM) doesn't support pcre
expressions (Found that out with "postconf -m"). Instead I've used regexp
thus:

recipient_canonical_maps = regexp:/etc/postfix/recipient_map.regexp

# /etc/postfix/recipient_map.regexp
# This is for testing only
/^mailaccount\+(.*) at domain isp.net/ ${1} at domain server.localdomain

and:

sender_canonical_maps = regexp:/etc/postfix/sender_map.regexp

# /etc/postfix/sender_map.regexp
# This line for testing only...
/^(.*) at domain (.*)$/!/^mailaccount+/ mailaccount+${1} at domain isp.net
             ^^^^^^^^^^^^^^^
2. Note the negation above. If I leave that bit out, the final address ends
up with 10 iterations of "mailaccount+" prepended! I guess the canonical
rewrite is being done multiple times.

> First of all, use in main.cf:
> recipient_canonical_maps = pcre:/etc/postfix/recipient_map.pcre
>
> # /etc/postfix/recipient_map.pcre
> # Rewrite domain+user to user - I don't think the address is re-run
> # through trivial-rewrite, so add the domain here.
> /^mailaccount\+(.*) at domain / ${1} at domain server.localdomain
>
> > I also want to rewrite outgoing mail from
> > "user at domain server.localdomain" to "mailaccount+user at domain isp.net".
>
> And here in main.cf:
> sender_canonical_maps = pcre:/etc/postfix/sender_map.pcre
>
> # /etc/postfix/sender_map.pcre
> # Rewrite user at domain to mailaccount+user at domain isp.net
> /^(.*) at domain / mailaccount+${1} at domain isp.net

Thanks,

Conor

-- 
Conor Daly <conor.daly at domain oceanfree.net>
Domestic Sysadmin :-)
---------------------
Faenor.cod.ie
  4:27pm  up 14 days,  1:45,  0 users,  load average: 0.15, 0.03, 0.01
Hobbiton.cod.ie
  4:30pm  up 14 days,  1:51,  2 users,  load average: 0.02, 0.05, 0.00


This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:17:07 GMT