[comp.mail.sendmail] sendmail 5.65+IDA, e-mail privacy.

sjg@melb.bull.oz.au (Simon J. Gerraty) (06/21/91)

I have recently installed sendmail-5.65+IDA on our Sun's and
Bull DPX/2 systems here.  We have now noticed that Postmaster
receives the body of messages being returned to sender.

With the P option set (ie. OPPostmaster in sendmail.cf)
Both the user and the Postmaster receive.

>Return-Path: <Mailer-Daemon>
>Date: Fri, 21 Jun 91 14:46:07 +1000
>From: Mailer-Daemon (Mail Delivery Subsystem)
>Subject: Returned mail: User unknown
>To: sjg
>Cc: Postmaster
>
>   ----- Transcript of session follows -----
>550 fred.nerk@sun0... User unknown
>
>   ----- Unsent message follows -----
>Return-Path: <sjg>
>Received: by sun0.melb.bull.oz.au (5.65+/Bull-1.1) 
>	id AA08893; Fri, 21 Jun 91 14:46:07 +1000
>Date: Fri, 21 Jun 91 14:46:07 +1000
>From: sjg (Simon J. Gerraty)
>Message-Id: <9106210446.AA08893@sun0.melb.bull.oz.au>
>To: fred.nerk@sun0
>Subject: this is a test
>
>Ok guys what do we see?

Without the P option set Postmaster gets nothing.

When using Sun's sendmail Postmaster would
only have received:

>Return-Path: <Mailer-Daemon>
>Date: Fri, 21 Jun 91 14:46:07 +1000
>From: Mailer-Daemon (Mail Delivery Subsystem)
>Subject: Returned mail: User unknown
>To: sjg
>Cc: Postmaster
>
>   ----- Transcript of session follows -----
>550 fred.nerk@sun0... User unknown
>
>   ----- Message header follows -----
>Return-Path: <sjg>
>Received: by sun0.melb.bull.oz.au (5.65+/Bull-1.1) 
>	id AA08893; Fri, 21 Jun 91 14:46:07 +1000
>Date: Fri, 21 Jun 91 14:46:07 +1000
>From: sjg (Simon J. Gerraty)
>Message-Id: <9106210446.AA08893@sun0.melb.bull.oz.au>
>To: fred.nerk@sun0
>Subject: this is a test

Even though the originator received the body as well. We much
prefer this arrangement.

I have had a look at savemail.c etc and can't see that the
behaviour we would like is catered for.

It seems to me that the ``Cc'' to Postmaster would have to be
handled as a separate message so that only the headers be
included.   Or that something other than sendall() would need to
be called from returntosender().

Before I go doing any useless hacking... I'd love to hear if
someone already has some patches, or better yet, that I have
missed something simple...  (yes I have read the op.me and
related documents again :-)

Please e-mail as I'll be off-site for a couple of weeks and
probably won't get a chance to read news.

-- 
Simon J. Gerraty        <sjg@sun0.melb.bull.oz.au>      (work)
                        <sjg@zen.void.oz.au>            (home)

#include <disclaimer>   /* imagine something *very* witty here */

tih@barsoom.nhh.no (Tom Ivar Helbekkmo) (06/22/91)

sjg@melb.bull.oz.au (Simon J. Gerraty) writes:

>I have recently installed sendmail-5.65+IDA on our Sun's and
>Bull DPX/2 systems here.  We have now noticed that Postmaster
>receives the body of messages being returned to sender.
>[...]
>Please e-mail as I'll be off-site for a couple of weeks and
>probably won't get a chance to read news.

No, please post...  I've noticed this behaviour too, and I'd very
much like to have it changed to work the way Simon suggests.  If
anyone out there has the necessary patches (or a description of what
needs to be done where), I'd like to hear about it.

I regard the current behaviour as a bug, which should be fixed,
so it would be right to post this information to the net at large.

