[Mimedefang] Testing for port #/TLS in filter_relay

Paul Murphy pjm at ousekjarr.org
Wed Feb 27 03:01:37 EST 2008


> 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.



More information about the MIMEDefang mailing list