Re: Unexpected record type 'X'

2022-09-06 Thread Viktor Dukhovni
On Tue, Sep 06, 2022 at 09:43:38PM -0400, J Doe wrote:

> Out of curiosity ... why do queue files require the execute bit ?

That's how they're marked "complete".  A partially written queue file is
just read-write.  When a queue is committed it is marked executable and
synced to disk, at that point the SMTP server can tell the remote client
that the file is safely persisted in the queue.

-- 
Viktor.


Re: Unexpected record type 'X'

2022-09-06 Thread J Doe

On 2022-08-30 10:35, Viktor Dukhovni wrote:

On Tue, Aug 30, 2022 at 02:25:20PM +, Frank Brendel wrote:


So I can try to reproduce it by simply putting that file into the
incoming queue?


Within the same filesystem, yes.


Our test system has FreeBSD 13.1 and Postfix 3.7.2 installed.  I'd try
to resend a mail via that system.


If you're copying queue files between systems, make sure to stop Postfix
on the target system, and run "postsuper -s" as root after copying the
queue file.  Queue file permissions need to be 0700 to make the message
deliverable, the owner needs to be the "$mail_owner" user (typically
"postfix").



Hi,

Out of curiosity ... why do queue files require the execute bit ?

Thanks,

- J


Re: Save all emails in transit, including envelope data

2022-09-06 Thread Jim Popovitch



On Tue, 2022-09-06 at 12:07 -0400, Wietse Venema wrote:
> Jim Popovitch:
> > On Tue, 2022-09-06 at 09:25 -0400, Viktor Dukhovni wrote:
> > > On Tue, Sep 06, 2022 at 06:35:05AM -0400, Wietse Venema wrote:
> > > 
> > > > > Any suggestion?
> > > > 
> > > > /etc/postfix/main.cf:
> > > > recipient_bcc_maps = pcre:/etc/postfix/recipient_bcc.pcre
> > > > 
> > > > /etc/postfix/recipient_bcc.pcre:
> > > > (.+)@(+)$1%$2@backup.example
> > > 
> > > Nit:
> > > 
> > > /(.+)@(.+)/   $1%$2@backup.example
> > 
> > What are my options for sending that to a file instead of a destination
> > address?  I want to temporarily store a copy of all bounce emails for a
> > mailinglist to debug a bounce processing problem. 
> 
> Proper mail systems will return undeliverable messages to the mailing
> list's bounce address. Just like any other email, you can receive
> those messages in a mailbox file or in a maildir structure.

Right, right.  What I want to do is add the recipient_bcc_maps that you
suggested earlier, and modify it to match the bounce address, and then
dump that to a file for future examination the next time the mailing
list's bound processing doesn't function as it should. 

-Jim P.




Re: Save all emails in transit, including envelope data

2022-09-06 Thread Wietse Venema
Jim Popovitch:
> On Tue, 2022-09-06 at 09:25 -0400, Viktor Dukhovni wrote:
> > On Tue, Sep 06, 2022 at 06:35:05AM -0400, Wietse Venema wrote:
> > 
> > > > Any suggestion?
> > > 
> > > /etc/postfix/main.cf:
> > > recipient_bcc_maps = pcre:/etc/postfix/recipient_bcc.pcre
> > > 
> > > /etc/postfix/recipient_bcc.pcre:
> > > (.+)@(+)  $1%$2@backup.example
> > 
> > Nit:
> > 
> > /(.+)@(.+)/ $1%$2@backup.example
> 
> What are my options for sending that to a file instead of a destination
> address?  I want to temporarily store a copy of all bounce emails for a
> mailinglist to debug a bounce processing problem. 

Proper mail systems will return undeliverable messages to the mailing
list's bounce address. Just like any other email, you can receive
those messages in a mailbox file or in a maildir structure.

Wietse


Re: Save all emails in transit, including envelope data

2022-09-06 Thread Jim Popovitch



On Tue, 2022-09-06 at 09:25 -0400, Viktor Dukhovni wrote:
> On Tue, Sep 06, 2022 at 06:35:05AM -0400, Wietse Venema wrote:
> 
> > > Any suggestion?
> > 
> > /etc/postfix/main.cf:
> > recipient_bcc_maps = pcre:/etc/postfix/recipient_bcc.pcre
> > 
> > /etc/postfix/recipient_bcc.pcre:
> > (.+)@(+)$1%$2@backup.example
> 
> Nit:
> 
> /(.+)@(.+)/   $1%$2@backup.example
> 

What are my options for sending that to a file instead of a destination
address?  I want to temporarily store a copy of all bounce emails for a
mailinglist to debug a bounce processing problem. 

tia,

-Jim P.



Re: Save all emails in transit, including envelope data

2022-09-06 Thread Viktor Dukhovni
On Tue, Sep 06, 2022 at 06:35:05AM -0400, Wietse Venema wrote:

> > Any suggestion?
> 
> /etc/postfix/main.cf:
> recipient_bcc_maps = pcre:/etc/postfix/recipient_bcc.pcre
> 
> /etc/postfix/recipient_bcc.pcre:
> (.+)@(+)  $1%$2@backup.example

Nit:

/(.+)@(.+)/ $1%$2@backup.example

-- 
VIktor.


Re: Save all emails in transit, including envelope data

2022-09-06 Thread Wietse Venema
Massimo Federico Bonfigli:
> As per the subject says, is there a way to save all email in transit
> through postfix, including the basic envelope info (in particular at least
> envelope sender and recipients)?
> 
> I know I could use the pipe daemon to invoke a script and save these info,
> however that would be my delivery destination, it would affect the mail
> flow and I would be forced to reinject the email into postfix and I'm not
> sure if that would come without issues so I was hoping to find some way
> that would be less intrusive.
> 
> What I thought it would be possible was to have two values in the transport
> maps, like:
> 
> * smtp:, mypipe:
> 
> To achieve email forking between transports, but this is not possible (I
> like to be an optimist at times)
> 
> As far as I know the recommended way to save a copy of all emails is to use
> always_bcc but with that I lose the envelope data and I can't "replay"
> those emails reliably in case of some data loss event.
> 
> Any suggestion?

/etc/postfix/main.cf:
recipient_bcc_maps = pcre:/etc/postfix/recipient_bcc.pcre

/etc/postfix/recipient_bcc.pcre:
(.+)@(+)$1%$2@backup.example

Wietse


Save all emails in transit, including envelope data

2022-09-06 Thread Massimo Federico Bonfigli
As per the subject says, is there a way to save all email in transit
through postfix, including the basic envelope info (in particular at least
envelope sender and recipients)?

I know I could use the pipe daemon to invoke a script and save these info,
however that would be my delivery destination, it would affect the mail
flow and I would be forced to reinject the email into postfix and I'm not
sure if that would come without issues so I was hoping to find some way
that would be less intrusive.

What I thought it would be possible was to have two values in the transport
maps, like:

* smtp:, mypipe:

To achieve email forking between transports, but this is not possible (I
like to be an optimist at times)

As far as I know the recommended way to save a copy of all emails is to use
always_bcc but with that I lose the envelope data and I can't "replay"
those emails reliably in case of some data loss event.

Any suggestion?