OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
milter does not work for 2nd message in the same connection

From: Nerijus Baliunas (nerijususers.sourceforge.net)
Date: Wed Jul 18 2007 - 16:44:45 CDT


Hello,

I am using milter-greylist with Postfix 2.4.3. main.cf:
milter_default_action = accept
milter_connect_macros = j {client_addr}
milter_protocol = 3
smtpd_milters = unix:/var/milter-greylist/milter-greylist.sock

I have a rule in milter-greylist to permanently reject some kind of messages.
The problem is, when I send 2 identical messages (which both should be rejected
by milter-greylist) with maildirsmtp (from Qmail), i.e. using the same connection,
the first one is correctly rejected, but the 2nd is accepted:

Jul 9 17:51:25 mail postfix/smtpd[23756]: connect from clt-84-32-xx-xx.vdnet.lt[84.32.xx.xx]
Jul 9 17:51:25 mail milter-greylist: (unknown id): addr 84.32.xx.xx from <xxxexample.com> rcpt <postmasterexample.com>: autowhitelisted for more 72:00:00
Jul 9 17:51:25 mail postfix/smtpd[23756]: C776317884D: client=clt-84-32-xx-xx.vdnet.lt[84.32.xx.xx]
Jul 9 17:51:25 mail postfix/cleanup[23766]: C776317884D: hold: header Received: from xxx.example.com (clt-84-32-xx-xx.vdnet.lt [84.32.xx.xx])??by mail.example.com (Postfix) with ESMTP id C776317884D??for <postmasterexample.com>; Mon, 9 Jul 2007 17:51:25 +0300 (EEST) from clt-84-32-xx-xx.vdnet.lt[84.32.xx.xx]; from=<xxxexample.com> to=<postmasterexample.com> proto=ESMTP helo=<xxx.example.com>
Jul 9 17:51:25 mail postfix/cleanup[23766]: C776317884D: message-id=<20070709145125.C776317884Dmail.example.com>
Jul 9 17:51:26 mail milter-greylist: (unknown id): addr clt-84-32-xx-xx.vdnet.lt[84.32.xx.xx] from <xxxexample.com> blacklisted (ACL 108)
Jul 9 17:51:26 mail postfix/cleanup[23766]: C776317884D: milter-reject: END-OF-MESSAGE from clt-84-32-xx-xx.vdnet.lt[84.32.xx.xx]: 5.7.1 Sorry, we do not accept tiny PDF files; from=<xxxexample.com> to=<postmasterexample.com> proto=ESMTP helo=<xxx.example.com>
Jul 9 17:51:26 mail milter-greylist: (unknown id): addr 84.32.xx.xx from <xxxexample.com> rcpt <postmasterexample.com>: autowhitelisted for more 72:00:00
Jul 9 17:51:26 mail postfix/smtpd[23756]: 1AD4617884D: client=clt-84-32-xx-xx.vdnet.lt[84.32.xx.xx]
Jul 9 17:51:26 mail postfix/cleanup[23766]: 1AD4617884D: hold: header Received: from xxx.example.com (clt-84-32-xx-xx.vdnet.lt [84.32.xx.xx])??by mail.example.com (Postfix) with ESMTP id 1AD4617884D??for <postmasterexample.com>; Mon, 9 Jul 2007 17:51:26 +0300 (EEST) from clt-84-32-xx-xx.vdnet.lt[84.32.xx.xx]; from=<xxxexample.com> to=<postmasterexample.com> proto=ESMTP helo=<xxx.example.com>
Jul 9 17:51:26 mail postfix/cleanup[23766]: 1AD4617884D: message-id=<20070709145126.1AD4617884Dmail.example.com>
Jul 9 17:51:26 mail postfix/smtpd[23756]: disconnect from clt-84-32-xx-xx.vdnet.lt[84.32.xx.xx]

Strange thing is that the message which gets through has "X-Greylist:"
header attached (by milter-greylist), so it seems it goes via milter-greylist
apparently. I tried the same setup with sendmail and both messages were
correctly rejected.

postconf -n:
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
header_checks = regexp:/etc/postfix/header_checks
html_directory = no
inet_interfaces = all
local_recipient_maps = unix:passwd.byname $alias_maps $virtual_mailbox_maps
mail_owner = postfix
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
message_size_limit = 10240000
milter_connect_macros = j {client_addr}
milter_default_action = accept
milter_protocol = 3
mydestination = localhost, $myhostname, localhost.$mydomain, mysql:/etc/postfix/mysql-mydestination.cf
mydomain = example.com
myhostname = mail.example.com
mynetworks = 192.168.0.0/16, 127.0.0.0/8
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
smtpd_milters = unix:/var/milter-greylist/milter-greylist.sock
transport_maps = mysql:/etc/postfix/mysql-transport.cf hash:/etc/postfix/transport
virtual_gid_maps = mysql:/etc/postfix/mysql-virtual-gid.cf
virtual_mailbox_base = /
virtual_mailbox_limit = 10240000
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-maps.cf
virtual_minimum_uid = 500
virtual_uid_maps = mysql:/etc/postfix/mysql-virtual-uid.cf

I can provide more details about my current setup if needed.

Regards,
Nerijus