SF.net SVN: tmda: [2132] trunk/tmda

[email protected] Thu, 07 Dec 2006 11:53:01 -0800
Newsgroups gmane.mail.spam.tmda.cvs
Message-ID <[email protected]>
Revision: 2132
          http://svn.sourceforge.net/tmda/?rev=2132&view=rev
Author:   jasonrm
Date:     2006-12-07 11:53:00 -0800 (Thu, 07 Dec 2006)

Log Message:
-----------
* New feature. When a message is released from your pending queue via
  tmda-cgi, a new trace header 'X-TMDA-CGI' is added to the message
  which contains both the IP address of the remote host as well as the
  browser the client used to send the request.  This allows you to
  visually discern that the message was released via tmda-cgi rather
  than through email confirmation, and also allows for easier tracing.

For example, 

X-TMDA-Released: Thu, 07 Dec 2006 14:42:23 -0500
X-TMDA-CGI: 64.34.197.240 (Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418.9 (KHTML, like Gecko) Safari/419.3)

I added this to make it easier to trace the origin of spammers who release spam 
through tmda-cgi's confirmation link. Sure, one could gather the same info from 
the httpd access log, but not everyone has access to their httpd server's logs, 
and this is just easier as well.

Modified Paths:
--------------
    trunk/tmda/NEWS
    trunk/tmda/TMDA/ChangeLog
    trunk/tmda/TMDA/Pending.py

Modified: trunk/tmda/NEWS
===================================================================
--- trunk/tmda/NEWS	2006-11-20 21:33:32 UTC (rev 2131)
+++ trunk/tmda/NEWS	2006-12-07 19:53:00 UTC (rev 2132)
@@ -7,6 +7,13 @@
 
 TMDA 1.1.10 "Killyloch" --
 
+* New feature. When a message is released from your pending queue via
+  tmda-cgi, a new trace header 'X-TMDA-CGI' is added to the message
+  which contains both the IP address of the remote host as well as the
+  browser the client used to send the request.  This allows you to
+  visually discern that the message was released via tmda-cgi rather
+  than through email confirmation, and also allows for easier tracing.
+
 * tmda-ofmipd has a new option courtesy of Robert P. Thille.  `-L'
   turns on logging prints which logs everything that `-d' logs, except
   for the raw SMTP protocol data. Hence, it is useful if you want to

Modified: trunk/tmda/TMDA/ChangeLog
===================================================================
--- trunk/tmda/TMDA/ChangeLog	2006-11-20 21:33:32 UTC (rev 2131)
+++ trunk/tmda/TMDA/ChangeLog	2006-12-07 19:53:00 UTC (rev 2132)
@@ -1,3 +1,9 @@
+2006-12-07  Jason R. Mastaler  <[email protected]>
+
+	* Pending.py (Message.release): Add the IP address and browser
+	info of the releaser to an 'X-TMDA-CGI' header if the message was
+	released via tmda-cgi.
+	
 2006-10-27  Mark Horn  <[email protected]>
 
 	* Defaults.py: added additional description to

Modified: trunk/tmda/TMDA/Pending.py
===================================================================
--- trunk/tmda/TMDA/Pending.py	2006-11-20 21:33:32 UTC (rev 2131)
+++ trunk/tmda/TMDA/Pending.py	2006-12-07 19:53:00 UTC (rev 2132)
@@ -387,6 +387,14 @@
         # Add the date when confirmed in a header.
         del self.msgobj['X-TMDA-Released']
         self.msgobj['X-TMDA-Released'] = Util.make_date()
+	# For messages released via tmda-cgi, add the IP address and
+	# browser info of the releaser for easier tracing.
+	if os.environ.has_key('REMOTE_ADDR') and \
+		os.environ.has_key('HTTP_USER_AGENT'):
+	    cgi_header = "%s (%s)" % (os.environ.get('REMOTE_ADDR'), 
+				      os.environ.get('HTTP_USER_AGENT'))
+	    del self.msgobj['X-TMDA-CGI']
+	    self.msgobj['X-TMDA-CGI'] = cgi_header
         # Reinject the message to the original envelope recipient.
         Util.sendmail(self.show(), self.recipient, self.return_path)
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.