Re: non_smtpd_milters and canonical_maps - what goes first?

2017-06-03 Thread Marek Kozlowski
:-)

>> I'm reading http://www.postfix.org/MILTER_README.html and I'm still not
>> quite sure. Both are performed by cleanup. What determines the order:
>> which goes first and which goes then? I can't find any variable
>> determining this... :-( Is it pre-defined (what order?). Can I force
>> changing the order?
> 
> Canonical maps replace headers or envelopes before the entire message
> is received.  Milters replace/add/delete envelope or content after
> the entire message is received.

I'm not quite sure if I understand the term you use: `before/after the
entire message is received'. I'd really appreciate any clarification.
BTW: Is there any way to change the order?

Best regards,
Marek


Re: non_smtpd_milters and canonical_maps - what goes first?

2017-06-03 Thread Wietse Venema
> > Canonical maps replace headers or envelopes before the entire message
> > is received.  Milters replace/add/delete envelope or content after
> > the entire message is received.
> 
> I'm not quite sure if I understand the term you use: `before/after the
> entire message is received'. I'd really appreciate any clarification.
> BTW: Is there any way to change the order?

To answer the first question, 'before' refers to events that happen
earlier than 'after'.  Changing the order requires time travel or
the ability to predict the future. The second question makes no
sense at this point in time.

Wietse


Re: non_smtpd_milters and canonical_maps - what goes first?

2017-06-03 Thread Marek Kozlowski
On 06/03/2017 02:13 PM, Wietse Venema wrote:
>>> Canonical maps replace headers or envelopes before the entire message
>>> is received.  Milters replace/add/delete envelope or content after
>>> the entire message is received.
>>
>> I'm not quite sure if I understand the term you use: `before/after the
>> entire message is received'. I'd really appreciate any clarification.
>> BTW: Is there any way to change the order?
> 
> To answer the first question, 'before' refers to events that happen
> earlier than 'after'.  Changing the order requires time travel or
> the ability to predict the future. The second question makes no
> sense at this point in time.

;-)))

My question regarded: `the entire message is received'. With the stress
on `entire'. I thought that local receives a message as a whole. You
answer suggested that it receives messages partially. Some part, than
the canonical starts working then the rest and then a milter operates?

Best regards,
Marek




smime.p7s
Description: S/MIME Cryptographic Signature


Re: non_smtpd_milters and canonical_maps - what goes first?

2017-06-03 Thread Wietse Venema
Marek Kozlowski:
[ Charset ISO-8859-2 converted... ]
> On 06/03/2017 02:13 PM, Wietse Venema wrote:
> >>> Canonical maps replace headers or envelopes before the entire message
> >>> is received.  Milters replace/add/delete envelope or content after
> >>> the entire message is received.
> >>
> >> I'm not quite sure if I understand the term you use: `before/after the
> >> entire message is received'. I'd really appreciate any clarification.
> >> BTW: Is there any way to change the order?
> > 
> > To answer the first question, 'before' refers to events that happen
> > earlier than 'after'.  Changing the order requires time travel or
> > the ability to predict the future. The second question makes no
> > sense at this point in time.
> 
> ;-)))
> 
> My question regarded: `the entire message is received'. With the stress
> on `entire'. I thought that local receives a message as a whole. You
> answer suggested that it receives messages partially. Some part, than
> the canonical starts working then the rest and then a milter operates?

Perhaps surprisingly, Postfix uses the same Milter support
for mail received from the network and from local submission.
Mail in the postdrop queue is not received. It is waiting
to be received by the Postfix mail system.

Wietse


Re: non_smtpd_milters and canonical_maps - what goes first?

2017-06-03 Thread Dominic Raferd
On 3 June 2017 at 14:01, Wietse Venema  wrote:

