Re: Mime_header_checks and header_checks

From: List User Kreme (LuKreme)
Date: Mon Sep 01 2003 - 01:19:33 EDT


On Aug 31, 2003, at 9:48 PM, Noel Jones wrote:
> On Sun, Aug 31, 2003 at 06:01:51PM -0600, LuKreme wrote:
>> and how can I feed a test email to header checks (yes, I can say
>> "postmap -q" but that only allows me to give it a single line.
>>
>> cat /etc/postfix/header_checks
>> /^Content-Type:.*text\/html/ WARN 597 No HTML-ONLY email allowed.
>>
>
> Mime content-type headers are only passed to the mime_header_checks.
> If
> you have the default
> mime_header_checks = $header_checks
> then you can put all that stuff in header_checks. If you have
> separate files, the checks need to be in the right place.

I have separate files. the above is in /etc/postfix/header_checks

/etc/postfix/mime_header_checks:
# Noel Jones <> showed a better way:
/^Content-(Disposition|Type).*name\s*=\s*"?(.*\.(
  ade|adp|bas|bat|chm|cmd|com|cpl|crt|dll|exe|hlp|hta|
  inf|ins|isp|js|jse|lnk|mdb|mde|mdt|mdw|msc|msi|msp|mst|nws|
  ops|pcd|pif|prf|reg|scf|scr\??|sct|shb|shs|shm|swf|
  vb[esx]?|vxd|wsc|wsf|wsh))(\?=)?"?\s*(;|$)/x
   REJECT 598 Attachment name "$2" may not end with ".$3"

/etc/postfic/main.cf:
mime_header_checks = pcre:/etc/postfix/mime_header_checks
header_checks = pcre:/etc/postfix/header_checks

% postmap -q - pcre:/etc/postfix/header_checks < test.spam
content-type: text/html; charset="windows-1251" WARN 597 No HTML-ONLY
email allowed.

and yet, messages are coming in with a header content of text/html and
there is no warning logged.

> Note that you can't just make up response codes, they mean something.
> Check RFC821, section 4.2 for an overview. Generally for rejecting
> mail for local policy you can pick from 550, 553 or 554.

Evidently you can't set your own error code response anyway.

> For logging purposes, use different text, not different codes.

Yes, but using specific numbers makes it easy for me to search for
"59[0-9]" and know those are all the various header checks or 58[0-9]
for various helo checks. Just trying to make it simpler. Either way,
it doesn't seem to matter, since the "597" portion works for me and is
simply treated as the first part of the (optional text).

-- 
"Here comes sunrise.  Yeah, here's your sunrise.  I used to hide from 
the sun, tried to live my whole life underground, why'd you have to 
rise and ruin all my fun?  Just turn over; close the curtains on the 
day."







Hosted Email Solutions

Invaluement Anti-Spam DNSBLs



Powered By FreeBSD   Powered By FreeBSD