-tih
--
Tom Ivar Helbekkmo, NHH, Bergen, Norway.  Telephone: +47-5-959205
Postmaster for domain nhh.no.  Internet mail:  tih@barsoom.nhh.no

rickert@mp.cs.niu.edu (Neil Rickert) (06/22/91)

In article <tih.677595600@barsoom> tih@barsoom.nhh.no (Tom Ivar Helbekkmo) writes:
>sjg@melb.bull.oz.au (Simon J. Gerraty) writes:
>
>>I have recently installed sendmail-5.65+IDA on our Sun's and
>>Bull DPX/2 systems here.  We have now noticed that Postmaster
>>receives the body of messages being returned to sender.
>
>I regard the current behaviour as a bug, which should be fixed,
>so it would be right to post this information to the net at large.

  Why exactly is this a bug?  Why is the deliberate destruction of data
ever a better design decision than the preservation of that data?

 You don't have to use:  OPPostmaster
 You can use OPMAIL-ERRORS
and then make 'MAIL-ERRORS' an alias for a shell script which preprocesses
the message to provide exactly those parts that you want.

 It is the behavior of the Sun versions which is a bug.  I challenge you
to come up with a shell script which restores the deleted data from a
bounce message.

 Please don't assume that everyone uses email the way you do.  It might
be quite reasonable at some sites for the postmaster to examine the
bounced message and refer it to someone.  This would be particularly the
case for a host where all mail traffic consisted of inquiries of some kind,
rather than personal mail.

-- 
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  Neil W. Rickert, Computer Science               <rickert@cs.niu.edu>
  Northern Illinois Univ.
  DeKalb, IL 60115                                   +1-815-753-6940

hogan@csl.sri.com (Emmett Hogan) (06/24/91)

Here is a simple shell script I use to filter out the Subject and the
body of the bounced messages...I got it from the net last year...so be
sure to give the credit to Andy Poling, who wrote it.

By sendmail.cf file has the following entry:

OPMailError

And in my aliases file I have the entry:

MailError: "|/usr/local/lib/mail/error_filter"


Where error_filter is the following shell script:

-------------------8<------cut here------8<-------------------------
#!/bin/sh
#
#  This is a filter for error messages to avoid disclosing
#  private mail to the postmaster
#
#  What it does is:
#  * remove the Subject: line from the headers of the bounced mail
#  * remove the message body
#
# Andy Poling	5-29-90
# (andy@gollum.hcf.jhu.edu)
#

TMPFILE=/tmp/mailfail.$$
trap "rm $TMPFILE; exit" 1 2 3 4 5 6 7 8 9 15

echo "Subject: FAILED MAIL

================================= FAILED MAIL =============================" > $TMPFILE
chmod 600 $TMPFILE

##
## read everything up to the failed message header
##
while read LINE
do
	if [ "$LINE" = "----- Unsent message follows -----" ]
	then
		echo "   ----- Unsent message headers -----" >> $TMPFILE
		break
	fi
	echo $LINE >> $TMPFILE
done

##
## read the failed message header, then stop before message to preserve privacy
##
while read PART1 PART2
do
	if [ "$PART1" = "" -a "$PART2" = "" ]	## end of mesage header
	then
	   /usr/5bin/echo "\n\n[message body removed for privacy]" >> $TMPFILE
	   break
	fi
	if [ "$PART1" = "Subject:" ]		## delete Subject: line too
	then
		echo $PART1 "[removed for privacy]" >> $TMPFILE
	else
		echo $PART1 $PART2 >> $TMPFILE
	fi
done

/usr/lib/sendmail -fMailer-Daemon Postmaster@csl.sri.com < $TMPFILE

rm $TMPFILE

-----------8<-----cut here-----8<------------------------------------------

Hope this helps,
Emmett