> Marek Kozlowski:
> [ Charset ISO-8859-2 converted... ]
> > On 06/03/2017 02:13 PM, Wietse Venema wrote:
> > >>> Canonical maps replace headers or envelopes before the entire message
> > >>> is received.  Milters replace/add/delete envelope or content after
> > >>> the entire message is received.
> > >>
> > >> I'm not quite sure if I understand the term you use: `before/after the
> > >> entire message is received'. I'd really appreciate any clarification.
> > >> BTW: Is there any way to change the order?
> > >
> > > To answer the first question, 'before' refers to events that happen
> > > earlier than 'after'.  Changing the order requires time travel or
> > > the ability to predict the future. The second question makes no
> > > sense at this point in time.
> >
> > ;-)))
> >
> > My question regarded: `the entire message is received'. With the stress
> > on `entire'. I thought that local receives a message as a whole. You
> > answer suggested that it receives messages partially. Some part, than
> > the canonical starts working then the rest and then a milter operates?
>
> Perhaps surprisingly, Postfix uses the same Milter support
> for mail received from the network and from local submission.
> Mail in the postdrop queue is not received. It is waiting
> to be received by the Postfix mail system.
>
> Wietse
>

​Time travel is one way to change the order (i.e. process milter before
canonical_maps), but couldn't it also be done by re-injection?

Time travel sounds more fun though, please provide working example.​


Re: non_smtpd_milters and canonical_maps - what goes first?

2017-06-03 Thread Wietse Venema
Dominic Raferd:
> On 3 June 2017 at 14:01, Wietse Venema  wrote:
> 
> > Marek Kozlowski:
> > [ Charset ISO-8859-2 converted... ]
> > > On 06/03/2017 02:13 PM, Wietse Venema wrote:
> > > >>> Canonical maps replace headers or envelopes before the entire message
> > > >>> is received.  Milters replace/add/delete envelope or content after
> > > >>> the entire message is received.
> > > >>
> > > >> I'm not quite sure if I understand the term you use: `before/after the
> > > >> entire message is received'. I'd really appreciate any clarification.
> > > >> BTW: Is there any way to change the order?
> > > >
> > > > To answer the first question, 'before' refers to events that happen
> > > > earlier than 'after'.  Changing the order requires time travel or
> > > > the ability to predict the future. The second question makes no
> > > > sense at this point in time.
> > >
> > > ;-)))
> > >
> > > My question regarded: `the entire message is received'. With the stress
> > > on `entire'. I thought that local receives a message as a whole. You
> > > answer suggested that it receives messages partially. Some part, than
> > > the canonical starts working then the rest and then a milter operates?
> >
> > Perhaps surprisingly, Postfix uses the same Milter support
> > for mail received from the network and from local submission.
> > Mail in the postdrop queue is not received. It is waiting
> > to be received by the Postfix mail system.
> >
> > Wietse
> >
> 
> Time travel is one way to change the order (i.e. process milter before
> canonical_maps), but couldn't it also be done by re-injection?
> 
> Time travel sounds more fun though, please provide working example.

Agreed, one can always do different transformations during different
traversals through Postfix, but I suspect that the requestor had a
simpler approach in mind.

Wietse


New mail subdomain versus existing domain issues

2017-06-03 Thread lists
I'm setting up a new server with the goal of using letsencrypt ‎versus my self 
signed cert. (I'm also going to try those SpamAssassin alternatives that 
require less RAM.) So I will run two VPS for a period as I debug the new server.

That said, is there any way to implement email going to both example.com and 
mail.example.com. That is I intend the email servers to be different. Seems to 
me maybe Dovecot won't mind but I don't see this working with postfix. 

Or should I just register a new top level domain for testing? 

While I'm at it, is it suggested that email and Web use different certificates. 





Changing "mail from"

2017-06-03 Thread Mark Scholten
Hello,

