[Mimedefang] filter_sender, authenticated or smtp (port 25) Connections

Andrew Watkins andrew at dcs.bbk.ac.uk
Sun Feb 19 05:28:05 EST 2012


I thought that getting this information from "filter_sender" was not 
possible with out some more coding, but it is easier from filter_begin, 
but this is no good for a filtering.

For example:
filter_begin has this in it:::

     if ( defined($SendmailMacros{'auth_type'})) {
         md_syslog('debug', "OK");
     } else {
         md_syslog('debug', "BAD");
     }
}

or

filter_sender can have  this:::
     read_commands_file();
     if ( defined($SendmailMacros{'auth_type'})) {
             md_syslog('debug', "authid found");
             return('ACCEPT_AND_NO_MORE_FILTERING', "authid");
         } else {
             md_syslog('debug', "authid No");
         }
     }

Andrew

-- 
Andrew Watkins * Birkbeck College
http://notallmicrosoft.blogspot.com/


On 19/02/2012 07:34, Jobst Schmalenbach wrote:
> On Sat, Feb 18, 2012 at 04:17:58PM +0100, Tilman Schmidt (t.schmidt at phoenixsoftware.de) wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Am 18.02.2012 06:57, schrieb Jobst Schmalenbach:
>>
>> I don't think you can find out on which port the connection was made,
>> but you can easily check whether it was authenticated. For example, I am
>> using
>>
>>          if (defined($SendmailMacros{"auth_type"})) {
>>
>> to avoid running SpamAssassin on messages submitted by my customers.
>> (Not because of the server load it generates, but because my customers
>> tend to be miffed if my server marks their messages as spam. ;-)
> Thanks for that.
> I have tried this but I can't get it to work.
>
> I added to sendmail.mc
>
> define(`confMILTER_MACROS_ENVFROM', ``i, {auth_type}, {auth_authen}, {auth_ssf}, {auth_author}, {mail_mailer}, {mail_host}, {mail_addr}'')
>
> and to /etc/mail/mimedefang.conf
>
> MD_EXTRA="-a auth_type -a auth_authen -a auth_ssf -a auth_author -a mail_mailer -a mail_host"
>
> and restarted the lot (sendmail, all milters and mimedefang)
>
> then in filter_sender I did:
>
>      if(defined($SendmailMacros{"auth_type"}))
>      {
>          md_syslog('info', "###################################### filter sender   : sendmail authtype SET.");
>      }
>      else
>      {
>          md_syslog('info', "###################################### filter sender   : sendmail authtype NOT set.");
>
>      }
>
> but it did not work, here is the log of sendmail (I turned some debugging on).
>
> Feb 19 18:19:03  sendmail[23578]: q1J7J3bQ023578: Milter (greylist): init success to negotiate
> Feb 19 18:19:03  sendmail[23578]: q1J7J3bQ023578: Milter (mimedefang): init success to negotiate
> Feb 19 18:19:03  sendmail[23578]: q1J7J3bQ023578: Milter (clamav): init success to negotiate
> Feb 19 18:19:03  sendmail[23578]: q1J7J3bQ023578: Milter: connect to filters
> Feb 19 18:19:03  mimedefang.pl[21047]: filter relay    :<175.36.163.211>  <[175.36.163.211]>  <>  Continue checking .....
> Feb 19 18:19:04  sendmail[23578]: STARTTLS=server, relay=pa175-36-163-211.pa.vic.optusnet.com.au [175.36.163.211] (may be forged), version=TLSv1/SSLv3, verify=NO, cipher=RC4-MD5, bits=128/128
> Feb 19 18:19:05  sendmail[23578]: AUTH=server, relay=pa175-36-163-211.pa.vic.optusnet.com.au [175.36.163.211] (may be forged), authid=jobst, mech=PLAIN, bits=0
> Feb 19 18:19:05  milter-greylist: User jobst authenticated, bypassing greylisting
> Feb 19 18:19:05  mimedefang.pl[21171]: filter sender   :<jobst at barrett.com.au>, 175.36.163.211, [175.36.163.211], pa175-36-163-211.pa.vic.optusnet.com.au
>
> Feb 19 18:19:05  mimedefang.pl[21171]: ###################################### filter sender   : sendmail authtype NOT set.
>
> Feb 19 18:19:05  mimedefang.pl[21047]: filter recipient:<jobst.schmalenbach at gmail.com>,<jobst at barrett.com.au>, 175.36.163.211, [175.36.163.211],<jobst.schmalenbach at gmail.com>, pa175-36-163-211.pa.vic.optusnet.com.au, ?, ?, ?
> Feb 19 18:19:05  sendmail[23578]: q1J7J3bQ023578: from=<jobst at barrett.com.au>, size=690, class=0, nrcpts=1, msgid=<2f9b8ee3-ab81-470d-a9fc-55df48d67082 at email.android.com>, proto=ESMTP, daemon=MTA-SSL, relay=pa175-36-163-211.pa.vic.optusnet.com.au [175.36.163.211] (may be forged)
> Feb 19 18:19:05  sendmail[23578]: q1J7J3bQ023578: Milter add: header: X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-3.0a1 (mail.barrett.com.au [220.233.246.146]); Sun, 19 Feb 2012 18:19:05 +1100 (EST)
> Feb 19 18:19:05  mimedefang.pl[21047]: filter main     : 175.36.163.211 NOT DOMAIN based ->  continue checking ..
> Feb 19 18:19:05  mimedefang.pl[21047]: MDLOG,q1J7J3bQ023578,mail_in,,,<jobst at barrett.com.au>,<jobst.schmalenbach at gmail.com>,Test
> Feb 19 18:19:05  sendmail[23578]: q1J7J3bQ023578: Milter add: header: X-Scanned-By: MIMEDefang 2.63 on 220.233.246.146
> Feb 19 18:19:05  sendmail[23578]: q1J7J3bQ023578: Milter accept: message
> Feb 19 18:19:07  sendmail[23585]: STARTTLS=client, relay=gmail-smtp-in.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=RC4-SHA, bits=128/128
> Feb 19 18:19:09  sendmail[23585]: q1J7J3bQ023578: to=<jobst.schmalenbach at gmail.com>, delay=00:00:04, xdelay=00:00:04, mailer=esmtp, pri=4690, relay=gmail-smtp-in.l.google.com. [74.125.127.27], dsn=2.0.0, stat=Sent (OK 1329635949 g9si15313381pbd.311)
>
>
>
> Jobst
>
>
>
>




More information about the MIMEDefang mailing list