PDA

View Full Version : Make firewall stop emailing specific document



BASECO
05-10-2016, 02:45 AM
Hi,

I suspect this could apply to other Office applications as well, but I don't see any specific forum for my question:

I've been asked to come up with a solution to prevent emails containing a specific Word document being emailed.
I'm not sure how exactly firewalls work, but could I create and set a custom document property and then let the firewall filter on that property?

Any other suggestions maybe?

Thanks!

gmayor
05-10-2016, 04:20 AM
What you ask is probably not possible. What's to stop someone renaming the document and mailing it, or zipping it in a zip file and mailing it or copying it to a flash drive or web resource and e-mailing it from a PC out of your control? What exactly is the issue here? Essentially if you allow someone access to a document you lose control over it. Document management systems may allow you to have more control over who has access and will keep a record of who has done what with the document.

BASECO
05-10-2016, 05:20 AM
Thanks for your reply Graham,

This is about a health care company. People over there understand the concept of losing control over a document when allowing access. They just would like some form of first-line defense against sensitive documents being sent. Of course there would/should be ways to send out these documents anyway.

So I was thinking about the concept of setting a (custom) document property in relevant document templates, say "AllowEmail = False". User would be able to toggle AllowEmail = False/True in a document, then save. When sending mail with the document attached it should/shouldn't pass the firewall.

I'm basically wondering:
Can firewalls read these document properties in email attachments?
If saved to PDF, do document properties save in that format as well?

gmayor
05-11-2016, 01:48 AM
I don't think the firewall is going to be of any help, and the best I can come up with, for the moment, works with a macro in Outlook that intercepts Send and looks for a 'yes/no' custom document property in the document attachment named "Reserved Access" with a value of 'True'. If it finds that in any attachment when the user sends the file then the message is not sent and the user sees a warning. The macro goes in the ThisOutlookSession module, but while it works if all conditions are right, there are no end of loopholes. PDF format is another issue entirely.


Option Explicit

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim olAtt As Attachment
Dim wdApp As Object
Dim oDoc As Object
Dim oProp As Object
If Item.Attachments.Count > 0 Then
For Each olAtt In Item.Attachments
If olAtt.FileName Like "*.do*" Then
olAtt.SaveAsFile Environ("Temp") & Chr(92) & olAtt.FileName
On Error Resume Next
Set wdApp = GetObject(, "Word.Application")
If Err Then
Set wdApp = CreateObject("Word.Application")
End If
On Error GoTo 0
Set oDoc = wdApp.documents.Open(Environ("Temp") & Chr(92) & olAtt.FileName)
For Each oProp In oDoc.CustomDocumentProperties
If oProp.Name = "Reserved Access" Then
If oProp.Value = True Then
MsgBox "You may not send the attachment " & olAtt.FileName
Cancel = True
End If
Exit For
End If
Next oProp
oDoc.Close 0
Kill Environ("Temp") & Chr(92) & olAtt.FileName
End If
Next olAtt
End If
lbl_Exit:
Set wdApp = Nothing
Set olAtt = Nothing
Set oDoc = Nothing
Set oProp = Nothing
Exit Sub
End Sub