.forward, vacation, and bashslash username support

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

.forward, vacation, and bashslash username support

Dominic Lai
Hi,

Recently I have created a postfix driven (CentOS 8)
mail server with dovecot-lda as local delivery
agent.  We have a few number of users who make use
of vacation program (when they are on leave) so
that upon activation, a .forward file is made
under the home directory as:

\username, "|/usr/bin/vacation username"

In the past, sendmail played well when handling
"\username".  But it comes to my attention that
under postfix, it does not seem to honor
backslash username which results in mail looping
under the postfix server itself.

I have taken a look at some historical discussion,
and some were talking about \username is not
honored under aliases setting.  I would like to know
if \username is also not honored under users'
.forward files.  Thanks.

Dominic


--
Dominic Lai
Department of Computer Science and Engineering
HKUST
Reply | Threaded
Open this post in threaded view
|

Re: .forward, vacation, and bashslash username support

Viktor Dukhovni
On Fri, Aug 28, 2020 at 02:04:36AM +0000, Dominic Lai wrote:

> Recently I have created a postfix driven (CentOS 8)
> mail server with dovecot-lda as local delivery
> agent.

You should explain what you mean by that in detail.

> We have a few number of users who make use
> of vacation program (when they are on leave) so
> that upon activation, a .forward file is made
> under the home directory as:
>
> \username, "|/usr/bin/vacation username"

Well, aliases(5) and .forward files are processed by the Postfix
local(8) delivery agent, and if you replace it with something else, then
aliases(5) and .forward files may not be processed at all.

And really the question that you should be asking is how to deliver
email both to Dovecot and to a vacation program.  The "\username" thing
is perhaps a distraction, unless you have no other means to turn the
feature on.

--
    Viktor.
Reply | Threaded
Open this post in threaded view
|

Re: .forward, vacation, and bashslash username support

Bill Cole-3
In reply to this post by Dominic Lai
On 27 Aug 2020, at 22:04, Dominic Lai wrote:

> Hi,
>
> Recently I have created a postfix driven (CentOS 8)
> mail server with dovecot-lda as local delivery
> agent.  We have a few number of users who make use
> of vacation program (when they are on leave) so
> that upon activation, a .forward file is made
> under the home directory as:
>
> \username, "|/usr/bin/vacation username"
>
> In the past, sendmail played well when handling
> "\username".  But it comes to my attention that
> under postfix, it does not seem to honor
> backslash username which results in mail looping
> under the postfix server itself.
>
> I have taken a look at some historical discussion,
> and some were talking about \username is not
> honored under aliases setting.  I would like to know
> if \username is also not honored under users'
> .forward files.  Thanks.

No "historical discussion" is as definitive as the current Postfix
aliases man page:

   Lines in per-user .forward files have the same syntax as the
right-hand
   side of aliases(5) entries.

Nowhere in that page is any sort of backslash syntax described, so you
can count on no such syntax working inany Postfix aliases or .forward
file.


--
Bill Cole
[hidden email] or [hidden email]
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Not For Hire (currently)
Reply | Threaded
Open this post in threaded view
|

Re: .forward, vacation, and bashslash username support

Viktor Dukhovni
On Thu, Aug 27, 2020 at 11:31:29PM -0400, Bill Cole wrote:

> No "historical discussion" is as definitive as the current Postfix
> aliases man page:
>
>    Lines in per-user .forward files have the same syntax as the
>    right-hand side of aliases(5) entries.
>
> Nowhere in that page is any sort of backslash syntax described, so you
> can count on no such syntax working inany Postfix aliases or .forward
> file.

However, local(8) mentions:

   When an address is found in its own alias expansion, delivery is
   made to the user instead. When a user is listed in the user's own
   ~/.forward file, delivery is made to the user's mailbox instead.
   An empty ~/.forward file means do not forward mail.

So perhaps no "\user" is needed at all.  Just "user" does the job,
assuming that .forward file is processed at all.

--
    Viktor.
Reply | Threaded
Open this post in threaded view
|

Re: .forward, vacation, and bashslash username support

Dominic Lai
In reply to this post by Viktor Dukhovni
Hi,

On 28/8/2020 11:25 am, Viktor Dukhovni wrote:

