Mailing List Archive

Keep local_part_suffix in redirect router
Hello,

we'd like to allow subaddresses like user+sub@domain to deliver to users’s folder sub (if existent) via lmtp. Target system is cyrus-imapd.
We have these routers:

global_aliases:
driver = redirect
allow_defer
allow_fail
data = ${lookup{$local_part@$domain}dbm{DBM/aliases}}
local_part_suffix = "+*"
local_part_suffix_optional
retry_use_local_part
no_rewrite

local_user:
driver = accept
domains = mailbox.hrz.tu-chemnitz.de : mail.tu-chemnitz.de
no_check_local_user
transport = lmtp


and this transport:

lmtp:
driver = smtp
protocol = lmtp
hosts = host1
rcpt_include_affixes = true
delivery_date_add

Running
/usr/sbin/exim -v -d-all+route -bvfri+test@hrz.tu-chemnitz.de
shows:

routingfri+test@hrz.tu-chemnitz.de
------- global_aliases router -------
local_part=fri+test domain=hrz.tu-chemnitz.de
stripped suffix +test
calling global_aliases router
rda_interpret (string): '${lookup{$local_part@$domain}dbm{/path/aliases}}'
expanded: 'fri@mailbox.hrz.tu-chemnitz.de'
file is not a filter file
parse_forward_list:fri@mailbox.hrz.tu-chemnitz.de
extract item:fri@mailbox.hrz.tu-chemnitz.de
global_aliases router generatedfri@mailbox.hrz.tu-chemnitz.de
errors_to=NULL transport=NULL
uid=unset gid=unset home=NULL
routed by global_aliases router
envelope to:fri+test@hrz.tu-chemnitz.de
transport: <none>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
routingfri@mailbox.hrz.tu-chemnitz.de
--------> global_aliases router <--------
local_part=fri domain=mailbox.hrz.tu-chemnitz.de
calling global_aliases router
rda_interpret (string): '${lookup{$local_part@$domain}dbm{/path/aliases}}'
expanded: ''
file is not a filter file
parse_forward_list:
global_aliases router declined forfri@mailbox.hrz.tu-chemnitz.de
------- local_user router -------
local_part=fri domain=mailbox.hrz.tu-chemnitz.de
checking domains
calling local_user router
local_user router called forfri@mailbox.hrz.tu-chemnitz.de
domain = mailbox.hrz.tu-chemnitz.de
set transport lmtp
queued for lmtp transport: local_part = fri
domain = mailbox.hrz.tu-chemnitz.de
errors_to=NULL
domain_data=mailbox.hrz.tu-chemnitz.de local_part_data=NULL
routed by local_user router
envelope to:fri@mailbox.hrz.tu-chemnitz.de
transport: lmtp
fri@mailbox.hrz.tu-chemnitz.de
<--fri+test@hrz.tu-chemnitz.de
router = local_user, transport = lmtp

? the suffix +test is gone here.

Does anybody has a hint how to keep the subaddress to the lmtp transport?

Thanks,
Frank

--
Frank Richter, Chemnitz University of Technology, Germany
Re: Keep local_part_suffix in redirect router [ In reply to ]
On 08/11/2022 15:17, Frank Richter via Exim-users wrote:
> Does anybody has a hint how to keep the subaddress to the lmtp transport?

Don't have your global-aliases strip them?
--
Cheers,
Jeremy


--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Keep local_part_suffix in redirect router [ In reply to ]
On Tue, 8 Nov 2022, Frank Richter via Exim-users wrote:

> we'd like to allow subaddresses like user+sub@domain to deliver to users’s
> folder sub (if existent) via lmtp. Target system is cyrus-imapd.
> We have these routers:
>
> global_aliases:
> driver = redirect
> allow_defer
> allow_fail
> data = ${lookup{$local_part@$domain}dbm{DBM/aliases}}
> local_part_suffix = "+*"
> local_part_suffix_optional
> retry_use_local_part
> no_rewrite
>
> local_user:
> driver = accept
> domains = mailbox.hrz.tu-chemnitz.de : mail.tu-chemnitz.de
> no_check_local_user
> transport = lmtp
> …
>
> and this transport:
>
> lmtp:
> driver = smtp
> protocol = lmtp
> hosts = host1
> rcpt_include_affixes = true
> delivery_date_add
>
> Running
> /usr/sbin/exim -v -d-all+route -bvfri+test@hrz.tu-chemnitz.de
> shows:

Does "-d-all+route+transport" give any clues ?

(I always put a space between -bv and the address, but I could be wrong.)

> Does anybody has a hint how to keep the subaddress to the lmtp transport?

I take it that you need to use the suffix option so that
you can use your alias database correctly ?
${sg} might help you there - check whether the suffix follows the first or last "+".

