Multiple delivery of queued message to local alias

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple delivery of queued message to local alias

kousou+postfix
Hello all,
For the past week I have been puzzled with the following case .
In local aliases I have defined an alias
alias1: user1, user2, user3
User2 is overquota and messages destined to user2 are deferred.
When a message is sent to alias1 it is delivered to user1 and user3,
deferred for user2 and put in queue with user2 AND alias as recipients !!!

"postqueue -p"  looks like this (pseudo anonymized)

-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
B09367FF67      475 Fri Oct 26 17:19:13  [hidden email]
            (temporary failure. Command output: maildrop: maildir over
quota.)
                                         [hidden email]
                                         [hidden email]


-- 1 Kbytes in 1 Request.

This results to user1 and user3 receiving the same queued message again and
again each time postfix tries to deliver the message out of the queue into
user3 maildir .!!!

This behavior happens in debian 8 and debian 9 with
default-debian-postfix-package installed.

Full postconf is attached (zipped and slightly edited for anonymization and
readability .)
(I tried to send it inline but the message bounced ... Message too long
(>40000 chars))

At your disposal for any further relevant information you may need.
I thank you in advance for your support.

----
Constantinos Kousouris
Network Operation Centre
Athens University of Economics and Business


postconf_out.zip (11K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Multiple delivery of queued message to local alias

Wietse Venema
[hidden email]:
> Hello all,
> For the past week I have been puzzled with the following case .
> In local aliases I have defined an alias
> alias1: user1, user2, user3
> User2 is overquota and messages destined to user2 are deferred.
> When a message is sent to alias1 it is delivered to user1 and user3,
> deferred for user2 and put in queue with user2 AND alias as recipients !!!

Has worked this way for 20 years. The problem is that there is
only one queue file record (for alias1). That record cannot be
deleted as long as one of (user1, user2, user3) is deferred.

The solution is to force Postfix to write the addresses to a queue
file before attempting delivery, so that it can delete individual
recipients from the queue file.

Add an "owner-alias1: address" entry to the local aliases file,
or use virtual_alias_maps instead.

        Wietse

Reply | Threaded
Open this post in threaded view
|

RE: Multiple delivery of queued message to local alias

kousou+postfix
I do appreciate your prompt response.

Your first suggestion (to add an "owner-alias1: address" entry to the local
aliases file) creates a new problem ...
The queue entry has [hidden email] as sender address, instead of
the real sender address of the initial message.

-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
A87037FE0A      597 Mon Oct 29 14:12:39  [hidden email]
            (temporary failure. Command output: maildrop: maildir over
quota.)
                                         [hidden email]

So ... after the expiration of the maximal_queue_lifetime the DSN message
will not be sent to correct recipient ...

Your second suggestion works like a charm ... with a little risk of
confusion from the administrators point of view (distinct local and virtual
domains with distinct local and virtual aliases ... but in the end all
aliases treated as virtual aliases ...)

In the meantime I realized/discovered that when the alias1 is defined in
local alias file using the include file notation, i.e.
alias1:  :include:/full/path/to/alias1_members
the message is queued with the initial sender address and with only the
overquota recipient (as it is when virtual aliases are used ... and as I
would expect ...)

Anyway I will go for the 'treat as virtual aliases' solution.

Yet, with all respect, I do believe that you should reconsider the issue so
that no such 'tricks' would be necessary and hence the deployment and
administration of the system would be more straightforward.

Thanks a lot again for your support.

Constantinos

----
Constantinos Kousouris
Network Operation Centre
Athens University of Economics and Business


-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Wietse Venema
Sent: Monday, October 29, 2018 1:49 PM
To: Postfix users <[hidden email]>
Subject: Re: Multiple delivery of queued message to local alias

[hidden email]:
> Hello all,
> For the past week I have been puzzled with the following case .
> In local aliases I have defined an alias
> alias1: user1, user2, user3
> User2 is overquota and messages destined to user2 are deferred.
> When a message is sent to alias1 it is delivered to user1 and user3,
> deferred for user2 and put in queue with user2 AND alias as recipients !!!

Has worked this way for 20 years. The problem is that there is only one
queue file record (for alias1). That record cannot be deleted as long as one
of (user1, user2, user3) is deferred.

The solution is to force Postfix to write the addresses to a queue file
before attempting delivery, so that it can delete individual recipients from
the queue file.

Add an "owner-alias1: address" entry to the local aliases file, or use
virtual_alias_maps instead.

        Wietse


Reply | Threaded
Open this post in threaded view
|

Re: Multiple delivery of queued message to local alias

Viktor Dukhovni
> On Oct 29, 2018, at 10:59 AM, [hidden email] wrote:
>
> Yet, with all respect, I do believe that you should reconsider the issue so
> that no such 'tricks' would be necessary and hence the deployment and
> administration of the system would be more straightforward.

Unfortunately, the tricks are a necessary architectural consequence of:

  * Sendmail-compatible aliases files
  * Performance, i.e. parallel delivery of distinct local recipients

Therefore, this part of the design won't change.  If users read the
documentation, we could perhaps find a few more places to encourage
them to avoid aliases(5) and use virtual(5) for all rewriting that
maps addresses to other addresses.  The aliases(5) file should ONLY
be used for:

        * addresses that expand to pipes
        * addresses that expand to ":include:" lists
        * addresses with an "owner-" alias.

Furthermore, to reduce unintentional deliveries to the legacy
local(8) mailer, all bare addresses ("user" rather "[hidden email]")
should qualify via "$myorigin" to a virtual alias domain, that does
all the requisite rewriting, and only final addresses that rewrite
into a non-default local domain "@localhost.$mydomain" or "@$myhostname"
should go to the local mailer.

That is:

   main.cf:

        # Uncomment zero or more, fewer generally better
        mydestination =
                # $myhostname
                # localhost.$mydomain
                # localhost.invalid
                # localhost.local

        # Make sure this is not listed in $mydestination
        myorigin = $mydomain
        virtual_alias_domains = $myorigin

        # Explicit rewrites for all local(8) deliveries:
        indexed = ${default_database_type}:${config_directory}/
        virtual_alias_maps = ${indexed}virtual

        # Local aliases for just pipes, include files, ...
        alias_database = ${indexed}aliases
        alias_maps = $alias_database
       
        # Automatically qualify "localhost" (revert Postfix 3.0 default)
        append_dot_mydomain = yes

   virtual:
        # Joe has a local(8) mailbox, and may have a .forward file, ...
        [hidden email] joe@localhost

        # mypipe expands to "|command" running as ${default_privs} (nobody)
        #
        [hidden email] mypipe@localhost

        # mylist has an owner-alias, and expands via a ":include:" path
        #
        [hidden email] mylist@localhost

--
--
        Viktor.

Reply | Threaded
Open this post in threaded view
|

RE: Multiple delivery of queued message to local alias

kousou+postfix
It's all very clear to me now, after your reply Viktor ...

> ... If users read the
> documentation, we could perhaps find a few more places to encourage them
> to avoid aliases(5) and use virtual(5) for all rewriting that maps
addresses to
> other addresses.  
> ...
That would be very useful

Thanks a lot for your time and effort to explain it in such a clear way.

Constantinos