- Zen IT Technologies
- Technical notes
- The inspection service is a mail hop
The inspection service is a mail hop
Jonny Flaks, Founder & Principal Architect
Technical note in Email Security
Writing the DLP rule is usually the easy part. The harder part is making sure the message reaches the inspection service, comes back safely, and then reaches the recipient without creating a loop or breaking authentication.
Once you put another service in the middle, you have changed the mail architecture.
The detour matters
Outbound inspection usually means the message leaves your mail platform, travels through another service and returns before final delivery. That creates two new transport legs and a new trust relationship.
Both legs should be encrypted. Certificates should be validated. The path back into your environment should be restricted so the relay you created cannot be used by arbitrary senders.
These are routing controls, not DLP rules, but the DLP service cannot be considered successfully deployed until they work.
Make sure returned mail does not go around again
The most obvious routing failure is a loop. A message leaves for inspection, returns, matches the same outbound rule again and is sent back to the inspection service.
The returned message therefore needs to be distinguishable from a message making its first trip. Depending on the platform, that may be done using the source the message returns from, a header added by the inspection service, a marker added by your own routing rule, or another reliable property of the return path.
Do not simply stack every possible condition together and assume more checks automatically means more safety. The important thing is that the logic remains safe if one optional marker changes. Test the behavior you actually see in live mail, not only the configuration shown in the vendor documentation.
Authentication needs to be checked again
SPF, DKIM and DMARC were designed around a mail path. You have just changed that path. SPF checks the server that handed the message to the receiver against the envelope sender being used at that point. After a detour, the connecting system may now be the inspection service, and some services also rewrite parts of the envelope.
DKIM can survive the trip when the signed content remains unchanged, but it should not be assumed. The practical rule is much simpler than the protocol explanation: After changing the mail route, test authentication again at the final recipient.
Do not accept "it passed before the change" as evidence that it still passes afterwards.
Decide what happens when the service is down
If the inspection service becomes unavailable, one of two things usually has to happen. Mail stops. Or mail continues without inspection. Both can be valid designs.
A company using outbound controls for a strict regulatory requirement may choose to stop delivery. Another organization may decide that losing all customer communication during a vendor outage is the larger risk.
The wrong answer is the one nobody chose. Ask the vendor what happens during failure, confirm it in your own design, and test it where possible.
Pilot before enforcement
Start with an explicit pilot group rather than a broad address pattern. Send messages that should trigger the policy and messages that should not. Test bodies, common attachments and different file formats.
Also test someone outside the pilot. A rule that detects sensitive content perfectly but accidentally routes the whole organization through the detector is still a failed rollout.
Where the risk allows it, begin in monitor mode. Measure what would have happened before blocking real mail. And keep the routing change reversible.
The check worth running
Send one message from a user who should be in scope and another from someone who should not. At the receiving end, inspect the headers of both.
Confirm the expected message took the inspection path, the excluded message did not, there was no loop, and authentication still works at the final destination.
Explore this expertise: Email Security