rcpt_include_affixes isn't *explicitly* mentioned in local_part_suffix
but the intent is clearly that this should work,
so this sounds like a bug to me.

--
Andrew C. Aitchison Kendal, UK
andrew@aitchison.me.uk
--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Keep local_part_suffix in redirect router [ In reply to ]
D?a 8. novembra 2022 15:17:23 UTC používate? Frank Richter via Exim-users <exim-users@exim.org> napísal:
>Hello,
>
>we'd like to allow subaddresses like user+sub@domain to deliver to users’s folder sub (if existent) via lmtp. Target system is cyrus-imapd.
>We have these routers:
>
>global_aliases:
> driver = redirect
> allow_defer
> allow_fail
> data = ${lookup{$local_part@$domain}dbm{DBM/aliases}}
> local_part_suffix = "+*"
> local_part_suffix_optional
> retry_use_local_part
> no_rewrite
>

The suffix is in the $local_part_suffix variable and contains
separator already (eg. +tag). I use this:

dovecot_ualias:
...
domains = +our_domains

local_part_suffix = +*
local_part_suffix_optional
qualify_preserve_domain
data = ${lookup{$local_part} lsearch{VMAIL_DOM_DIR/$domain_data/aliases} \
{${quote_local_part:$value$local_part_suffix}} }

I have per domain alias file with data without RHS part, thus lookup
returns only local_part, to which is suffix appended.

If your lookup returns qualified addresses, try something as this with
lookup's result (not tested):

${sg{$value}{\N(@[^@]+)$\N}{$local_part_suffix\$1}}

regards


--
Slavko
https://www.slavino.sk/

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Keep local_part_suffix in redirect router [ In reply to ]
Am 08.11.22 um 18:00 schrieb Slavko via Exim-users:
>
>> we'd like to allow subaddresses like user+sub@domain to deliver to users’s folder sub (if existent) via lmtp. Target system is cyrus-imapd.
>> We have these routers:
>>
>> global_aliases:
>> driver = redirect
>> allow_defer
>> allow_fail
>> data = ${lookup{$local_part@$domain}dbm{DBM/aliases}}
>> local_part_suffix = "+*"
>> local_part_suffix_optional
>> retry_use_local_part
>> no_rewrite
>>
> The suffix is in the $local_part_suffix variable and contains
> separator already (eg. +tag). I use this:
>
> dovecot_ualias:
> ...
> domains = +our_domains
>
> local_part_suffix = +*
> local_part_suffix_optional
> qualify_preserve_domain
> data = ${lookup{$local_part} lsearch{VMAIL_DOM_DIR/$domain_data/aliases} \
> {${quote_local_part:$value$local_part_suffix}} }
>
> I have per domain alias file with data without RHS part, thus lookup
> returns only local_part, to which is suffix appended.
>
> If your lookup returns qualified addresses, try something as this with
> lookup's result (not tested):
>
> ${sg{$value}{\N(@[^@]+)$\N}{$local_part_suffix\$1}}

Thanks to all of you. As I've a RHS in the lookup, using

global_aliases:
driver = redirect
allow_defer
allow_fail
data = ${lookup{$local_part@$domain}dbm{DBM/aliases}{${sg{$value}{\N(@[^@]+)$\N}{$local_part_suffix@\$1}}} }
local_part_suffix = "+*"
local_part_suffix_optional
retry_use_local_part
no_rewrite

and
exim -v -d-all+route+transport -bvfri+test@hrz.tu-chemnitz.de

--------> global_aliases router <--------
local_part=fri+test domain=hrz.tu-chemnitz.de
stripped suffix +test
calling global_aliases router
rda_interpret (string): '${lookup{$local_part@$domain}dbm{/path/aliases}{${sg{$value}{\N(@[^@]+)$\N}{$local_part_suffix@\$1}}} }'
LOG: MAIN PANIC
Tainted string '+test@$1' in expansion
global_aliases router: defer forfri+test@hrz.tu-chemnitz.de
message: failed to expand "${lookup{$local_part@$domain}dbm{/path/aliases}{${sg{$value}{\N(@[^@]+)$\N}{$local_part_suffix@\$1}}} }": Tainted string '+test@$1' in expansion
fri+test@hrz.tu-chemnitz.de cannot be resolved at this time: failed to expand "${lookup{$local_part@$domain}dbm{/path/aliases}{${sg{$value}{\N(@[^@]+)$\N}{$local_part_suffix@\$1}}} }": Tainted string '+test@$1' in expansion

Hm, local_part_suffix is tainted because of the * in local_part_suffix = "+*"

Jeremy: Don't have your global-aliases strip them?

Yeah, but how?

Thanks,
Frank

--
Frank Richter, Chemnitz University of Technology, Germany