Re: Rewriting Date header for local senders, or something like that.

2010-08-24 Thread Jose Ildefonso Camargo Tolosa
Hi!

Thanks for your answer!

On Tue, Aug 24, 2010 at 7:31 PM, mouss  wrote:
>  Le 23/08/2010 04:47, Jose Ildefonso Camargo Tolosa a écrit :
>>
>> Hi!
>>
>> I got a curiosity, I have noted that the Date header the mail takes
>> comes from the client computer, so, if my computer have a wrong date,
>> my mail will go out with a wrong date too.
>
> there is nothing curious about that. the Date header is specified by
> whomever writes the message. If I compose a message on 1st August and send
> it on 12 Septembre, the date is 1st Aug.
>
> let me restate it: many headers, including the Date, Subject, From, ... are
> written by the message author. the mailman has no business opening the
> envelope and changing whatever lines there are in. the fact that many people
> take headers for what they are is a problem, but the solution is not: let's
> rewrite the message...

The curiosity is if it is possible to selectively rewrite the header,
not the fact the header is written by the client, I already knew that,
the issue came when discussing with a windows administrator (who loves
exchange), and she told me that in exchange you was able to make the
system put the Date header for mail coming from local clients (outlook
clients), using the server's time instead of the client's time, and
thus, I started to investigate how to do it with Postfix, but failed,
and thus, came here to ask!

>
>> I know the server will put its own timestamp when it process the
>> message, but the destination mail client will use the Date header to
>> order messages, and thus, if someone's computer has a date of now-3
>> days, there is a risk that the mail he/she sends is overseen by the
>> receiver.
>
> these people must learn to move their incoming mail to folders, or they need
> to reparse their whole inbox.
> that said, I classify my (incoming) mail by "order of reception", not by
> date...

Yeah, but most people just click the "date" column header on the mail
client, and believe that they will have "most recent" mails first (and
try to explain a secretary that she have to "classify" her email).

>
>> I also know that there should be a policy to keep all of the company's
>> PCs clock synchronized to a central server: but that's not the case,
>> and there are a few PCs with failing BIOS batteries (which shouldn't
>> happen).
>
> and there's also this thing: I can compose a message and send it later. I
> want to specify the date. I don't want the receiving system change it.

Nope, not the receiving system, the sending system (ie, your company's
mail server).

>
>> I have to ask: is there a way of making postfix rewrite Date header to
>> server's time for authenticated mail? (or at list for a range of IPs),
>> off course, a general header rewrite would not be good, because that
>> would overwrite header for mail coming from the Internet (that would
>> be really bad).
>
> the first recommendation is: forget about that. if you really insist, then

I won't do it, I just wanted to know if that was possible, in order to
tell my coworker: yes, I could do that with postfix too, just that I
don't think it is such a good idea.

> you can use header_checks
> /^Date:(.*)/    Replace X-Date $1
> Use this for a cleanup servic that is dedcated to outbound mail (this means
> you need to separate inbound and outbound mail).

Yeah, it would be a really bad idea to put this on the inbound mail
(like a said to my coworker who insisted on doing this).

>
>>  I took a quick look at the docs, and found nothing on
>> this matter, nevertheless, if someone can point me to a doc where this
>> is explained, that will be enough for me.
>>
>> What do you think on this?
>>
>
> It's a bad idea. but postfix is flexible enough...

Just what I though, Postfix is *really* flexible, you can do almost
anything with it.

Thanks!

Ildefonso.


Re: Rewriting Date header for local senders, or something like that.

2010-08-24 Thread mouss

 Le 23/08/2010 04:47, Jose Ildefonso Camargo Tolosa a écrit :

Hi!

I got a curiosity, I have noted that the Date header the mail takes
comes from the client computer, so, if my computer have a wrong date,
my mail will go out with a wrong date too.


there is nothing curious about that. the Date header is specified by 
whomever writes the message. If I compose a message on 1st August and 
send it on 12 Septembre, the date is 1st Aug.


let me restate it: many headers, including the Date, Subject, From, ... 
are written by the message author. the mailman has no business opening 
the envelope and changing whatever lines there are in. the fact that 
many people take headers for what they are is a problem, but the 
solution is not: let's rewrite the message...



I know the server will put its own timestamp when it process the
message, but the destination mail client will use the Date header to
order messages, and thus, if someone's computer has a date of now-3
days, there is a risk that the mail he/she sends is overseen by the
receiver.


these people must learn to move their incoming mail to folders, or they 
need to reparse their whole inbox.
that said, I classify my (incoming) mail by "order of reception", not by 
date...



I also know that there should be a policy to keep all of the company's
PCs clock synchronized to a central server: but that's not the case,
and there are a few PCs with failing BIOS batteries (which shouldn't
happen).


and there's also this thing: I can compose a message and send it later. 
I want to specify the date. I don't want the receiving system change it.



I have to ask: is there a way of making postfix rewrite Date header to
server's time for authenticated mail? (or at list for a range of IPs),
off course, a general header rewrite would not be good, because that
would overwrite header for mail coming from the Internet (that would
be really bad).


the first recommendation is: forget about that. if you really insist, 
then you can use header_checks

/^Date:(.*)/Replace X-Date $1
Use this for a cleanup servic that is dedcated to outbound mail (this 
means you need to separate inbound and outbound mail).



  I took a quick look at the docs, and found nothing on
this matter, nevertheless, if someone can point me to a doc where this
is explained, that will be enough for me.

What do you think on this?



It's a bad idea. but postfix is flexible enough...


Re: Rewriting Date header for local senders, or something like that.