--
-------------------------------------------------------------------
Emmett Hogan              Computer Science Lab, SRI International
Inet: hogan@csl.sri.com
UUCP: {ames, decwrl, pyramid, sun}!fernwood!hercules!hogan
USMAIL: EL231, 333 Ravenswood Ave, Menlo Park, CA  94025
PacBell: (415)859-3232 (voice), (415)859-2844 (fax)
ICBM: 37d 27' 14" North, 122d 10' 52" West
-------------------------------------------------------------------

spike@coke.std.com (Joe Ilacqua) (06/30/91)

sjg@melb.bull.oz.au (Simon J. Gerraty) writes:

[He would like the BSD sendmail do behave like Sun's and not include
the body in the Postmaster copy of an error message]


	He's a patch between stock 5.61 and the version we run here.
You'll probably have to apply it by hand.

	returntosender() has a flag to control whether the body is
returned with the error.  This change has returntosender() called
twice, once for the sender and once for the Postmaster instead of one
call for both.  All we have to do is turn off the include body flag
when we send the error to the Postmaster.

->Spike

*** ../sendmail/src/savemail.c	Sun Jan  1 20:18:17 1989
--- savemail.c	Sat Jun 23 14:00:54 1990
***************
*** 216,247 ****
  					sendtolist(e->e_from.q_paddr,
  						(ADDRESS *) NULL,
  						&e->e_errorqueue);
- 
- 				/* deliver a cc: to the postmaster if desired */
- 				if (PostMasterCopy != NULL)
- 					sendtolist(PostMasterCopy,
- 						(ADDRESS *) NULL,
- 						&e->e_errorqueue);
  				q = e->e_errorqueue;
  			}
! 			else
! 			{
! 				if (parseaddr("postmaster", q, 0, '\0') == NULL)
  				{
! 					syserr("cannot parse postmaster!");
! 					ExitStat = EX_SOFTWARE;
! 					state = ESM_USRTMP;
! 					break;
  				}
! 			}
! 			if (returntosender(e->e_message != NULL ? e->e_message :
! 					   "Unable to deliver mail",
! 					   q, TRUE) == 0)
! 			{
  				state = ESM_DONE;
  				break;
! 			}
! 
  			state = state == ESM_MAIL ? ESM_POSTMASTER : ESM_USRTMP;
  			break;
  
--- 216,260 ----
  					sendtolist(e->e_from.q_paddr,
  						(ADDRESS *) NULL,
  						&e->e_errorqueue);
  				q = e->e_errorqueue;
+ 				if (returntosender(e->e_message != NULL ? e->e_message :
+ 						   "Unable to deliver mail",
+ 						   q, TRUE) == 0)
+ 				    if (PostMasterCopy == NULL) {
+ 				      state = ESM_DONE;
+ 				      break;
+ 				    }
+ 				
+ 				e->e_errorqueue = NULL; 
  			}
! 			if ((state == ESM_POSTMASTER) || 
! 			    ((PostMasterCopy != NULL) && (state == ESM_MAIL)))
! 			  {
! 			    if (state == ESM_POSTMASTER) {
! 			      if (parseaddr("postmaster", q, 0, '\0') == NULL)
  				{
! 				  syserr("cannot parse postmaster!");
! 				  ExitStat = EX_SOFTWARE;
! 				  state = ESM_USRTMP;
! 				  break;
  				}
! 			    }
! 			    else {
! 			      /* deliver a cc: to the postmaster if desired */
! 			      sendtolist(PostMasterCopy,
! 					 (ADDRESS *) NULL,
! 					 &e->e_errorqueue);
! 			      q = e->e_errorqueue;
! 			    }
! 			    
! 			    if (returntosender(e->e_message != NULL ? e->e_message :
! 					       "Unable to deliver mail",
! 					       q, FALSE) == 0)
! 			      {
  				state = ESM_DONE;
  				break;
! 			      }
! 			  }
  			state = state == ESM_MAIL ? ESM_POSTMASTER : ESM_USRTMP;
  			break;