[Mimedefang] Revisit: Filtering on HELO

Philip Prindeville philipp_subx at redfish-solutions.com
Sat Mar 24 22:29:50 EDT 2007


Jeff Rife wrote:
> On 23 Mar 2007 at 23:20, Philip Prindeville wrote:
>   
>> Remember: the original requirement of the HELO command
>> was to avoid mail loops by helping a host identify when it's
>> looped back on itself.
>>     
>
> Your "announce myself as the connecting interface" idea won't help 
> this, since it's likely that any local interface is not a public IP, 
> and thus would obviously not be unique in any way, which would not help 
> avoid loops.  
>   

Well, Sendmail doesn't use "EHLO [x.x.x.x]" in general,
unless it's specifically configured to have the hostname
be the bracketed IP address.

I was thinking of other mailers in general...  and MUA's
in particular, which tend to auto-discover their configuration,
rather than having it be hand-tuned like Sendmail.

But looking at the Sendmail sources, let's see:

        /* find out name for Interface through which we connect */
        len = sizeof addr;
        if (getsockname(s, &addr.sa, &len) == 0)
        {
                char *name;
                char family[5];

                macdefine(&BlankEnvelope.e_macro, A_TEMP,
                        macid("{if_addr_out}"), anynet_ntoa(&addr));
                (void) sm_snprintf(family, sizeof(family), "%d",
                        addr.sa.sa_family);
                macdefine(&BlankEnvelope.e_macro, A_TEMP,
                        macid("{if_family_out}"), family);

                name = hostnamebyanyaddr(&addr);
...
          }
...
#if _FFR_HELONAME
        /* Use the configured HeloName as appropriate */
        if (HeloName != NULL && HeloName[0] != '\0')
                mci->mci_heloname = newstr(HeloName);
#endif /* _FFR_HELONAME */
...

helo:
        if (bitnset(M_ESMTP, m->m_flags) || bitnset(M_LMTP, m->m_flags))
                mci->mci_flags |= MCIF_ESMTP;
        hn = mci->mci_heloname ? mci->mci_heloname : MyHostName;

tryhelo:
#if _FFR_IGNORE_EXT_ON_HELO
        mci->mci_flags &= ~MCIF_HELO;
#endif /* _FFR_IGNORE_EXT_ON_HELO */
        if (bitnset(M_LMTP, m->m_flags))
        {
                smtpmessage("LHLO %s", m, mci, hn);
                SmtpPhase = mci->mci_phase = "client LHLO";
        }
        else if (bitset(MCIF_ESMTP, mci->mci_flags) &&
                 !bitnset(M_FSMTP, m->m_flags))
        {
                smtpmessage("EHLO %s", m, mci, hn);
                SmtpPhase = mci->mci_phase = "client EHLO";
        }



My read on that code is that is what I described is exactly
what happens...

-Philip






More information about the MIMEDefang mailing list