2010-08-23 Thread Wietse Venema
Jose Ildefonso Camargo Tolosa:
> I have to ask: is there a way of making postfix rewrite Date header to
> server's time for authenticated mail? (or at list for a range of IPs),

No, but it is possible to delete the Date: header for mail that
is received via the submission service.

In the master.cf entry for the submission service, override the
cleanup service:

/etc/postfix/master.cf:
submission inet n   -   n   -   -   smtpd
  -o cleanup_service=date_cleanup
  -o ...existing stuff...

Add a duplicate cleanup service called date_cleanup

/etc/postfix/master.cf:
# Existing entry
cleanup   unix  n   -   n   -   0   cleanup
# Duplicate entry
date_cleanup   unix  n   -   n   -   0   cleanup
-o header_checks=pcre:/etc/postfix/date_header_checks

Then remove the Date: header.

/etc/postfix/date_header_checks:
/^date:/ ignore

This example is not tested so there may be a typo.

Wietse


Re: Rewriting Date header for local senders, or something like that.

2010-08-23 Thread Jose Ildefonso Camargo Tolosa
Hi!

Thanks for your answer!

On Mon, Aug 23, 2010 at 3:34 AM, Ansgar Wiechers  wrote:
> On 2010-08-22 Jose Ildefonso Camargo Tolosa wrote:
>> I got a curiosity, I have noted that the Date header the mail takes
>> comes from the client computer, so, if my computer have a wrong date,
>> my mail will go out with a wrong date too.
>>
>> I know the server will put its own timestamp when it process the
>> message, but the destination mail client will use the Date header to
>> order messages, and thus, if someone's computer has a date of now-3
>> days, there is a risk that the mail he/she sends is overseen by the
>> receiver.
>>
>> I also know that there should be a policy to keep all of the company's
>> PCs clock synchronized to a central server: but that's not the case,
>> and there are a few PCs with failing BIOS batteries (which shouldn't
>> happen).
>
> NTP should take care of both issues.

Yes, but this is not an option when you don't have control over all
the PCs.  I know it is the correct thing to do: just have all the
computers synchronize their clock (I already said so, I just omited
the technology, as a matter of fact, there is an NTP server, and I use
it for all the servers).

>
>> I have to ask: is there a way of making postfix rewrite Date header to
>> server's time for authenticated mail? (or at list for a range of IPs),
>> off course, a general header rewrite would not be good, because that
>> would overwrite header for mail coming from the Internet (that would
>> be really bad).  I took a quick look at the docs, and found nothing on
>> this matter, nevertheless, if someone can point me to a doc where this
>> is explained, that will be enough for me.
>>
>> What do you think on this?
>
> Fix the problem rather than the symptom.

Yes, I know, but it is not always an option.  As I said: you don't
always have control over the people's computer (say, the case of an
ISP, where you have lots of clients, but you don't touch a client's
computer, it is not the case, but I can think of that as an example).

Still, I want to know if is there a way of selectively rewriting
headers, actually, MS Exchange does this: it has an option to use
server's time for outgoing mail from local users (no: I will not use
Exchange).

Once again, thanks for taking the time to answer me!

Sincerely,

Ildefonso.


Re: Rewriting Date header for local senders, or something like that.

2010-08-23 Thread Ansgar Wiechers
On 2010-08-22 Jose Ildefonso Camargo Tolosa wrote:
> I got a curiosity, I have noted that the Date header the mail takes
> comes from the client computer, so, if my computer have a wrong date,
> my mail will go out with a wrong date too.
> 
> I know the server will put its own timestamp when it process the
> message, but the destination mail client will use the Date header to
> order messages, and thus, if someone's computer has a date of now-3
> days, there is a risk that the mail he/she sends is overseen by the
> receiver.
> 
> I also know that there should be a policy to keep all of the company's
> PCs clock synchronized to a central server: but that's not the case,
> and there are a few PCs with failing BIOS batteries (which shouldn't
> happen).

NTP should take care of both issues.

> I have to ask: is there a way of making postfix rewrite Date header to
> server's time for authenticated mail? (or at list for a range of IPs),
> off course, a general header rewrite would not be good, because that
> would overwrite header for mail coming from the Internet (that would
> be really bad).  I took a quick look at the docs, and found nothing on
> this matter, nevertheless, if someone can point me to a doc where this
> is explained, that will be enough for me.
> 
> What do you think on this?

Fix the problem rather than the symptom.

Regards
Ansgar Wiechers
-- 
"Abstractions save us time working, but they don't save us time learning."
--Joel Spolsky


Rewriting Date header for local senders, or something like that.

2010-08-22 Thread Jose Ildefonso Camargo Tolosa
Hi!

I got a curiosity, I have noted that the Date header the mail takes
comes from the client computer, so, if my computer have a wrong date,
my mail will go out with a wrong date too.

I know the server will put its own timestamp when it process the
message, but the destination mail client will use the Date header to
order messages, and thus, if someone's computer has a date of now-3
days, there is a risk that the mail he/she sends is overseen by the
receiver.

I also know that there should be a policy to keep all of the company's
PCs clock synchronized to a central server: but that's not the case,
and there are a few PCs with failing BIOS batteries (which shouldn't
happen).

I have to ask: is there a way of making postfix rewrite Date header to
server's time for authenticated mail? (or at list for a range of IPs),
off course, a general header rewrite would not be good, because that
would overwrite header for mail coming from the Internet (that would
be really bad).  I took a quick look at the docs, and found nothing on
this matter, nevertheless, if someone can point me to a doc where this
is explained, that will be enough for me.

What do you think on this?

Thanks in advance, sincerely,

Ildefonso.