We have a few forwarders where we need to change the "mail from" during the
SMTP stage. Nothing else has to change and I know that spam would be seen as
coming from our mail server if we forward it. This last part is acceptable
for us. On the mail server that we want to retire this is done (but this is
Sendmail and difficult to maintain, so we want to switch to Postfix but
keeping this behavior).

Is it possible with Postfix to do this or do I need to look for a milter or
something else to do this?

Regards, Mark



Re: Changing "mail from"

2017-06-03 Thread Marek Kozlowski
:-)

On 06/04/2017 07:58 AM, Mark Scholten wrote:
> Hello,
> 
> We have a few forwarders where we need to change the "mail from" during the
> SMTP stage. Nothing else has to change and I know that spam would be seen as
> coming from our mail server if we forward it. This last part is acceptable
> for us. On the mail server that we want to retire this is done (but this is
> Sendmail and difficult to maintain, so we want to switch to Postfix but
> keeping this behavior).
> 
> Is it possible with Postfix to do this or do I need to look for a milter or
> something else to do this?

canonical?

Best regards,
Marek

PS. Be careful if using some SRS software (for example postsrsd) cause
it may interact with canonical!


RE: Changing "mail from"

2017-06-03 Thread Mark Scholten


> -Original Message-
> From: Marek Kozlowski [mailto:m.kozlow...@mini.pw.edu.pl]
> Sent: Sunday, June 4, 2017 8:04
> To: Mark Scholten; postfix-users@postfix.org
> Subject: Re: Changing "mail from"
> 
> :-)
> 
> On 06/04/2017 07:58 AM, Mark Scholten wrote:
> > Hello,
> >
> > We have a few forwarders where we need to change the "mail from"
> > during the SMTP stage. Nothing else has to change and I know that spam
> > would be seen as coming from our mail server if we forward it. This
> > last part is acceptable for us. On the mail server that we want to
> > retire this is done (but this is Sendmail and difficult to maintain,
> > so we want to switch to Postfix but keeping this behavior).
> >
> > Is it possible with Postfix to do this or do I need to look for a
> > milter or something else to do this?
> 
> canonical?
> 
> Best regards,
> Marek
> 
> PS. Be careful if using some SRS software (for example postsrsd) cause it may
> interact with canonical!

Hello Marek,

I did check if this works. However it seems to not work for me (or I'm missing 
a setting). Maybe an example for what I want to do helps.

Mail is sent to m...@mynoc.eu and forwarder to m...@streamservice.nl. In that 
case I want the mail from to be m...@mynoc.eu, I don't care about the original 
address in the mail from during the SMTP stage. Every other location where the 
original mail address is listed doesn't have to be changed (eg in the mail 
headers including the "From" line).

Kind regards,

Mark Scholten



Re: Changing "mail from"

2017-06-03 Thread Ben McGinnes
On Sun, Jun 04, 2017 at 08:04:14AM +0200, Marek Kozlowski wrote:
> On 06/04/2017 07:58 AM, Mark Scholten wrote:
>> Hello,
>> 
>> We have a few forwarders where we need to change the "mail from"
>> during the SMTP stage. Nothing else has to change and I know that
>> spam would be seen as coming from our mail server if we forward
>> it. This last part is acceptable for us. On the mail server that we
>> want to retire this is done (but this is Sendmail and difficult to
>> maintain, so we want to switch to Postfix but keeping this
>> behavior).
>> 
>> Is it possible with Postfix to do this or do I need to look for a
>> milter or something else to do this?
> 
> canonical?

Pretty sure that PCRE header_checks will do that fairly effectively,
it'll do a find and replace.

Though admittedly my use of it is minimal; to remove the IP that gives
away my physical location (so headers match mail sent via ssh session
into the server without actually having to do that every time).
That's a fairly trivial change since it just removes two headers.

In your case you probably want to change the From and/or Sender, both
of which should be achievable with header_checks.  Maybe the
Return-Path as well, but I'm not sure if it'll work on that.


Regards,
Ben



signature.asc
Description: PGP signature