<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Long ago, Nostradamus foresaw that on 05/22/2012 11:54 AM, Larry G.
Wapnitsky would write:
<blockquote
cite="mid:FAE5CA7BEE39AF438CE87BF8DBE1375106AC9C1D@ph-svr-exch1.wrtdesign.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">I have the following code in a milter that
determines when Postfix has received an unknown command:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier New"">@Milter.noreply<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier New"">
def unknown(self, cmd):<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier New"">
self.unkMilterlog.warning('Invalid command sent: %s' % cmd)<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier New"">
try:<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier New"">
self.unkMilterlog.warning('From: %s' % self.canon_from)<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier New"">
except:<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier New"">
self.unkMilterlog.warning('unable to determine Sender')<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier New"">
try:<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier New"">
for R in self.R:<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier New"">
for recipient in R:<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier New"">
if not len(recipient) < 1: self.log('To %s' % recipient)<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier New"">
except:<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier New"">
self.unkMilterlog.warning('unable to determine
Recipient(s)')<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier New"">
return Milter.CONTINUE<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Is it possible to do further processing on
a message when “unknown” has been called? Part of the reason
this was initially created (for logging purposes) was that
another milter was not being hit when an unknown command was
being interpreted. What I’d like to do is take the full
message and put it into a MySQL blob for further analysis.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</blockquote>
Nothing about milter prevents further processing. I tested with
sendmail, results below. What problem are you having, exactly?<br>
<br>
Milter code:<br>
<br>
@Milter.noreply<br>
def unknown(self, cmd):<br>
self.log('Invalid command sent: %s' % cmd)<br>
return Milter.CONTINUE<br>
<br>
Client side:<br>
<br>
220 mail.bmsi.com ESMTP Sendmail 8.14.3/8.14.3; Tue, 22 May 2012
14:50:40 -0400<br>
HELO hulk<br>
250 mail.bmsi.com Hello hulk [192.168.0.102], pleased to meet you<br>
HELP<br>
214-2.0.0 This is sendmail version 8.14.3<br>
214-2.0.0 Topics:<br>
214-2.0.0 HELO EHLO MAIL RCPT DATA<br>
214-2.0.0 RSET NOOP QUIT HELP VRFY<br>
214-2.0.0 EXPN VERB ETRN DSN AUTH<br>
214-2.0.0 STARTTLS<br>
214-2.0.0 For more info use "HELP <topic>".<br>
214-2.0.0 To report bugs in the implementation see<br>
214-2.0.0 <a class="moz-txt-link-freetext" href="http://www.sendmail.org/email-addresses.html">http://www.sendmail.org/email-addresses.html</a><br>
214-2.0.0 For local information send email to Postmaster at your
site.<br>
214 2.0.0 End of HELP info<br>
PING super<br>
500 5.5.1 Command unrecognized: "PING super"<br>
MAIL FROM: <a class="moz-txt-link-rfc2396E" href="mailto:stuart@hulk.bmsi.com"><stuart@hulk.bmsi.com></a><br>
250 2.1.0 <a class="moz-txt-link-rfc2396E" href="mailto:stuart@hulk.bmsi.com"><stuart@hulk.bmsi.com></a>... Sender ok<br>
RCPT TO: <a class="moz-txt-link-rfc2396E" href="mailto:stuart@bmsi.com"><stuart@bmsi.com></a><br>
250 2.1.5 <a class="moz-txt-link-rfc2396E" href="mailto:stuart@bmsi.com"><stuart@bmsi.com></a>... Recipient ok<br>
SCRIBBLE: foo<br>
500 5.5.1 Command unrecognized: "SCRIBBLE: foo"<br>
DATA<br>
354 Enter mail, end with "." on a line by itself<br>
Testing<br>
.<br>
250 2.0.0 q4MIoefa002370 Message accepted for delivery<br>
quit<br>
221 2.0.0 mail.bmsi.com closing connection<br>
Connection closed by foreign host.<br>
<br>
Milter log:<br>
<br>
2012May22 14:50:40 [1] connect from hulk at ('192.168.0.102', 34367)
INTERNAL<br>
2012May22 14:50:54 [1] hello from hulk<br>
2012May22 14:51:14 [1] Invalid command sent: PING super<br>
2012May22 14:51:49 [1] mail from <a class="moz-txt-link-rfc2396E" href="mailto:stuart@hulk.bmsi.com"><stuart@hulk.bmsi.com></a> ()<br>
2012May22 14:51:58 [1] rcpt to <a class="moz-txt-link-rfc2396E" href="mailto:stuart@bmsi.com"><stuart@bmsi.com></a> ()<br>
2012May22 14:52:06 [1] Invalid command sent: SCRIBBLE: foo<br>
2012May22 14:52:17 [1] Authentication-Results: mail.bmsi.com;
iprev=pass policy.iprev=192.168.0.102 (hulk)<br>
2012May22 14:52:17 [1] X-DSpam-Score: 0.152536<br>
2012May22 14:52:17 [1] eom<br>
<br>
<br>
</body>
</html>