develooper Front page | perl.qpsmtpd | Postings from June 2006

[PATCH] Include SSL level in header, as per qmail-ssl

From:
Robin H. Johnson
Date:
June 20, 2006 00:15
Subject:
[PATCH] Include SSL level in header, as per qmail-ssl
Message ID:
20060620071548.GD11711@curie-int.vc.shawcable.net
(Some fuzz might be needed to apply the patch).

Imitate the behavior of the qmail SSL patches, and include the a fragment that
shows if encryption was used for the SSL transaction.

qmail line:
Received: from mail.foobar.com (XX.XX.XX.XX)
  by XXXXXXXXXXXXXXXXX.XXXXXXXXX.net with (DHE-RSA-AES256-SHA encrypted) SMTP; 20 Jun 2006 00:10:34 -0700

qpsmtpd line:
Received: from mail.foobar.com (HELO mail.foobar.com) (XX.XX.XX.XX)
  (smtp-auth username XXXXXXX, mechanism cram-md5)
  by mail.XXXXXXX.com (qpsmtpd/0.33-dev) with (AES256-SHA encrypted) ESMTP; Tue, 20 Jun 2006 02:10:29 -0500

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>

Index: lib/Qpsmtpd/SMTP.pm
===================================================================
--- lib/Qpsmtpd/SMTP.pm	(revision 642)
+++ lib/Qpsmtpd/SMTP.pm	(working copy)
@@ -584,13 +589,15 @@ sub data {
   $self->transaction->header($header);
 
   my $smtp = $self->connection->hello eq "ehlo" ? "ESMTP" : "SMTP";
+  my $sslheader = (defined $self->connection->notes('tls_enabled') and $self->connection->notes('tls_enabled')) ? 
+    "(".$self->connection->notes('tls_socket')->get_cipher()." encrypted) " : "";
   my $authheader = (defined $self->{_auth} and $self->{_auth} == OK) ?
     "(smtp-auth username $self->{_auth_user}, mechanism $self->{_auth_mechanism})\n" : "";
 
   $header->add("Received", "from ".$self->connection->remote_info
                ." (HELO ".$self->connection->hello_host . ") (".$self->connection->remote_ip
                . ")\n  $authheader  by ".$self->config('me')." (qpsmtpd/".$self->version
-               .") with $smtp; ". (strftime('%a, %d %b %Y %H:%M:%S %z', localtime)),
+               .") with $sslheader$smtp; ". (strftime('%a, %d %b %Y %H:%M:%S %z', localtime)),
                0);
 
   # if we get here without seeing a terminator, the connection is

-- 
Robin Hugh Johnson
E-Mail     : robbat2@orbis-terrarum.net
Home Page  : http://www.orbis-terrarum.net/?l=people.robbat2
ICQ#       : 30269588 or 41961639
GnuPG FP   : 11AC BA4F 4778 E3F6 E4ED  F38E B27B 944E 3488 4E85


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About