> On Fri, Aug 28, 2020 at 02:04:36AM +0000, Dominic Lai wrote:
>> We have a few number of users who make use
>> of vacation program (when they are on leave) so
>> that upon activation, a .forward file is made
>> under the home directory as:
>>
>> \username, "|/usr/bin/vacation username"
>
> Well, aliases(5) and .forward files are processed by the Postfix
> local(8) delivery agent, and if you replace it with something else, then
> aliases(5) and .forward files may not be processed at all.
>
> And really the question that you should be asking is how to deliver
> email both to Dovecot and to a vacation program.  The "\username" thing
> is perhaps a distraction, unless you have no other means to turn the
> feature on.
>

The mail log reports as follows:

Aug 28 10:11:36 postfix-server postfix/local[3915542]: 2D8F33028D88:
to=<[hidden email]>, relay=local,
delay=0.06, delays=0.05/0/0/0.01, dsn=5.4.6, status=bounced (mail
forwarding loop for [hidden email])

When I look at dovecot log (I have got mail_log plugins on), and
I note that postfix bounced this message even before handling it
to dovecot-lda (ie. dovecot-lda does not even record any handling of
this transaction).

However, if I changed the .forward as follows:

username@localhost, "|/usr/bin/vacation username"

Then vacation works, username can also receive a copy of email.

If:

\username, "|/usr/bin/vacation username"

the sender would receive a mailer bounce complaining of
mail forward looping, while vacation part works.

This is why I asked if "\username" is not honored anymore.

Dominic

P.S. : Postfix version - 3.3.1, bundled from CentOS 8 distribution




--
Dominic Lai
Department of Computer Science and Engineering
HKUST
Reply | Threaded
Open this post in threaded view
|

Re: .forward, vacation, and bashslash username support

Viktor Dukhovni
On Fri, Aug 28, 2020 at 03:42:20AM +0000, Dominic Lai wrote:

> Aug 28 10:11:36 postfix-server postfix/local[3915542]: 2D8F33028D88:
> to=<[hidden email]>, relay=local,
> delay=0.06, delays=0.05/0/0/0.01, dsn=5.4.6, status=bounced (mail
> forwarding loop for [hidden email])
>
> When I look at dovecot log (I have got mail_log plugins on), and
> I note that postfix bounced this message even before handling it
> to dovecot-lda (ie. dovecot-lda does not even record any handling of
> this transaction).
>
> However, if I changed the .forward as follows:
>
> username@localhost, "|/usr/bin/vacation username"
>
> Then vacation works, username can also receive a copy of email.

This likely because $myorigin is not listed in $mydestination,
and so just a bare "username" in aliases(5) or .forward files
is not a reference to an address in "local" address class.

You either need to ensure that $myorigin is listed in
$mydestination, or else to use explicit local domains
in .forward files and aliases(5) files as you noted.

--
    Viktor.
Reply | Threaded
Open this post in threaded view
|

Re: .forward, vacation, and bashslash username support

Dominic Lai
Yes, thanks for your suggestion.  I tried it and it works.

I kept on thinking that it would work if I just set:

mydestination = postfix-server.mydomain.com $myhostname

would work (I have set myhostname=postfix-server.mydomain.com).

It turns out that I also need to set myorigin, and also need to
specifically set "mydestination = $myorigin ....".

Now, both \username and |/usr/bin/vacation work as expected!
Thanks!

Dominic


On 28/8/2020 11:47 am, Viktor Dukhovni wrote:

> On Fri, Aug 28, 2020 at 03:42:20AM +0000, Dominic Lai wrote:
>
>> Aug 28 10:11:36 postfix-server postfix/local[3915542]: 2D8F33028D88:
>> to=<[hidden email]>, relay=local,
>> delay=0.06, delays=0.05/0/0/0.01, dsn=5.4.6, status=bounced (mail
>> forwarding loop for [hidden email])
>>
>> When I look at dovecot log (I have got mail_log plugins on), and
>> I note that postfix bounced this message even before handling it
>> to dovecot-lda (ie. dovecot-lda does not even record any handling of
>> this transaction).
>>
>> However, if I changed the .forward as follows:
>>
>> username@localhost, "|/usr/bin/vacation username"
>>
>> Then vacation works, username can also receive a copy of email.
>
> This likely because $myorigin is not listed in $mydestination,
> and so just a bare "username" in aliases(5) or .forward files
> is not a reference to an address in "local" address class.
>
> You either need to ensure that $myorigin is listed in
> $mydestination, or else to use explicit local domains
> in .forward files and aliases(5) files as you noted.
>


--
Dominic Lai
Department of Computer Science and Engineering
HKUST