Loading...

postfix-users@postfix.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: anyone rejecting incorrect dates with pcre header_checks? Troy Piggins Thu Apr 28 18:01:06 2011

* Duane Hill wrote :
> Thursday, April 28, 2011, 1:19:11 AM, you wrote:
> 
> > Troy Piggins wrote:
> 
> >> Wondering how you're solving this for emails sent with Date: headers
> >> way in the past or future.  What do you think is a reasonably
> >> acceptable in terms of dates.  3 days each side of the "correct"
> >> date?  3 months?  Years?
> >> 
> >> How do you keep the header_checks updated as time goes by?  I was
> >> thinking a cron script that modifies the header_checks file, but
> >> that may be a bit clumsy?
> 
> > /^Date: .* (19[0-9][0-9]|200[0-9]|2010)/   REJECT Your email is stuck in a 
> > timewarp
> 
> > Works for me. I find that bad date are usually years out. The
> > three that were rejected in the past 24 hours were from 1980
> > and two from Apr 2010.
> 
> I've also been using these now for close to five years without any
> complaints. I did at first use WARN instead of REJECT to monitor the
> results. Each line after the commented line should be on one line.
> 
> # Invalid time in date header
> /^Date:.*(2[4-9]:[0-9]{2}:[0-9]{2}|[3-9][0-9]:[0-9]{2}:[0-9]{2}|[0-9]{1,2}:[6-9][0-9]:[0-9]{2}|[0-9]{1,2}:[0-9]{2}:(6[2-9]|[7-9][0-9]))/
> REJECT invalid time in date header
> 
> # Invalid time zone offset in date header
> / \d\d:\d\d:\d\d [^+-][2-9][5-9][0-9][0-9]\s*$/ REJECT invalid time
> zone offset in date header
> 
> # Invalid date in date header
> /^Date:.*((3[2-9]|[4-9][0-9]) Jan|[3-9][0-9]
> Feb|(3[2-9]|[4-9][0-9])Mar|(3[1-9]|[4-9][0-9]) Apr|(3[2-9]|[4-9][0-9]) 
> May|(3[1-9]|[4-9][0-9]) Jun|(3[2-9]|[4-9][0-9]) 
> Jul|(3[2-9]|[4-9][0-9])Aug|(3[1-9]|[4-9][0-9]) Sep|(3[2-9]|[4-9][0-9]) 
> Oct|(3[1-9]|[4-9][0-9]) Nov|(3[2-9]|[4-9][0-9]) Dec)/ REJECT invalid date in 
> date header
> 

Thanks mate.  I'm doing some testing on this now.

-- 
Troy Piggins