[Pymilter] simple milter design needed

Stuart D. Gathman stuart at bmsi.com
Thu Apr 8 14:02:27 EDT 2004


On Sun, 4 Apr 2004, Stuart D. Gathman wrote:

> > If I'm interpreting this correctly, it is presenting the address of the 
> >   host initiating the smtp transaction.  I need to know something 
> > different which is which interface the message arrives on not where it 
> > came from.  reason being that I perform asymectric operation on the mail 
> 
> The if_name macro tells you that, I believe.  The if_addr macro tells
> you the destination IP the message arrived on.  These are distinct from

I did some experiments with getsymval.  It turns out that you need the
braces for the query:

    self.if_name = self.getsymval('{if_name}')
    self.if_addr = self.getsymval('{if_addr}')

whereas for other macros you don't:

    self.receiver = self.getsymval('j')

If_name does not return the interface name as you would expect, but rather the
host name looked up from the if_addr.  So the if_addr is far more useful.  With
the combination of source and destination ip (connect_ip and if_addr), you can
query the ip routing system to find the (current) interface address(es), if
that is what you want.  However, these can change over the life of a TCP
connection.  Your security should really be based on the source (passed to 
connect) and destination (if_addr) IP of the TCP connection.

-- 
			Stuart D. Gathman <stuart at bmsi.com>
      Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
      "Very few of our customers are going to have a pure Unix
      or pure Windows environment." - Dennis Oldroyd, Microsoft Corporation




More information about the Pymilter mailing list