MailScanner The code for adding mail footers to outgoing messages with MailScanner has been ready for some time now, and it is going into production early next week. I’m not terribly worried, as I’ve been giving it quite a thorough going over. Famous last words. ;-) One thing did crop up several times: what happens when an S/MIME encrypted or signed message gets modified in transit? The answer is of course, that the signature is invalidated, and I had documented that and put it aside as a fait accompli. Robert asked me on Friday whether I could detect an S/MIME message. A simple question which caused me a bit of a sleepless night as well as a busy Saturday. Of course I can! Thanks to the marvellous MailScanner and its innards, it turns out I can quite easily detect whether an outgoing message has been encrypted or signed (or both). The secret lies in the safefile2file element of the message hash that MailScanner unfolds for me:

'safefile2file' => {
     'msg-9008-194.txt' => 'msg-9008-194.txt',
     '' => '',
     'msg-9008-195.html' => 'msg-9008-195.html',
     'smime.p7s' => 'smime.p7s'

I dumped a bit of email traffic and noticed that MailScanner loads the attachment names into the hash, so it is just a matter of determining whether or not that contains an smime.p7s or an smime.p7m attachment. If that is the case, I forbid a footer being attached to the message and log that fact as well. After a bit of tweaking, it turns out nicely. This is an encrypted and signed message sent from a corporate Notes account to myself at home, as seen in Thunderbird. TB encrypted message The message’s signature and encrypted payloads are intact; this is indicated by the icons on the right of the message pane. Roll on Monday!

LDAP, Mail, DomiNotes, Exim, Linux, and Security :: 12 May 2007 :: e-mail