Hi, we're using postfix 2.3.8-2+b1 on a debian etch box with imss. I wanted to reject all emails to the company ccc.com or ccc.net with a subject containing a specific string ("Subject: [xxx] " in this test. I also tried different variations).
So I created a new postfix instance on port 10023 where the subject should be checked against the string of interest. A filter directs all emails going to ccc.com to this instance. This instance receives the email but now it seems that the header_check doesn't work. The regexp works fine when I'm testing a test file with the postmap command. Since I'm quite new in the postfix area I don't have any clue how to overcome this problem. Unfortunately I also couldn't find a similar problem/combination in the internet nor in the postfix mailing lists. I'm also wandering why I can't see the file /etc/postfix/header_checks_NR.cf in the postconf -n output. Can someone help me with this please? Thanks Jannis postconf -n: =================================== address_verify_poll_delay = 6s address_verify_relayhost = mailgw-lan.fw.aaa.com alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases append_at_myorigin = yes append_dot_mydomain = yes command_directory = /usr/sbin config_directory = /etc/postfix content_filter = daemon_directory = /usr/lib/postfix debug_peer_level = 3 default_destination_concurrency_limit = 5 default_process_limit = 200 delay_warning_time = 4h disable_vrfy_command = yes header_checks = local_destination_concurrency_limit = 2 mail_owner = postfix mailq_path = /usr/bin/mailq manpage_directory = /usr/share/man maximal_queue_lifetime = 5 message_size_limit = 50240000 mydestination = $myhostname localhost.$mydomain mydomain = aaa.com myhostname = postprx2.fw.aaa.com mynetworks = localhost 10.6.7.90 10.6.7.91 10.6.7.92 10.8.66.138 10.8.66.164 10.8.67.2... myorigin = postprx2.fw.aaa.com newaliases_path = /usr/bin/newaliases notify_classes = resource,software,protocol,policy,bounce,2bounce queue_directory = /var/spool/postfix readme_directory = /usr/share/doc/postfix relay_domains = mailgw.bbb.de aaa.com bbb-gmbh.de bbb.de sample_directory = /usr/share/doc/postfix/examples sender_canonical_maps = hash:/etc/postfix/sender_canonical.cf sendmail_path = /usr/sbin/sendmail setgid_group = postdrop smtpd_banner = $myhostname ESMTP - much luck! smtpd_helo_required = yes smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/ccc_recipient_access.cf check_recipient_access hash:/etc/postfix/recipient_access.cf permit_mynetworks reject_unauth_destination smtpd_sender_restrictions = permit_mynetworks check_sender_access hash:/etc/postfix/sender_access.cf reject transport_maps = hash:/etc/postfix/transport.cf unverified_recipient_reject_code = 550 ====================================== ccc_recipient_access.cf: ========================= ccc.net FILTER smtp:[127.0.0.1]:10023 ccc.com FILTER smtp:[127.0.0.1]:10023 header_checks_NR.cf =================== # Filter classified messages /^Subject:.*\[xxxx\].*/ WARN TEST rejecting [xxxx] mails ccc.com, ccc.net recipient_access.cf: ==================== # Perform recipient verification for this domains aaa.com reject_unverified_recipient bbb-gmbh.de reject_unverified_recipient bbb.de reject_unverified_recipient master.cf: ========== I just added here the lines before "[127.0.0.1]:10025 ... ", rest untouched. # ( testing on port 26! ) ccc-smtp inet n - n - - smtpd -D [127.0.0.1]:10023 inet n - n - - smtpd -D -o header_checks=regexp:/etc/postfix/header_checks_NR.cf -o smtpd_recipient_restrictions=permit_mynetworks,reject -o content_filter=smtp:[127.0.0.1]:10025 # [127.0.0.1]:10025 inet n - n - - smtpd -o smtpd_recipient_restrictions=permit_mynetworks,reject pickup fifo n - - 60 1 pickup cleanup unix n - - - 0 cleanup qmgr fifo n - - 300 1 qmgr tlsmgr unix - - - 1000? 1 tlsmgr rewrite unix - - - - - trivial-rewrite bounce unix - - - - 0 bounce defer unix - - - - 0 bounce trace unix - - - - 0 bounce verify unix - - - - 1 verify flush unix n - - 1000? 0 flush proxymap unix - - n - - proxymap smtp unix - - - - - smtp # When relaying mail as backup MX, disable fallback_relay to avoid MX loops relay unix - - - - - smtp -o fallback_relay= showq unix n - - - - showq error unix - - - - - error discard unix - - - - - discard local unix - n n - - local virtual unix - n n - - virtual lmtp unix - - - - - lmtp anvil unix - - - - 1 anvil scache unix - - - - 1 scache # # ==================================================================== # Interfaces to non-Postfix software. Be sure to examine the manual # pages of the non-Postfix software to find out what options it wants. # # Many of the following services use the Postfix pipe(8) delivery # agent. See the pipe(8) man page for information about ${recipient} # and other message envelope options. # ==================================================================== # # maildrop. See the Postfix MAILDROP_README file for details. # Also specify in main.cf: maildrop_destination_recipient_limit=1 # maildrop unix - n n - - pipe flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient} # # See the Postfix UUCP_README file for configuration details. # uucp unix - n n - - pipe flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient) # # Other external delivery methods. # ifmail unix - n n - - pipe flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient) bsmtp unix - n n - - pipe flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient scalemail-backend unix - n n - 2 pipe flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension} mailman unix - - n - - pipe flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user} # # <Content filter integration> # # # IScan intergration # # InterScan MSS: content filter smtp transport imss for InterScan MSS smtp-imss unix - - n - - smtp -o disable_dns_lookups=yes -o smtp_connect_timeout=1s -o smtp_data_done_timeout=10m # InterScan MSS: content filter loop back smtpd [127.0.0.1]:10026 inet n - n - 20 smtpd -o content_filter= -o smtpd_restriction_classes= -o smtpd_delay_reject=no -o smtpd_client_restrictions=permit_mynetworks,reject -o smtpd_helo_restrictions= -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,reject -o smtpd_data_restrictions=reject_unauth_pipelining -o smtpd_end_of_data_restrictions= -o smtpd_enforce_tls=no -o mynetworks=127.0.0.0/8 -o myhostname=postprx2-vs.fw.aaa.com -o smtpd_error_sleep_time=0 -o smtpd_soft_error_limit=1001 -o smtpd_hard_error_limit=1000 -o smtpd_client_connection_count_limit=0 -o smtpd_client_connection_rate_limit=0 -o smtpd_milters= -o local_header_rewrite_clients= -o local_recipient_maps= -o relay_recipient_maps= -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks -o smtpd_timeout=10m -o smtpd_sender_restrictions=permit -o smtpd_recipient_restrictions=permit_mynetworks,reject_unauth_destination ================================================ the test: ========= telnet localhost 26 . . . 250 2.1.5 Ok data 354 End data with <CR><LF>.<CR><LF> Subject: test [xxxx] - blah blah . 250 2.0.0 Ok: queued as B94191FB02 mail.log: ========= Sep 2 14:24:48 postprx2 postfix/smtpd[12106]: connect from localhost[127.0.0.1] Sep 2 14:25:00 postprx2 postfix/smtpd[12106]: NOQUEUE: filter: RCPT from localhost[127.0.0.1]: <[EMAIL PROTECTED]>: Recipient address triggers FILTER smtp:[127.0.0.1]:10023; from=<[EMAIL PROTECTED]> to=<[EMAIL PROTECTED]> proto=ESMTP helo=<aaa.com> Sep 2 14:25:00 postprx2 postfix/smtpd[12106]: B94191FB02: client=localhost[127.0.0.1] Sep 2 14:25:17 postprx2 postfix/cleanup[12139]: B94191FB02: message-id=<[EMAIL PROTECTED]> Sep 2 14:25:17 postprx2 postfix/qmgr[12098]: B94191FB02: from=<[EMAIL PROTECTED]>, size=405, nrcpt=1 (queue active) Sep 2 14:25:17 postprx2 postfix/smtpd[12145]: running: PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin xxgdb /usr/lib/postfix/smtpd 12145 & sleep 5 Sep 2 14:25:20 postprx2 postfix/smtpd[12106]: disconnect from localhost[127.0.0.1] Sep 2 14:25:22 postprx2 postfix/smtpd[12145]: connect from localhost[127.0.0.1] Sep 2 14:25:22 postprx2 postfix/smtpd[12145]: EE0D11FB03: client=localhost[127.0.0.1] Sep 2 14:25:22 postprx2 postfix/cleanup[12139]: EE0D11FB03: message-id=<[EMAIL PROTECTED]> Sep 2 14:25:22 postprx2 postfix/qmgr[12098]: EE0D11FB03: from=<[EMAIL PROTECTED]>, size=602, nrcpt=1 (queue active) Sep 2 14:25:22 postprx2 postfix/smtpd[12145]: disconnect from localhost[127.0.0.1] Sep 2 14:25:22 postprx2 postfix/smtp[12144]: B94191FB02: to=<[EMAIL PROTECTED]>, relay=127.0.0.1[127.0.0.1]:10023, delay=27, delays=21/0.02/5/0.01, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as EE0D11FB03) Sep 2 14:25:22 postprx2 postfix/qmgr[12098]: B94191FB02: removed Sep 2 14:25:23 postprx2 postfix/smtpd[12152]: connect from localhost[127.0.0.1] Sep 2 14:25:23 postprx2 postfix/smtpd[12152]: 0424A1FB02: client=localhost[127.0.0.1] Sep 2 14:25:23 postprx2 postfix/cleanup[12139]: 0424A1FB02: message-id=<[EMAIL PROTECTED]> Sep 2 14:25:23 postprx2 postfix/qmgr[12098]: 0424A1FB02: from=<[EMAIL PROTECTED]>, size=799, nrcpt=1 (queue active) Sep 2 14:25:23 postprx2 postfix/smtp[12144]: EE0D11FB03: to=<[EMAIL PROTECTED]>, relay=127.0.0.1[127.0.0.1]:10025, delay=0.05, delays=0.01/0/0.03/0.01, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 0424A1FB02) Sep 2 14:25:23 postprx2 postfix/smtpd[12152]: disconnect from localhost[127.0.0.1] Sep 2 14:25:23 postprx2 postfix/qmgr[12098]: EE0D11FB03: removed Sep 2 14:25:23 postprx2 postfix/smtp[12151]: 0424A1FB02: to=<[EMAIL PROTECTED]>, relay=192.168.168.232[192.168.168.232]:25, delay=0.31, delays=0.01/0/0.03/0.26, dsn=2.0.0, status=sent (250 2.0.0 m82CPN5O008293 Message accepted for delivery) Sep 2 14:25:23 postprx2 postfix/qmgr[12098]: 0424A1FB02: removed