From jay at splitstreams.com Thu Jun 11 12:28:27 2009 From: jay at splitstreams.com (Jay Deiman) Date: Thu, 11 Jun 2009 11:28:27 -0500 Subject: [Pymilter] milter.error: cannot set reply Message-ID: <4A3130AB.4030103@splitstreams.com> First, let me say. This is a great piece of work that has been done. Thank you. Now, on to the nasty stuff. I'm testing pymilter 0.9.2 out with the following install: FreeBSD 7.1-RELEASE-p2 postfix 2.6.0 (installed from ports) pymilter 0.9.2 (installed from .tar.gz on sourceforge) I'm working here with a slightly modified sample.py and have found that it fails when trying to use the "setreply() method. With postfix 2.6, you can set the "milter_protocol" version in the config. I've tried with 2, 3, 4, and the default, 6. All fail with the same error: ========================================= 2009Jun05 14:59:46 [1] connect from localhost at ('127.0.0.1', 64265) 2009Jun05 14:59:46 [1] hello from localhost 2009Jun05 14:59:46 [1] mail from jdeiman at qwest.net () 2009Jun05 14:59:46 [1] rcpt to jdeiman at test.com () 2009Jun05 14:59:46 [1] REJECT: Subject: I love viagra 2009Jun05 14:59:46 [1] Subject: I love viagra 2009Jun05 14:59:46 [1] trying set reply Traceback (most recent call last): File "/usr/local/lib/python2.5/site-packages/Milter/__init__.py", line 327, in milter.set_eom_callback(lambda ctx: ctx.getpriv().eom()) File "./sample.py", line 133, in eom self.setreply(self.reply[0] , self.reply[1] , self.reply[2]) File "/usr/local/lib/python2.5/site-packages/Milter/__init__.py", line 135, in setreply return self._ctx.setreply(rcode,xcode,msg,*ml) milter.error: cannot set reply ========================================= self.reply is a tuple containing: 0: '550' 1: '' 2: 'Die spammer die' I know postfix is not the first platform this was designed for, but any help you can provide in terms of tracking this down would be great. Even if you can post some things to test regarding this would be helpful. Jay Deiman -- Jay Deiman \033:wq! From stuart at bmsi.com Thu Jun 11 12:50:21 2009 From: stuart at bmsi.com (Stuart D. Gathman) Date: Thu, 11 Jun 2009 12:50:21 -0400 (EDT) Subject: [Pymilter] milter.error: cannot set reply In-Reply-To: <4A3130AB.4030103@splitstreams.com> References: <4A3130AB.4030103@splitstreams.com> Message-ID: On Thu, 11 Jun 2009, Jay Deiman wrote: > Now, on to the nasty stuff. I'm testing pymilter 0.9.2 out with the following > install: > > FreeBSD 7.1-RELEASE-p2 > postfix 2.6.0 (installed from ports) > pymilter 0.9.2 (installed from .tar.gz on sourceforge) Good. I cannot test with postfix easily, as all my installs are sendmail. I am working on srsmilter - which is something (some people in) the postfix community wants, so finding out the differences from sendmail is good. pymilter-0.9.2 is in production at 3 sendmail sites, one of which does 400K messages/day. > the default, 6. All fail with the same error: > > 2009Jun05 14:59:46 [1] trying set reply > Traceback (most recent call last): > File "/usr/local/lib/python2.5/site-packages/Milter/__init__.py", line 327, > in > milter.set_eom_callback(lambda ctx: ctx.getpriv().eom()) > File "./sample.py", line 133, in eom > self.setreply(self.reply[0] , self.reply[1] , self.reply[2]) > File "/usr/local/lib/python2.5/site-packages/Milter/__init__.py", line 135, > in setreply > return self._ctx.setreply(rcode,xcode,msg,*ml) > milter.error: cannot set reply That error means that the smfi_setreply libmilter call returned MI_FAILURE: (in miltermodule.c) return _generic_return(smfi_setreply(ctx, rcode, xcode, message[0]), "cannot set reply"); My first guess would be that postfix doesn't support setreply, but that seems pretty basic to be missing. I notice that sample.py as distributed comments out setreply. I wonder if that was from previous testing with postfix. $%#$&* why didn't I note that in the comments... You mention: > self.reply is a tuple containing: > 0: '550' > 1: '' > 2: 'Die spammer die' I wonder if postfix demands that you set xcode to something, like '5.7.1'. The next question would be where did your libmilter come from? P.S. Did you see the new docs I am working on? Take the pymilter link from pymilter.sf.net. -- Stuart D. Gathman Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154 "Confutatis maledictis, flammis acribus addictis" - background song for a Microsoft sponsored "Where do you want to go from here?" commercial. From stuart at bmsi.com Thu Jun 11 18:18:11 2009 From: stuart at bmsi.com (Stuart D. Gathman) Date: Thu, 11 Jun 2009 18:18:11 -0400 (EDT) Subject: [Pymilter] postfix, pysrs and smfi_chgfrom Message-ID: The existing pysrs package installs a sendmail CF macro that routes the envelope sender through a socketmap for *outgoing* connections. This allows disabling SRS for selected (broken) mail relays. (Some braindead spam filters think that a '+' in the localpart indicates spam.) The new chgfrom milter mutator can be called from the eom callback for an *incoming* connection. So if some of the recipients are SRS, and some are NOSRS, then we have to duplicate the message - or SRS all, or NOSRS all. The consequences of NOSRS is that we reject any DSNs resulting from that message. The consequences of SRS is that the broken MXes will reject the message. So it looks like a milter cannot actually replace pysrs. Am I missing something? So the best I can do for the postfix people is to create an srsmilter that does srs/sign/ses or not based solely on MAIL FROM. I suppose it could look at recipients also, and do the right thing in many cases (single recipients or all of one type), with an option to do all SRS or all NOSRS for mixed recipients. While the existing pysrs package bases NOSRS on the *relay*, I suppose it is useful to base it on the RCPT domain instead for an srsmilter. -- Stuart D. Gathman Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154 "Confutatis maledictis, flammis acribus addictis" - background song for a Microsoft sponsored "Where do you want to go from here?" commercial.