Messaging
cancel
Showing results for 
Search instead for 
Did you mean: 

sendmail corrupting PGP encrypted mail attachment

Ted Blahunka
Occasional Advisor

sendmail corrupting PGP encrypted mail attachment

Folks,

Background:

I have a vendor who sends us a PGP encrypted
mail attachment. It goes to our Exchange
Server which then forwards the message to
the Unix mail account. (This is done for
firewall/security reasons.)

Problem:

After the file arrives in the /var/mail/
file, the attachment no longer has the PGP
header info necessary to identify it as a PGP file, and thus we canot do a decryption, so
the file is useless. When I open the file
on the NT BEFORE forwarding, the PGP header
is there. If I ftp the file from NT to Unix
and open the file, the PGP info is there. When
I forward from NT to another non-Unix mail
server, the PGP info is there, so it is
definitely related to the way sendmail is
handling the attachment.

I do not know enough about sendmail or
modifying sendmail.cf to feel safe with
the trial and error approach.

Does anyone have any idea wht this is
happening or has anyone had similar
problems??

Any help/direction is resolving would be
greatly appreciated.

Thanks

Ted Blahunka
12 REPLIES
Dave Kelly_1
Respected Contributor

Re: sendmail corrupting PGP encrypted mail attachment

In /etc/mail/sendmail.cf, uncomment the line beginning

#O DeliveryMode

and change it so that it reads:

O DeliveryMode=queue

Stop/start sendmail using

/sbin/init.d/sendmail stop

and

/sbin/init.d/sendmail start

then send your message again.

In /usr/spool/mqueue you will have 1 file beginning with qf and 1 file beginning with df.

The qf file is the delivery envelope and it may also contain some MIME header information relating to the message.

The df file contains the actual message.

Check to see if the PGP information is present in those files.

The standard operation of sendmail is that it does not modify the contents of the df file, it will modify the qf file as the message is in transit.
Ted Blahunka
Occasional Advisor

Re: sendmail corrupting PGP encrypted mail attachment

Dave

I'll try that and see if it makes a differnce.

One question though: If I change the
sendmail.cf file, that stops deleivery for
everyone, correct ?? Assuming that, how does ( or maybe it doesn't??) the mail then get
delivered to the user's mail boxes??

thanks

tb
Dave Kelly_1
Respected Contributor

Re: sendmail corrupting PGP encrypted mail attachment

Putting sendmail into queue mode will hold the messages up for one interval (as defined by the option -qnnm, i.e. -q30m=30 minutes).

You can force delivery my running the command sendmail -q.
Laurent Paumier
Trusted Contributor

Re: sendmail corrupting PGP encrypted mail attachment

What does your PGP header look like ?
Sendmail should not modify the body part of an email (except for lines beginning with From and maybe 8 bit characters depending on your conf).
Ted Blahunka
Occasional Advisor

Re: sendmail corrupting PGP encrypted mail attachment

I tried Dave's suggestion to change the
DeliveryMode to 'queue'. When I look at the
dfXXXXX file in etc/spool/mqueue, the PGP
info is already stripped out, so that does
not make a difference unfortunately.

The descriptor/info for the PGP is not really in the header per se, but rather an entry at the start of the file to self-designate it as a PGP file.

This is what the first few columns of the
first row looks like before we send it to the Unix mail box ( contains some control
characters so it will look funky):

? PGP? x?? ?0~?`??yT?$??e?....."

It's the ' PGP?' portion that is getting stripped out, so when we try to decrypt, the
util doesn't recognize it as PGP and we are left w/ gibberish.

Thanks all..
Dave Kelly_1
Respected Contributor

Re: sendmail corrupting PGP encrypted mail attachment

I haven't seen the contents of a PGP message before but I need to ask why you can see 8-bit (or control) characters ?

Typically messages are MIME-encoded (base64 or quoted-printable).

Have I missed something ?
Ted Blahunka
Occasional Advisor

Re: sendmail corrupting PGP encrypted mail attachment

Dave

Your guess is as good as mine. We've sent it
from the Exchange server using the default
mode, which is mime encoded and with uuencode
mode, the output looks the same regardless.

thanks

Ted
Dave Kelly_1
Respected Contributor

Re: sendmail corrupting PGP encrypted mail attachment

Can you attach an example qf and df file to this thread ?
Ted Blahunka
Occasional Advisor

Re: sendmail corrupting PGP encrypted mail attachment

Dave

Here is the df files for a mail
message w/ the pgp attachment. The qf will
follow.

Thanks

Ted
Ted Blahunka
Occasional Advisor

Re: sendmail corrupting PGP encrypted mail attachment

Dave

The associated qf file...
Dave Kelly_1
Respected Contributor

Re: sendmail corrupting PGP encrypted mail attachment

I'm not too sure why my previously reply wasn't logged but here it is again...



I am 99.99% certain (always leave .01 as a get out clause) that sendmail is not corrupting the message.

The message is being sent as a base 64 MIME encoded message where the only item is application/octet-stream (which is MIME for binary file).

The file has a .pgp extension so the reading client needs to know what to do with those files.
Ted Blahunka
Occasional Advisor

Re: sendmail corrupting PGP encrypted mail attachment

Dave

When we ftp the same file from NT to Unix, the
reading agent recognizes the pgp file type and
decrypts it correctly. We would just use
that method but have not been able to find a way to automatically extract the attachment and ftp it from NT. We are doing all that manually for now. I was trying to use sendmail to get it to a file system on Unix that we could then run a procedure on to grab the attachment, decrypt it and go on.

At this point I will tell my users we cannot automate the procedure.

Thanks for your time looking into it.

Ted