[Mimedefang] Testing for port #/TLS in filter_relay

Philip Prindeville philipp_subx at redfish-solutions.com
Wed Feb 27 12:18:00 EST 2008


Paul Murphy wrote:
>> So...  what can I test for in filter_relay() to know if the 
>> connection 
>> is coming in on port 25, or something else?
>>     
>
> Sendmail provides the  ${daemon_port} macro, but you'll probably have to
> tweak everything to ensure that is passed through to MD before you can check
> it.  There are some examples of this in the mailing list archives.
>
> Search for something like this in your sendmail.mc file:
>
> define(`confMILTER_MACROS_HELO', ``{if_name}, {if_addr}, j, _, i,
> {tls_version}, {cipher}, {cipher_bits}, {cert_subject}, {cert_issuer},
> {auth_type}, {auth_authen}, {auth_ssf}, {auth_author}, {mail_mailer},
> {mail_host}, {mail_addr}, {verify}'')
>
> define(`confMILTER_MACROS_ENVFROM', ``i, {auth_type}, {auth_authen},
> {auth_ssf}, {auth_author}, {mail_mailer}, {mail_host}, {mail_addr},
> {msg_size}'')
>
> Then work out from the Sendmail docs which section to add it to, restart
> Sendmail, and in filter_sender, add something like this:
>
>   read_commands_file();
>   my $tls_version=$SendmailMacros{tls_version};
>   my $tls_cipher=$SendmailMacros{cipher};
>   my $tls_cipher_bits=$SendmailMacros{cipher_bits};
>   my $tls_cert_subject=$SendmailMacros{cert_subject};
>   my $tls_cert_issuer=$SendmailMacros{cert_issuer};
>   my $verify=$SendmailMacros{verify};
>
> ...adapted for your needs, of course.  I use it to log TLS usage, as we
> require TLS for some domains.
>
> Best Wishes,
>
> Paul.
>   

Well, I could just test for auth_type or tls_version, but my 
understanding is that this isn't available as early on as filter_relay() 
and filter_helo()...  that the commands file doesn't get read until 
filter_sender(), right?

       read_commands_file()
              This function should only be called from filter_sender and  fil-
              ter_recipient. This will read the COMMANDS file (as described in
              mimedefang-protocol(7)), and will fill or update  the  following
              global   variables:   $Sender,  @Recipients,  %RecipientMailers,
              $RelayAddr, $RealRelayAddr, $RelayHostname,  $RealRelayHostname,
              $QueueID, $Helo, %SendmailMacros.


Or am I missing something?

Will the milter API support passing the port # at filter_relay() time?

-Philip




More information about the MIMEDefang mailing list