i am trying to use this feature in postfix 2.11:
http://www.postfix.org/postconf.5.html#milter_header_checks

I have created a milter which adds a Header: "X-Body: bla" and i'd like to filter mails, unfortunately the cleanup process doesn't support pcre for "milter_header_checks", if i use the same pcre file for "header_checks" instead of milter_header_checks the pcre check is working,

here my debug cleanup -v log :

Aug 12 12:30:55 mslnx postfix/cleanup[22263]: reply: SMFIR_ADDHEADER data 11 bytes Aug 12 12:30:55 mslnx postfix/cleanup[22263]: hbc_header_checks: 'X-Body: bla' Aug 12 12:30:55 mslnx postfix/cleanup[22263]: warning: pcre:/etc/postfix/milter_header_checks is unavailable. unsupported dictionary type: pcre Aug 12 12:30:55 mslnx postfix/cleanup[22263]: warning: pcre:/etc/postfix/milter_header_checks lookup error for "X-Body: bla" Aug 12 12:30:55 mslnx postfix/cleanup[22263]: maps_find: milter_header_checks: X-Body: bla: search aborted Aug 12 12:30:55 mslnx postfix/cleanup[22263]: warning: 268A6A80F9B: milter_header_checks map lookup problem -- message not accepted, try again later Aug 12 12:30:55 mslnx postfix/cleanup[22263]: reply: SMFIR_ACCEPT data 0 bytes Aug 12 12:30:55 mslnx postfix/cleanup[22263]: maps_free: pcre:/etc/postfix/milter_header_checks(0,lock)
Aug 12 12:30:55 mslnx postfix/cleanup[22263]: leave cleanup_milter

main.cf:
smtpd_milters = unix:/pythonsock
milter_header_checks = pcre:/etc/postfix/milter_header_checks
#header_checks = pcre:/etc/postfix/milter_header_checks <- this works fine when uncommented

/etc/postfix/milter_header_checks:
/^X-Body:\s+bla/ OK
/^./@./$/ REJECT

pcre is installed and configured in dynamicmaps.cf

$postmap -v -q "X-Body: bla" pcre:/etc/postfix/milter_header_checks
postmap: name_mask: all
postmap: inet_addr_local: configured 3 IPv4 addresses
postmap: inet_addr_local: configured 7 IPv6 addresses
postmap: dict_open: pcre:/etc/postfix/milter_header_checks
postmap: dict_pcre_lookup: /etc/postfix/milter_header_checks: X-Body: bla
OK

$postmap -v -q "a@bc" pcre:/etc/postfix/milter_header_checks
postmap: name_mask: all
postmap: inet_addr_local: configured 3 IPv4 addresses
postmap: inet_addr_local: configured 7 IPv6 addresses
postmap: dict_open: pcre:/etc/postfix/milter_header_checks
postmap: dict_pcre_lookup: /etc/postfix/milter_header_checks: a@bc
REJECT


Best regards
Matthias Schneider

Reply via email to