%3CLINGO-SUB%20id%3D%22lingo-sub-1420838%22%20slang%3D%22en-US%22%3EDemystifying%20and%20troubleshooting%20hybrid%20mail%20flow%3A%20when%20is%20a%20message%20internal%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1420838%22%20slang%3D%22en-US%22%3E%3CP%3EWhen%20we%20need%20to%20deploy%20a%20hybrid%20scenario%2C%20the%20first%20thing%20that%20comes%20to%20mind%20is%20running%20the%20Hybrid%20Configuration%20Wizard.%20Indeed%2C%20HCW%20is%20enough%20to%20make%20the%20magic%20happen%20between%20Exchange%20Online%20(EXO)%20and%20Exchange%20on-premises.%20But%2C%20if%20you%20want%20to%20pull%20back%20the%20curtain%20on%20the%20mail%20flow%20and%20connectors%2C%20this%20post%20is%20for%20you!%20It%20is%20not%20unusual%20to%20see%20connector%20settings%20be%20changed%20manually%2C%20which%20might%20result%20in%20unexpected%20behavior.%20Additionally%2C%20some%20customers%20want%20to%20push%20the%20limits%20of%20their%20configuration%20by%20introducing%20additional%20hops%20into%20the%20mail%20flow%20path.%20This%20post%20attempts%20to%20provide%20technical%20details%20helpful%20for%20troubleshooting%20and%20deploying%20hybrid%20mail%20flow%20securely.%3C%2FP%3E%0A%3CP%3EBefore%20starting%20with%20deep%20dive%20stuff%2C%20we%20must%20be%20familiar%20with%20some%20definitions%20related%20to%20%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fexchange-team-blog%2Foffice-365-message-attribution%2Fba-p%2F749143%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3ETenant%20Attribution%3C%2FA%3E%3C%2FSPAN%3E%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EOriginating%3A%3C%2FSTRONG%3E%20A%20message%20that%20originates%20from%20a%20tenant%E2%80%99s%20on-premises%20server%20(it%20will%20match%20the%20tenant%E2%80%99s%20inbound%20connector%20that%20is%20of%20type%20OnPremises)%2C%20or%20from%20an%20Exchange%20Online%20mailbox.%20If%20Office%20365%20is%20unable%20to%20identify%20the%20message%20as%20originatingand%20the%20recipient%20domain%20is%20an%20accepted%20domain%20in%20an%20Office%20365%20organization%2C%20the%20service%20will%20identify%20the%20message%20as%20incomingto%20the%20recipient%20organization.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EIncoming%3A%3C%2FSTRONG%3E%20Messages%20sent%20to%20accepted%20domains%20that%20are%20in%20Office%20365%20that%20do%20not%20match%20a%20tenant%20connector%20that%20is%20of%20type%20OnPremises.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EYou%20can%20check%20the%20X-MS-Exchange-Organization-MessageDirectionality%20header%2C%20which%20tells%20if%20the%20decision%20is%20Originating%20or%20Incoming.%3C%2FP%3E%0A%3CP%3EFrom%20a%20hybrid%20mail%20flow%20perspective%2C%20there%20is%20an%20important%20header%20which%20we%20often%20check%20in%20security%20assessment%20situation%20or%20any%20spam%2C%20spoof%2C%20or%20phish%20analysis%20called%3A%20X-MS-Exchange-Organization-AuthAs.%26nbsp%3B%20We%20should%20focus%20on%20two%20possible%20values%20of%20that%20header%3A%20%3CEM%3EInternal%3C%2FEM%3E%20or%20%3CEM%3EAnonymous.%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3EMessages%20are%20considered%20%3CEM%3EInternal%3C%2FEM%3E%20if%20they%20authenticated%20in%20some%20manner%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EAuthenticated%20mailbox%20on-prem%20or%20Exchange%20Online%20(StoreDriver)%3C%2FLI%3E%0A%3CLI%3EAuthenticated%20mailbox%20using%20SMTP%20client%20submission%20(SMTP%20AUTH)%3C%2FLI%3E%0A%3CLI%3EReceived%20through%20an%20on-prem%20receive%20connector%20with%20%3CEM%3EExternalAuthoritative%3C%2FEM%3E%20(Externally%20Secured)%20permission%20enabled%3C%2FLI%3E%0A%3CLI%3ECame%20into%20Exchange%20Online%20via%20an%20inbound%20connector%20with%20%3CEM%3ETreatMessagesAsInternal%3C%2FEM%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EMessages%20are%20considered%20%3CEM%3EExternal%3C%2FEM%3E%20if%20they%20are%20received%20through%20an%20%3CEM%3EAnonymous%3C%2FEM%3E%20source%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EInternet%3C%2FLI%3E%0A%3CLI%3ESMTP%20relay%20(receive%20connector%20without%20%3CEM%3EExternalAuthoritative%3C%2FEM%3E)%3C%2FLI%3E%0A%3CLI%3ESubmitted%20by%20Pickup%20directory%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EWhy%20is%20this%20header%20so%20important%3F%20Because%20the%20value%20of%20this%20header%20is%20used%20in%20many%20important%20decisions%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EInternal%3CUL%3E%0A%3CLI%3EBypass%20spam%20filters%2C%20spoof%20verdict%2C%20phish%20controls%20and%20anti-impersonation%20controls%20for%20inbound%20email.%20%3CEM%3EInternal%3C%2FEM%3E%20email%20going%20outbound%20to%20On-Prem%20is%20still%20scanned%20by%20EOP.%3C%2FLI%3E%0A%3CLI%3EBypass%20ATP%20SafeLink%20Policy%20if%20%3CEM%3EEnableForInternalSenders%3C%2FEM%3E%20is%20set%20to%20%24False%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3EAllowed%20to%20send%20to%20distribution%20lists%20where%20%3CEM%3ERequireSenderAuthenticationEnabled%3C%2FEM%3E%20is%20set%20to%20%24True%20by%20default%3C%2FLI%3E%0A%3CLI%3EBy%20default%2C%20Internal%20messages%20are%20processed%20by%20resource%20mailboxes%20and%20the%20Resource%20Booking%20Attendant%3C%2FLI%3E%0A%3CLI%3EIn%20certain%20circumstances%2C%20may%20trigger%20transport%20rule%20condition%20%E2%80%9CIs%20received%20from%3A%20Inside%20the%20organization%E2%80%9D%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CLI%3EAnonymous%3CUL%3E%0A%3CLI%3EWill%20be%20rejected%20to%20distribution%20lists%20that%20require%20authentication%3C%2FLI%3E%0A%3CLI%3EWill%20not%20be%20processed%20by%20the%20Resource%20Booking%20Attendant%20(%3CEM%3EProcessExternalMeetingMessages%3C%2FEM%3E%20must%20be%20set%20to%20%24True)%3C%2FLI%3E%0A%3CLI%3EDisplay%20name%20of%20the%20sender%20doesn%E2%80%99t%20resolve%20to%20an%20object%20in%20the%20Global%20Address%20List%3C%2FLI%3E%0A%3CLI%3EImages%20won%E2%80%99t%20automatically%20downloaded%20in%20an%20email%3C%2FLI%3E%0A%3CLI%3EOffice%20documents%20open%20in%20%E2%80%9CProtected%20View%E2%80%9D%20mode%3C%2FLI%3E%0A%3CLI%3EScanned%20by%20spam%20filters%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3ENow%20that%20we%20understand%20the%20Incoming%20and%20Originating%20definition%20and%20the%20differences%20between%20AuthAs%3A%20Internal%20and%20AuthAs%3A%20Anonymous%2C%20the%20question%20that%20we%20hear%20often%20is%3A%20Is%20originating%20message%20always%20marked%20as%20Internal%20%3F%20%3CU%3ENot%20at%20all%3C%2FU%3E.%20Also%2C%20a%20non-authenticated%20message%20received%20from%20external%20sources%20%3CEM%3Emay%20be%3C%2FEM%3E%20marked%20as%20Internal.%20If%20you%20want%20to%20know%20why%2C%20let%E2%80%99s%20figure%20it%20out!%3C%2FP%3E%0A%3CP%3EThere%20are%20many%20layers%20involving%20the%20decision%20to%20mark%20the%20message%20as%20%3CEM%3EInternal%3C%2FEM%3E%20or%20%3CEM%3EAnonymous%3C%2FEM%3E%20and%20specially%20keep%20the%20precedent%20header%E2%80%99s%20value%20or%20not.%20Usually%20what%20happens%20behind%20the%20scenes%20is%3A%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3EFrom%20on-prem%20to%20EXO%3A%3C%2FFONT%3E%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EExchange%20on-prem%20user%20sends%20an%20authenticated%20message%20to%20an%20EXO%20recipient%3C%2FLI%3E%0A%3CLI%3E%5BIF%20EX2010%5D%20Exchange%20on-prem%20converts%20X-MS-Exchange-%3CSTRONG%3EOrganization%3C%2FSTRONG%3E-*%20headers%20to%20X-MS-Exchange-%3CSTRONG%3ECrossPremises%3C%2FSTRONG%3E-*%20if%20there%20is%20a%20Remote%20Domain%20for%20the%20recipient%20TargetAddress%20(mail.onmicrosoft.com)%20%3CSTRONG%3EAND%3C%2FSTRONG%3E%20if%20the%20%3CEM%3ETrustedMailOutboundEnabled%3C%2FEM%3E%20attribute%20is%20set%20to%20%24True%3C%2FLI%3E%0A%3CLI%3E%5BIF%20EX2013%2B%5D%20Exchange%20on-prem%20converts%20X-MS-Exchange-%3CSTRONG%3EOrganization%3C%2FSTRONG%3E-*%20headers%20to%20X-MS-Exchange-%3CSTRONG%3ECrossPremises%3C%2FSTRONG%3E-*%20if%20there%20is%20an%20Accepted%20Domain%20for%20the%20recipient%20TargetAddress%20(mail.onmicrosoft.com)%20%3CSTRONG%3EAND%3C%2FSTRONG%3E%20if%20the%20Send%20Connector%20attribute%20%3CEM%3ECloudServicesMailEnabled%20%3C%2FEM%3Eis%20%24True%3C%2FLI%3E%0A%3CLI%3EOn%20MAIL%20FROM%20command%2C%20Exchange%20Online%20Protection%20(EOP)%20will%20search%20for%20an%20OnPremises%20type%20inbound%20connector%20that%20matches%20the%20Exchange%20on-prem%20IP%20or%20TLS%20cert%20used%20to%20STARTTLS.%20If%20there%20is%20a%20match%2C%20message%20is%20classified%20as%20Originating%3C%2FLI%3E%0A%3CLI%3EOnEndOfHeader%2C%20the%20connector%20attribution%20process%20will%20be%20concluded%20and%20on%20BDAT%20(DATA)%20command%2C%20Exchange%20on-prem%20will%20send%20the%20X-MS-Exchange-%3CSTRONG%3ECrossPremises%3C%2FSTRONG%3E-*%20headers%3C%2FLI%3E%0A%3CLI%3EIf%20%3CEM%3ECloudServicesMailEnabled%3C%2FEM%3E%20on%20inbound%20connector%20is%20%24True%2C%20EXO%20converts%20the%20X-MS-Exchange-%3CSTRONG%3ECrossPremises%3C%2FSTRONG%3E-*%20headers%20to%20X-MS-Exchange-%3CSTRONG%3EOrganization%3C%2FSTRONG%3E-*%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3EFrom%20EXO%20to%20on-prem%3A%26nbsp%3B%3C%2FFONT%3E%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EEXO%20user%20sends%20an%20authenticated%20message%20to%20on-prem%20recipient%3C%2FLI%3E%0A%3CLI%3EEXO%20outbound%20connector%20converts%20X-MS-Exchange-%3CSTRONG%3EOrganization%3C%2FSTRONG%3E-*%20to%20X-MS-Exchange-%3CSTRONG%3ECrossPremises%3C%2FSTRONG%3E%3CSTRONG%3E-*%3C%2FSTRONG%3E%20if%20the%20%3CEM%3ECloudServicesMailEnabled%3C%2FEM%3E%20attribute%20is%20%24True%3C%2FLI%3E%0A%3CLI%3EExchange%20on-premises%20might%20have%20a%20receive%20connector%20with%20%3CEM%3ETlsDomainCapabilities%3C%2FEM%3E%20as%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CUL%3E%0A%3CLI%3EExchange%202010%3A%20%7Bmail.protection.outlook.com%3AAcceptOorgProtocol%7D%3C%2FLI%3E%0A%3CLI%3EExchange%202013%20or%20later%3A%20%7Bmail.protection.outlook.com%3AAcceptCloudServicesMail%7D%3C%2FLI%3E%0A%3CLI%3EIn%20any%20case%20MAIL%20FROM%20command%20should%20contains%20the%20XOORG%20value%20followed%20by%20the%20default%20AcceptedDomain%20or%20sender%E2%80%99s%20primary%20SMTP%20domain%20(%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fexchange-team-blog%2Fadvanced-office-365-routing-locking-down-exchange-on-premises%2Fba-p%2F609238%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3Efor%20more%20details%20see%20this%3C%2FA%3E%3C%2FSPAN%3E)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3COL%20start%3D%224%22%3E%0A%3CLI%3EOnEndOfHeaders%20event%2C%20EXO%20sends%20X-MS-Exchange-%3CSTRONG%3ECrossPremises%3C%2FSTRONG%3E-AuthAs%3A%20Internal%20and%20all%20others%20CrossPremises%20headers%3C%2FLI%3E%0A%3CLI%3E%5BIF%20EX2010%5D%20Receive%20connector%20checks%20if%20there%20is%20a%20remote%20domain%20that%20matches%20the%20XOORG%20value%20and%20checks%20if%20the%20parameter%20%3CEM%3ETrustedMailInboundEnabled%20%3C%2FEM%3Eis%20%24True.%3C%2FLI%3E%0A%3CLI%3EExchange%20on-prem%20converts%20the%20X-MS-Exchange-%3CSTRONG%3ECrossPremises%3C%2FSTRONG%3E-*%20headers%20to%20X-MS-Exchange-%3CSTRONG%3EOrganization%3C%2FSTRONG%3E-*.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3ELook%20easy%2C%20hmm%3F%20All%20those%20steps%20are%20expected%20in%20normal%20circumstances%2C%20in%20other%20words%2C%20if%20you%20did%20your%20homework%20and%20let%20HCW%20do%20its%20job%2C%20you%20should%20be%20fine.%3C%2FP%3E%0A%3CP%3EIf%20you%20see%20a%20different%20behavior%20such%20as%20non-authenticated%20message%20marked%20as%20%3CEM%3EInternal%3C%2FEM%3E%20or%20authenticated%20message%20marked%20as%20%3CEM%3EAnonymous%3C%2FEM%3E%2C%20you%20can%20start%20to%20troubleshoot%20using%20the%20following%20flowcharts%20(you%20can%20also%20download%20accessible%20version%20of%20those%20flowcharts%20as%20the%20attached%20ZIP%20file).%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3EFrom%20EXO%20to%20on-prem%3A%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22hybmailfl01.jpg%22%20style%3D%22width%3A%20967px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194764i149688E11DE01ECC%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22hybmailfl01.jpg%22%20alt%3D%22hybmailfl01.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3EFrom%20on-prem%20to%20EXO%3A%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22hybmailfl02.jpg%22%20style%3D%22width%3A%20972px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194765iDE077FF44A42E22C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22hybmailfl02.jpg%22%20alt%3D%22hybmailfl02.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1328723945%22%20id%3D%22toc-hId--1328723945%22%20id%3D%22toc-hId--1328723945%22%20id%3D%22toc-hId--1328723945%22%3ELogs%20that%20can%20help%20in%20troubleshooting%3C%2FH2%3E%0A%3COL%3E%0A%3CLI%3E%5BOn-prem%5D%20%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fexchange%2Fmail-flow%2Ftransport-logs%2Fmessage-tracking%3Fview%3Dexchserver-2019%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EMessage%20tracking%3C%2FA%3E%3C%2FSPAN%3E%3A%20the%20first%20step%20to%20figure%20out%20all%20servers%20and%20connectors%20that%20the%20message%20passed%20through.%3C%2FLI%3E%0A%3CLI%3E%5BEXO%5D%20%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmicrosoft-365%2Fsecurity%2Foffice-365-security%2Fmessage-trace-scc%3Fview%3Do365-worldwide%23choose-report-type%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EMessage%20Trace%20Extended%20Report%3C%2FA%3E%3C%2FSPAN%3E%3A%20provides%20useful%20information%2C%20such%20as%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CUL%3E%0A%3CLI%3EDirectionality%3A%20Originating%20or%20Incoming%3C%2FLI%3E%0A%3CLI%3EInboundConnectorData%3DName%3A%20Inbound%20connector%20name%20which%20message%20was%20attributed%3C%2FLI%3E%0A%3CLI%3EConnectorType%3A%20OnPremises%20or%20Partner%3C%2FLI%3E%0A%3CLI%3ERemember%3A%20A%20successful%20connector%20attribution%20(type%20OnPrem)%20is%20required%20to%20promote%20AuthAs%3A%20Internal.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3COL%20start%3D%223%22%3E%0A%3CLI%3E%5BOn-prem%5D%20%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fexchange%2Fconfigure-pipeline-tracing-exchange-2013-help%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EPipeline%20Tracing%3C%2FA%3E%3C%2FSPAN%3E%3A%20the%20best%20way%20to%20see%20all%20header%20modifications%20performed%20by%20transport%20agents%20across%20the%20%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fexchange%2Fmail-flow%2Fmail-flow%3Fview%3Dexchserver-2019%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Etransport%20pipeline%3C%2FA%3E%3C%2FSPAN%3E.%20The%20decision%20to%20convert%20X-MS-Exchange-%3CSTRONG%3ECrossPremises%3C%2FSTRONG%3E-*%20to%20X-MS-Exchange-%3CSTRONG%3EOrganization%3C%2FSTRONG%3E-*%20and%20vice%20versa%20is%20performed%20OnEndOfHeaders%20(Inbound%20Trust%20Agent)%20for%20Inbound%20messages%20or%20OnCategorizedMessage%20(Outbound%20Trust%20Agent)%20for%20outbound%20messages%3C%2FLI%3E%0A%3CLI%3E%5BOn-prem%5D%20%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fexchange%2Fmail-flow%2Fconnectors%2Fconfigure-protocol-logging%3Fview%3Dexchserver-2019%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EEnable%20Connectors%20Verbose%20Protocol%20Logs%3C%2FA%3E%3C%2FSPAN%3E%3A%20very%20useful%20to%20see%20the%20envelope%20commands%2C%20specially%20to%20be%20sure%20that%20Exchange%20Online%20performed%20the%20XOORG.%20By%20default%2C%20XOORG%20is%20advertised%20only%20after%20STARTTLS.%20Make%20sure%20you%20have%20your%20certificate%20assigned%20to%20SMTP%20service%20and%20if%20you%20perform%20a%20telnet%20and%20send%20EHLO%20you%20can%20see%20STARTTLS%20available%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH2%20id%3D%22toc-hId-1158788888%22%20id%3D%22toc-hId-1158788888%22%20id%3D%22toc-hId-1158788888%22%20id%3D%22toc-hId-1158788888%22%3E%3CFONT%20size%3D%226%22%3ECommonly%20mis-configured%20scenarios%3C%2FFONT%3E%3C%2FH2%3E%0A%3CP%3E%3CEM%3E%3CSTRONG%3EMX%20record%20pointing%20to%20on-prem%20%E2%80%93%20or%20even%20to%20EXO%20but%20Centralized%20Mail%20Transport%20is%20enabled%3B%20all%20messages%20to%20EXO%20recipients%20are%20being%20marked%20as%20Internal%20and%20are%20bypassing%20EOP%20spam%20filters%2C%20spoof%20verdict%2C%20phish%20controls%20and%20anti-impersonation%20controls.%3C%2FSTRONG%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3EThis%20usually%20happens%20when%20there%20is%20an%20on-prem%20receive%20connector%20with%20Externally%20Secured%20option%20enabled.%20An%20evidence%20that%20you%20probably%20hit%20this%20scenario%20is%20when%20you%20find%20the%20header%E2%80%99s%20value%20X-MS-Exchange-Organization-AuthMechanism%3A%2010.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CEM%3E%3CSTRONG%3EInternal%20message%20sent%20from%20on-prem%20mailbox%20to%20EXO%20mailbox%20is%20being%20marked%20as%20Anonymous%20and%20I%E2%80%99m%20sure%20that%20it%20meets%20all%20requirements%20described%20in%20the%20flowchart.%20Besides%2C%20I%20can%E2%80%99t%20find%20the%20message%20using%20EXO%20message%20trace.%3C%2FSTRONG%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3EProbably%20you%20hit%20what%20we%20call%20%E2%80%98attribution%20to%20the%20wrong%20tenant%E2%80%99.%20If%20another%20tenant%20has%20Inbound%20Connector%20with%20same%20value%20of%20%3CEM%3ETlsSenderCertificateName%20%3C%2FEM%3Eor%20%3CEM%3ESenderIPAddresses%20%3C%2FEM%3Eas%20yours%2C%20the%20email%20could%20attribute%20to%20the%20other%20tenant%20instead%20of%20yours%3CEM%3E.%20%3C%2FEM%3EAn%20evidence%20that%20you%20hit%20this%20scenario%20can%20be%20found%20on%20the%20X-MS-Exchange-CrossTenant-id%20header.%20The%20value%20of%20this%20header%20is%20the%20%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fonedrive%2Ffind-your-office-365-tenant-id%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Etenant%20id%3C%2FA%3E%3C%2FSPAN%3E%20where%20the%20message%20has%20been%20attributed.%20%26nbsp%3BIf%20the%20tenants%20are%20owned%20by%20you%2C%20be%20sure%20that%20both%20tenants%20have%20different%20%3CEM%3ETlsSenderCertificateName%20%3C%2FEM%3Eor%20%3CEM%3ESenderIPAddresses%20%3C%2FEM%3Evalues.%20Otherwise%2C%20you%20should%20open%20a%20case%20with%20us.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CEM%3E%3CSTRONG%3ELegitimate%20internal%20messages%20originating%20to%20EXO%20are%20being%20marked%20as%20Anonymous%20and%20you%20can%20find%20the%20header%3A%20%3C%2FSTRONG%3E%3CSTRONG%3EX-CrossPremisesHeadersFilteredBySendConnector%3C%2FSTRONG%3E%3CSTRONG%3E.%3C%2FSTRONG%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3EUsually%20this%20scenario%20involves%20Exchange%202010%20as%20Hub%20Transport%20and%20Exchange%202013%20as%20Edge%20Transport.%20Refer%20to%20%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fsupport.microsoft.com%2Fen-us%2Fhelp%2F3212872%2Femail-sent-from-an-on-premises-exchange-2013-edge-transport-server-to%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EKB3212872%3C%2FA%3E%3C%2FSPAN%3E%20in%20order%20to%20fix%20this%20issue.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CEM%3E%3CSTRONG%3EWhen%20Edge%20Transport%20Server%20is%20deployed%2C%20you%20should%20keep%20the%20%E2%80%9CInbound%20to%20Site%E2%80%9D%20Send%20Connectors%20settings%20as%20default.%3C%2FSTRONG%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3EChanging%20the%20default%20Address%20Space%20from%20%E2%80%9C--%22%20to%20any%20other%20value%20may%20result%20in%20authentication%20issue%20for%20email%20coming%20from%20Office%20365.%20In%20fact%2C%20our%20recommendation%20is%20to%20keep%20all%20connectors%20settings%20as%20default.%3CSTRONG%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--648665575%22%20id%3D%22toc-hId--648665575%22%20id%3D%22toc-hId--648665575%22%20id%3D%22toc-hId--648665575%22%3E%3CFONT%20size%3D%226%22%3EHybrid%20mail%20flow%20FAQ%3C%2FFONT%3E%3C%2FH2%3E%0A%3CP%3E%3CEM%3E%3CSTRONG%3EWhy%20do%20we%20not%20recommend%20putting%20firewalls%2Fhosts%20between%20EXO%20%26amp%3B%20Exchange%20on-prem%3F%3C%2FSTRONG%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3EAn%20appliance%20or%20application%20between%20EXO%20and%20on-premises%20which%20modify%20or%20perform%20content%20inspection%20can%20break%20the%20cross-premises%20message%20authentication.%20As%20previous%20explained%2C%20EXO%20and%20on-prem%20rely%20on%20a%20set%20of%20headers%20to%20%E2%80%9Ctrust%E2%80%9D%20that%20the%20message%20is%20%3CEM%3EInternal%3C%2FEM%3E.%3C%2FP%3E%0A%3CP%3EIn%20addition%20to%20headers%2C%20default%20hybrid%20configuration%20also%20grants%20your%20Exchange%20Online%20tenant%20the%20ability%20to%20relay%20from%20the%20cloud%20via%20your%20on-premises%20Exchange%20server.%20This%20can%20only%20be%20accomplished%20via%20an%20ESMTP%20protocol%20communication%20that%20happens%20at%20the%20application%20layer.%20Introducing%20filtering%20here%20can%20interfere.%20That%20said%2C%20if%20you%20do%20not%20wish%20to%20grant%20the%20ability%20to%20relay%20(e.g.%20outbound%20mail%20path%20is%20via%20Office%20365)%2C%20then%20this%20is%20not%20a%20big%20deal.%20However%2C%20if%20your%20outbound%20SMTP%20traffic%20needs%20to%20go%20via%20on-premises%2C%20then%20there%20is%20not%20a%20better%20way%20to%20grant%20relay%20to%20your%20tenant%20%E2%80%93%20%3CEM%3E%3CU%3Eand%20your%20tenant%20only%3C%2FU%3E%3C%2FEM%3E.%20You%20may%20use%20the%20Edge%20Transport%20role%20to%20accomplish%20this%20determination.%20Refer%20to%20this%20%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fexchange%2Ftransport-routing%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Earticle%3C%2FA%3E%3C%2FSPAN%3E%20to%20find%20all%20supported%20hybrid%20scenarios.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CEM%3E%3CSTRONG%3EWhat%20is%20required%20to%20preserve%20the%20headers%20if%20I%20don%E2%80%99t%20have%20Exchange%20and%20what%20are%20the%20risks%20of%20doing%20so%3F%3C%2FSTRONG%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EFrom%20on-prem%20to%20EXO%3C%2FSTRONG%3E%3A%20If%20you%20use%20an%20inbound%20connector%20in%20Office%20365%20with%20%3CEM%3ECloudServicesMailEnabled%3C%2FEM%3E%2C%20Office%20365%20will%20look%20for%20CrossPremises%20mail%20flow%20headers%20and%20will%20promote%20them%20to%20Intra-organizational%20headers%20upon%20entry%20into%20Office%20365.%20In%20this%20way%2C%20you%20can%20preserve%20most%20intra-organizational%20headers.%20%3CSTRONG%3E%3CU%3EAlternative%3C%2FU%3E%3C%2FSTRONG%3E%3A%20Setting%20%3CEM%3ETreatMessagesAsInternal%3C%2FEM%3E%20as%20%24True%20forces%20EOP%20to%20accept%20messages%20from%20your%203%3CSUP%3Erd%3C%2FSUP%3E%20party%20solution%20as%20%3CEM%3EInternal%3C%2FEM%3E%20%3CU%3Eonly%3C%2FU%3E%20if%20the%20sender%20matches%20an%20accepted%20domain%20on%20EXO.%20The%20risk%20is%20that%20EOP%20can%E2%80%99t%20really%20validate%20if%20the%20message%20is%20indeed%20internal%20or%20spoofed%20by%20someone%20through%20your%203%3CSUP%3Erd%3C%2FSUP%3E%20party%20solution.%26nbsp%3B%20Use%20with%20extreme%20caution!%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EFrom%20EXO%20to%20on-prem%3C%2FSTRONG%3E%3A%20With%20%3CEM%3ECloudServicesMailEnabled%3C%2FEM%3E%20Office%20365%20will%20convert%20Intra-organizational%20headers%20to%20CrossPremises%20headers.%20The%20problem%20is%20that%20since%20other%20Office%20365%20customers%20could%20do%20the%20same%2C%20so%20you%20would%20need%20to%20harden%20the%203%3CSUP%3Erd%3C%2FSUP%3E%20party%20solution%20to%20accept%20only%20Office%20365%20%3CSTRONG%3EAND%3C%2FSTRONG%3E%20validate%20the%20tenant%20used%20to%20send%20the%20mail%20against%20a%20unique%20header%20that%20can%E2%80%99t%20be%20spoofed%20by%20no%20other%20tenant%20such%20as%20X-OriginatorOrg%3A%20contoso.com%20where%20contoso.com%20is%20an%20Accepted%20Domain.%20For%20this%20reason%2C%20we%20only%20support%20using%20Exchange%20or%20a%20trusted%203%3CSUP%3Erd%3C%2FSUP%3E%20party%20service%20that%20can%20distinguish%20between%20Office%20365%20tenants.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3ENote%20that%20only%20connector%20type%20of%20on-premises%20supports%20%3CEM%3ECloudServicesMailEnabled%3C%2FEM%3E.%20For%20considerations%20on%20how%20to%20setup%20on-premises%20mail%20flow%20with%20a%203%3CSUP%3Erd%3C%2FSUP%3E%20party%20service%2C%20see%20%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fexchange%2Fmail-flow-best-practices%2Fuse-connectors-to-configure-mail-flow%2Fintegrate-office-365-with-an-email-add-on-service%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EIntegrate%20Office%20365%20mail%20flow%20with%20an%20email%20add-on%20service%3C%2FA%3E%3C%2FSPAN%3E.%20If%20the%203%3CSUP%3Erd%3C%2FSUP%3E%20party%20service%20cannot%20meet%20the%20requirements%20set%20in%20this%20guidance%2C%20you%20will%20be%20unable%20to%20use%20on-premises%20connectors.%20If%20you%20cannot%20use%20on-premises%20connectors%20with%20%3CEM%3ECloudServicesMailEnabled%3C%2FEM%3E%2C%20then%20the%20mail%20flow%20path%20will%20not%20be%20trusted.%20This%20means%20that%20all%20mail%20will%20be%20treated%20as%20%3CEM%3EAnonymous%3C%2FEM%3E%20and%20will%20be%20re-scanned.%3C%2FP%3E%0A%3CP%3ETypically%20we%20see%20this%20when%20someone%20wants%20to%20add%20a%203%3CSUP%3Erd%3C%2FSUP%3E%20party%20service%20into%20their%20organization%E2%80%99s%20inbound%20or%20outbound%20traffic.%20For%20outbound%2C%20the%20on-premises%20connector%20ensures%20the%20ability%20to%20relay.%20For%20inbound%2C%20preservation%20of%20the%20spam%20verdicts%20is%20critical.%20If%20your%20put%20a%203%3CSUP%3Erd%3C%2FSUP%3E%20party%20solution%20in%20front%20of%20Office%20365%2C%20pay%20close%20attention%20to%20the%20next%20question%20below.%3C%2FP%3E%0A%3CP%3EAdding%20an%20on-premises%20or%20customer-managed%20SMTP%20host%20into%20a%20mail%20routing%20path%20is%20a%20little%20less%20strict%20assuming%20you%20can%20use%20a%20specific%20IPv4%20address%20that%20you%20own.%20However%2C%20certificates%20and%20tenant%20checks%20are%20still%20required%20to%20make%20certain%20that%20someone%20does%20not%20introduce%20untrusted%20mail%20into%20your%20path%20and%20compromise%20your%20security.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3EMy%20MX%20record%20points%20to%20a%203%3CSUP%3Erd%3C%2FSUP%3E%20party%20solution%2C%20but%20I%20want%20to%20take%20advantage%20of%20EOP%20and%20Office%20365%20ATP.%3C%2FEM%3E%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EThere%20was%20a%20time%20where%20we%20used%20to%20recommend%20bypassing%20EOP%20checks%20for%203%3CSUP%3Erd%3C%2FSUP%3E%20party%20solution%20and%2For%20hybrid%20Exchange%20on-prem%20via%20transport%20rule%20(SCL%20-1)%20for%20customers%20who%20have%20the%20MX%20record%20pointing%20to%20something%20other%20than%20Office%20365.%20The%20reason%3F%20To%20avoid%20false%20positives%20due%20to%20failed%20SPF%20checks%20and%20so%20on.%20Please%2C%20don%E2%80%99t%20do%20that%20anymore.%20It%E2%80%99s%20OK%20if%20you%20did%20in%20the%20past%20but%20we%20built%20a%20better%20solution%20for%20you%2C%20called%20%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fexchange%2Fmail-flow-best-practices%2Fuse-connectors-to-configure-mail-flow%2Fenhanced-filtering-for-connectors%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EEnhanced%20Filtering%20for%20Connectors%3C%2FA%3E%3C%2FSPAN%3E.%20We%20still%20encourage%20you%20to%20switch%20your%20MX%20record%20to%20Office%20365%2C%20but%20if%20you%20are%20not%20prepared%20to%20do%20so%20yet%2C%20Enhanced%20Filtering%20can%20help.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CEM%3E%3CSTRONG%3EDo%20I%20need%20to%20add%20on-premises%20public%20IP%20on%20SPF%20for%20hybrid%20mail%20flow%20from%20on-premises%20to%20EXO%3F%3C%2FSTRONG%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3EYes.%20Even%20if%20%3CEM%3EInternal%3C%2FEM%3E%20email%20bypasses%20spoof%20verdict%20for%20hybrid%20mail%20flow%2C%20we%20encourage%20you%20to%20add%20your%20on-premises%20public%20IP%20on%20SPF.%20The%20reason%20is%20you%20might%20have%20some%20application%20which%20rely%20on%20your%20Exchange%20anonymously%20to%20send%20to%20EXO%20or%20even%20sending%20directly%20to%20the%20Internet.%20Without%20on-prem%20public%20IP%20on%20SPF%2C%20those%20kinds%20of%20messages%20should%20land%20in%20junk%20folder%20%E2%80%93%20or%20follow%20the%20anti-spoof%20action.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CEM%3E%3CSTRONG%3EDo%20I%20need%20to%20include%20EOP%20on%20my%20SPF%20if%20I%E2%80%99m%20sending%20email%20to%20internet%20from%20my%20on-premises%20server%3F%3C%2FSTRONG%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3EYou%20should.%20The%20connector%20attribution%20process%20looks%20at%20the%20TLS%20certificate%20sent%20by%20your%20on-premises.%20If%20the%20recipient%E2%80%99s%20tenant%20is%20in%20the%20same%20forest%20as%20yours%2C%20the%20message%20will%20be%20attributed%20to%20your%20tenant%20before%20sending%20to%20the%20recipient%E2%80%99s%20tenant.%20The%20SPF%20check%20in%20the%20recipient%E2%80%99s%20tenant%20will%20be%20against%20an%20EOP%20IP%20address.%20That%20is%20why%20you%20should%20include%20EOP%20SPF%20in%20your%20SPF%20Record.%20%26nbsp%3BIf%20you%E2%80%99re%20seeing%20outbound%20traffic%20from%20on-premises%20being%20routed%20via%20your%20Office%20365%20tenant%2C%20or%20is%20causing%20mail%20loops%2C%20please%20review%20%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fexchange-team-blog%2Foffice-365-message-attribution%2Fba-p%2F749143%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EFAQ%206-b%20from%20this%20earlier%20post%3C%2FA%3E%3C%2FSPAN%3E.%3C%2FP%3E%0A%3CP%3EThere%20are%20two%20possible%20exceptions%20for%20this%20scenario%3A%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EThe%20last%20on-prem%20hop%20is%20a%203%3CSUP%3Erd%3C%2FSUP%3E%20party%20gateway%20using%20a%20different%20TLS%20cert%20CN%20or%20SAN%20which%20doesn%E2%80%99t%20match%20at%20all%20the%20Inbound%20Connector%20%3CEM%3ETlsSenderCertificateName%3C%2FEM%3E.%20If%20your%20Inbound%20Connector%20uses%20IP%20instead%20of%20TLS%2C%20the%20message%20won%E2%80%99t%20be%20attributed%20to%20your%20tenant%20only%20if%20the%203%3CSUP%3Erd%3C%2FSUP%3E%20party%20public%20IP%20doesn%E2%80%99t%20match%20the%20Inbound%20Connector%20%3CEM%3ESenderIPAddresses%3C%2FEM%3E.%3C%2FLI%3E%0A%3CLI%3EExchange%202013%20or%20later%20using%20two%20Send%20Connectors%2C%20one%20just%20for%20Office%20365%20(aka%20Outbound%20to%20Office%20365)%20and%20the%20other%20to%20send%20to%20internet%20%3CSTRONG%3EAND%3C%2FSTRONG%3E%20they%20have%20different%20%3CEM%3ETlsCertificateName%3C%2FEM%3E%20assigned%20to%20them.%20%E2%80%9COutbound%20to%20Office%20365%E2%80%9D%20Send%20Connector%20will%20have%20the%20certificate%20which%20matches%20%3CEM%3ETlsSenderCertificateName%20%3C%2FEM%3EInbound%20Connector%20and%20%E2%80%9COutbound%20to%20Internet%E2%80%9D%20Send%20Connector%20will%20have%20a%20different%20TLS%20cert%20CN%20or%20SAN%20which%20doesn%E2%80%99t%20match%20at%20all%20the%20Inbound%20Connector%20%3CEM%3ETlsSenderCertificateName.%3C%2FEM%3E%20Example%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22hybmailfl03.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F194766i27AA71E4206266A9%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22hybmailfl03.jpg%22%20alt%3D%22hybmailfl03.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CEM%3E%3CSTRONG%3EHow%20can%20I%20force%20%3C%2FSTRONG%3E%3CSTRONG%3EX-MS-Exchange-Organization-AuthAs%3A%20Internal%3C%2FSTRONG%3E%20%3CSTRONG%3Efor%20non-authenticated%20messages%3F%3C%2FSTRONG%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3EFor%20Exchange%20on-premises%2C%20the%20only%20supported%20scenario%20for%20this%20would%20be%20using%20a%20receive%20connector%20assigned%20as%20Externally%20Secured%20permission%20(which%20grants%20other%20permissions).%20For%20Exchange%20Online%2C%20you%20can%20use%20an%20inbound%20connector%20with%20%3CEM%3ETreatMessagesAsInternal%3C%2FEM%3E.%20Any%20other%20method%20such%20as%20Transport%20Rule%20is%20not%20supported.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CEM%3E%3CSTRONG%3EI%20have%20a%20lot%20of%20custom%20settings%20on%20connectors%2C%20my%20concern%20is%20if%20I%20run%20HCW%20and%20break%20mail%20flow%2C%20what%20should%20I%20do%3F%3C%2FSTRONG%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3EIf%20you%20don%E2%80%99t%20have%20Centralized%20Mail%20Transport%20enabled%2C%20technically%20you%20have%20no%20reason%20to%20be%20afraid.%20If%20you%20have%20Centralized%20Mail%20Transport%20enabled%20and%20use%20many%20other%20custom%20settings%2C%20we%20encourage%20you%20to%20assess%20the%20environment%20before%20running%20HCW.%20Avoiding%20HCW%20is%20not%20really%20a%20solution%3B%20sooner%20or%20later%20you%20should%20run%20it%20to%20change%20a%20certificate%20that%20will%20expire%2C%20right%3F%3C%2FP%3E%0A%3CP%3EYou%20can%20get%20and%20save%20all%20attribute%20values%20of%20Receive%20Connectors%2C%20Send%20Connectors%2C%20Inbound%20Connectors%2C%20Outbound%20Connectors%2C%20accepted%20domains%2C%20and%20remote%20domains.%20Once%20you%20assess%20all%20this%20information%2C%20even%20if%20HCW%20changes%20some%20parameter%20that%20breaks%20the%20mail%20flow%2C%20you%20will%20be%20able%20to%20compare%20before%20and%20after%20state%20and%20fix%20it.%3C%2FP%3E%0A%3CP%3ELet%20me%20give%20you%20a%20common%20example%3A%20for%20Exchange%202010%2C%20HCW%20creates%20an%20ad%20hoc%20receive%20connector%20to%20receive%20emails%20from%20EXO%2C%20called%20%E2%80%9CInbound%20From%20Office%20365%E2%80%9D%20containing%20the%20whole%20EOP%20IP%20range%20on%20%3CEM%3ERemoteIPRange%3C%2FEM%3E%20attribute.%20If%20you%20have%20a%20NAT%20which%20translates%20the%20public%20IP%20to%20an%20internal%20IP%2C%20you%20must%20add%20only%20this%20internal%20NAT%20IP%20to%20%3CEM%3ERemoteIPRange%3C%2FEM%3E%2C%20otherwise%20Exchange%202010%20will%20refuse%20EXO%20messages.%20When%20you%20run%20HCW%2C%20it%20will%20overwrite%20your%20NAT%20IP%20and%20add%20the%20whole%20EOP%20IP%20range%20again.%20So%2C%20you%20need%20to%20know%20the%20NAT%20IP%20before%20running%20HCW%20to%20re-add%20as%20soon%20as%20HCW%20finishes.%3C%2FP%3E%0A%3CP%3EWell%2C%20that%20was%20a%20lot!%20Hope%20you%20could%20find%20relevant%20information%20to%20perform%20your%20next%20SMTP%20troubleshooting%20and%20please%20feel%20free%20to%20leave%20comments%20and%20feedback%20below!%3C%2FP%3E%0A%3CP%3EThanks%20to%20Arindam%20Thokder%2C%20Nino%20Bilic%20and%20Scott%20Landry%20for%20their%20review%20and%20contribution%20of%20this%20post.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22author%22%3EDenis%20Vila%C3%A7a%20Signorelli%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1420838%22%20slang%3D%22en-US%22%3E%3CP%3EIf%20you%20wanted%20to%20pull%20back%20the%20curtain%20on%20hybrid%20mail%20flow%2C%20connector%20settings%20and%20troubleshooting%2C%20this%20post%20is%20for%20you!%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1420838%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExchange%20Online%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EHybrid%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ETips%20'n%20Tricks%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Etransport%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ETroubleshooting%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1430184%22%20slang%3D%22en-US%22%3ERe%3A%20Demystifying%20and%20troubleshooting%20hybrid%20mail%20flow%3A%20when%20is%20a%20message%20internal%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1430184%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%20we%20have%20to%20use%20Centralized%20Mail%20Transport%20for%20Agency%20to%20Agency%20SEEMail%20encryption.%20We%20have%20a%20partner%20connector%20created%20in%20EXO%20for%20Journal%20messages.%20This%20connector%20validates%20successfully%20and%20I%20can%20see%20that%20connector%20was%20used%20in%20Message%20Trace%2C%20however%20the%20journaled%20message%20for%20the%20same%20goes%20out%20through%20our%20Hybrid%20connector.%20I%20understand%20the%20more%20specific%20connector%20should%20be%20used.%20Or%20is%20that%20not%20the%20case%20when%20Centralized%20Mail%20Transport%20is%20used%3F%3C%2FP%3E%3CP%3EHow%20can%20I%20resolve%2Ftroubleshoot%20this%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1430961%22%20slang%3D%22en-US%22%3ERe%3A%20Demystifying%20and%20troubleshooting%20hybrid%20mail%20flow%3A%20when%20is%20a%20message%20internal%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1430961%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F386884%22%20target%3D%22_blank%22%3E%40PhilR2020%3C%2FA%3E%26nbsp%3BCMT%20forces%20all%20messages%20(except%20%3CEM%3EOriginating%3C%2FEM%3E%20or%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fexchange%2Fmail-flow-best-practices%2Fuse-connectors-to-configure-mail-flow%2Fconditional-mail-routing%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3ECBR%3C%2FA%3E)%20to%20land%20through%20the%20Outbound%20Connector%20which%20%3CEM%3ERouteAllMessagesViaOnPremises%3C%2FEM%3E%20is%20enabled.%20You%20can%20evidence%20that%20using%20Message%20Trace%20Extended%20Report%20or%20Message%20Trace%20Detail.%20CBR%20doesn%E2%80%99t%20help%20in%20this%20case%20because%20it%20runs%20as%20transport%20rule%2C%20and%20Journal%20reports%20don%E2%80%99t%20trigger%20transport%20rules.%3C%2FP%3E%0A%3CP%3EThat%20said%2C%20your%20best%20chance%20to%20manage%20this%20situation%20would%20be%20through%20your%20on-prem%20solution%20and%20forget%20about%20EXO%20partner%20connector%2C%20or%20disabling%20CMT%20and%20enabling%20CBR%20to%20route%20just%20those%20%E2%80%9Cmust%20encrypt%E2%80%9D%20messages%20through%20on-prem%2C%20but%20pay%20super%20close%20attention%20to%20create%20a%20transport%20rule%20which%20won't%20result%20in%20mail%20looping.%3C%2FP%3E%3C%2FLINGO-BODY%3E

When we need to deploy a hybrid scenario, the first thing that comes to mind is running the Hybrid Configuration Wizard. Indeed, HCW is enough to make the magic happen between Exchange Online (EXO) and Exchange on-premises. But, if you want to pull back the curtain on the mail flow and connectors, this post is for you! It is not unusual to see connector settings be changed manually, which might result in unexpected behavior. Additionally, some customers want to push the limits of their configuration by introducing additional hops into the mail flow path. This post attempts to provide technical details helpful for troubleshooting and deploying hybrid mail flow securely.

Before starting with deep dive stuff, we must be familiar with some definitions related to Tenant Attribution:

  • Originating: A message that originates from a tenant’s on-premises server (it will match the tenant’s inbound connector that is of type OnPremises), or from an Exchange Online mailbox. If Office 365 is unable to identify the message as originating and the recipient domain is an accepted domain in an Office 365 organization, the service will identify the message as incoming to the recipient organization.
  • Incoming: Messages sent to accepted domains that are in Office 365 that do not match a tenant connector that is of type OnPremises.

You can check the X-MS-Exchange-Organization-MessageDirectionality header, which tells if the decision is Originating or Incoming.

From a hybrid mail flow perspective, there is an important header which we often check in security assessment situation or any spam, spoof, or phish analysis called: X-MS-Exchange-Organization-AuthAs.  We should focus on two possible values of that header: Internal or Anonymous.

Messages are considered Internal if they authenticated in some manner:

  • Authenticated mailbox on-prem or Exchange Online (StoreDriver)
  • Authenticated mailbox using SMTP client submission (SMTP AUTH)
  • Received through an on-prem receive connector with ExternalAuthoritative (Externally Secured) permission enabled
  • Came into Exchange Online via an inbound connector with TreatMessagesAsInternal

Messages are considered External if they are received through an Anonymous source:

  • Internet
  • SMTP relay (receive connector without ExternalAuthoritative)
  • Submitted by Pickup directory

Why is this header so important? Because the value of this header is used in many important decisions:

  • Internal
    • Bypass spam filters, spoof verdict, phish controls and anti-impersonation controls for inbound email. Internal email going outbound to On-Prem is still scanned by EOP.
    • Bypass ATP SafeLink Policy if EnableForInternalSenders is set to $False 
    • Allowed to send to distribution lists where RequireSenderAuthenticationEnabled is set to $True by default
    • By default, Internal messages are processed by resource mailboxes and the Resource Booking Attendant
    • In certain circumstances, may trigger transport rule condition “Is received from: Inside the organization”
  • Anonymous
    • Will be rejected to distribution lists that require authentication
    • Will not be processed by the Resource Booking Attendant (ProcessExternalMeetingMessages must be set to $True)
    • Display name of the sender doesn’t resolve to an object in the Global Address List
    • Images won’t automatically downloaded in an email
    • Office documents open in “Protected View” mode
    • Scanned by spam filters

Now that we understand the Incoming and Originating definition and the differences between AuthAs: Internal and AuthAs: Anonymous, the question that we hear often is: Is originating message always marked as Internal ? Not at all. Also, a non-authenticated message received from external sources may be marked as Internal. If you want to know why, let’s figure it out!

There are many layers involving the decision to mark the message as Internal or Anonymous and specially keep the precedent header’s value or not. Usually what happens behind the scenes is:

From on-prem to EXO:

  1. Exchange on-prem user sends an authenticated message to an EXO recipient
  2. [IF EX2010] Exchange on-prem converts X-MS-Exchange-Organization-* headers to X-MS-Exchange-CrossPremises-* if there is a Remote Domain for the recipient TargetAddress (mail.onmicrosoft.com) AND if the TrustedMailOutboundEnabled attribute is set to $True
  3. [IF EX2013+] Exchange on-prem converts X-MS-Exchange-Organization-* headers to X-MS-Exchange-CrossPremises-* if there is an Accepted Domain for the recipient TargetAddress (mail.onmicrosoft.com) AND if the Send Connector attribute CloudServicesMailEnabled is $True
  4. On MAIL FROM command, Exchange Online Protection (EOP) will search for an OnPremises type inbound connector that matches the Exchange on-prem IP or TLS cert used to STARTTLS. If there is a match, message is classified as Originating
  5. OnEndOfHeader, the connector attribution process will be concluded and on BDAT (DATA) command, Exchange on-prem will send the X-MS-Exchange-CrossPremises-* headers
  6. If CloudServicesMailEnabled on inbound connector is $True, EXO converts the X-MS-Exchange-CrossPremises-* headers to X-MS-Exchange-Organization-*

From EXO to on-prem: 

  1. EXO user sends an authenticated message to on-prem recipient
  2. EXO outbound connector converts X-MS-Exchange-Organization-* to X-MS-Exchange-CrossPremises-* if the CloudServicesMailEnabled attribute is $True
  3. Exchange on-premises might have a receive connector with TlsDomainCapabilities as:
  • Exchange 2010: {mail.protection.outlook.com:AcceptOorgProtocol}
  • Exchange 2013 or later: {mail.protection.outlook.com:AcceptCloudServicesMail}
  • In any case MAIL FROM command should contains the XOORG value followed by the default AcceptedDomain or sender’s primary SMTP domain (for more details see this)
  1. OnEndOfHeaders event, EXO sends X-MS-Exchange-CrossPremises-AuthAs: Internal and all others CrossPremises headers
  2. [IF EX2010] Receive connector checks if there is a remote domain that matches the XOORG value and checks if the parameter TrustedMailInboundEnabled is $True.
  3. Exchange on-prem converts the X-MS-Exchange-CrossPremises-* headers to X-MS-Exchange-Organization-*.

Look easy, hmm? All those steps are expected in normal circumstances, in other words, if you did your homework and let HCW do its job, you should be fine.

If you see a different behavior such as non-authenticated message marked as Internal or authenticated message marked as Anonymous, you can start to troubleshoot using the following flowcharts (you can also download accessible version of those flowcharts as the attached ZIP file).

From EXO to on-prem:

hybmailfl01.jpg

From on-prem to EXO:

hybmailfl02.jpg

Logs that can help in troubleshooting

  1. [On-prem] Message tracking: the first step to figure out all servers and connectors that the message passed through.
  2. [EXO] Message Trace Extended Report: provides useful information, such as:
  • Directionality: Originating or Incoming
  • InboundConnectorData=Name: Inbound connector name which message was attributed
  • ConnectorType: OnPremises or Partner
  • Remember: A successful connector attribution (type OnPrem) is required to promote AuthAs: Internal.
  1. [On-prem] Pipeline Tracing: the best way to see all header modifications performed by transport agents across the transport pipeline. The decision to convert X-MS-Exchange-CrossPremises-* to X-MS-Exchange-Organization-* and vice versa is performed OnEndOfHeaders (Inbound Trust Agent) for Inbound messages or OnCategorizedMessage (Outbound Trust Agent) for outbound messages
  2. [On-prem] Enable Connectors Verbose Protocol Logs: very useful to see the envelope commands, specially to be sure that Exchange Online performed the XOORG. By default, XOORG is advertised only after STARTTLS. Make sure you have your certificate assigned to SMTP service and if you perform a telnet and send EHLO you can see STARTTLS available

Commonly mis-configured scenarios

MX record pointing to on-prem – or even to EXO but Centralized Mail Transport is enabled; all messages to EXO recipients are being marked as Internal and are bypassing EOP spam filters, spoof verdict, phish controls and anti-impersonation controls.

This usually happens when there is an on-prem receive connector with Externally Secured option enabled. An evidence that you probably hit this scenario is when you find the header’s value X-MS-Exchange-Organization-AuthMechanism: 10.

 

Internal message sent from on-prem mailbox to EXO mailbox is being marked as Anonymous and I’m sure that it meets all requirements described in the flowchart. Besides, I can’t find the message using EXO message trace.

Probably you hit what we call ‘attribution to the wrong tenant’. If another tenant has Inbound Connector with same value of TlsSenderCertificateName or SenderIPAddresses as yours, the email could attribute to the other tenant instead of yours. An evidence that you hit this scenario can be found on the X-MS-Exchange-CrossTenant-id header. The value of this header is the tenant id where the message has been attributed.  If the tenants are owned by you, be sure that both tenants have different TlsSenderCertificateName or SenderIPAddresses values. Otherwise, you should open a case with us.

 

Legitimate internal messages originating to EXO are being marked as Anonymous and you can find the header: X-CrossPremisesHeadersFilteredBySendConnector.

Usually this scenario involves Exchange 2010 as Hub Transport and Exchange 2013 as Edge Transport. Refer to KB3212872 in order to fix this issue.

 

When Edge Transport Server is deployed, you should keep the “Inbound to Site” Send Connectors settings as default.

Changing the default Address Space from “--" to any other value may result in authentication issue for email coming from Office 365. In fact, our recommendation is to keep all connectors settings as default.

Hybrid mail flow FAQ

Why do we not recommend putting firewalls/hosts between EXO & Exchange on-prem?

An appliance or application between EXO and on-premises which modify or perform content inspection can break the cross-premises message authentication. As previous explained, EXO and on-prem rely on a set of headers to “trust” that the message is Internal.

In addition to headers, default hybrid configuration also grants your Exchange Online tenant the ability to relay from the cloud via your on-premises Exchange server. This can only be accomplished via an ESMTP protocol communication that happens at the application layer. Introducing filtering here can interfere. That said, if you do not wish to grant the ability to relay (e.g. outbound mail path is via Office 365), then this is not a big deal. However, if your outbound SMTP traffic needs to go via on-premises, then there is not a better way to grant relay to your tenant – and your tenant only. You may use the Edge Transport role to accomplish this determination. Refer to this article to find all supported hybrid scenarios. 

 

What is required to preserve the headers if I don’t have Exchange and what are the risks of doing so?

  • From on-prem to EXO: If you use an inbound connector in Office 365 with CloudServicesMailEnabled, Office 365 will look for CrossPremises mail flow headers and will promote them to Intra-organizational headers upon entry into Office 365. In this way, you can preserve most intra-organizational headers. Alternative: Setting TreatMessagesAsInternal as $True forces EOP to accept messages from your 3rd party solution as Internal only if the sender matches an accepted domain on EXO. The risk is that EOP can’t really validate if the message is indeed internal or spoofed by someone through your 3rd party solution.  Use with extreme caution!
  • From EXO to on-prem: With CloudServicesMailEnabled Office 365 will convert Intra-organizational headers to CrossPremises headers. The problem is that since other Office 365 customers could do the same, so you would need to harden the 3rd party solution to accept only Office 365 AND validate the tenant used to send the mail against a unique header that can’t be spoofed by no other tenant such as X-OriginatorOrg: contoso.com where contoso.com is an Accepted Domain. For this reason, we only support using Exchange or a trusted 3rd party service that can distinguish between Office 365 tenants.

Note that only connector type of on-premises supports CloudServicesMailEnabled. For considerations on how to setup on-premises mail flow with a 3rd party service, see Integrate Office 365 mail flow with an email add-on service. If the 3rd party service cannot meet the requirements set in this guidance, you will be unable to use on-premises connectors. If you cannot use on-premises connectors with CloudServicesMailEnabled, then the mail flow path will not be trusted. This means that all mail will be treated as Anonymous and will be re-scanned.

Typically we see this when someone wants to add a 3rd party service into their organization’s inbound or outbound traffic. For outbound, the on-premises connector ensures the ability to relay. For inbound, preservation of the spam verdicts is critical. If your put a 3rd party solution in front of Office 365, pay close attention to the next question below.

Adding an on-premises or customer-managed SMTP host into a mail routing path is a little less strict assuming you can use a specific IPv4 address that you own. However, certificates and tenant checks are still required to make certain that someone does not introduce untrusted mail into your path and compromise your security.

 

My MX record points to a 3rd party solution, but I want to take advantage of EOP and Office 365 ATP.

There was a time where we used to recommend bypassing EOP checks for 3rd party solution and/or hybrid Exchange on-prem via transport rule (SCL -1) for customers who have the MX record pointing to something other than Office 365. The reason? To avoid false positives due to failed SPF checks and so on. Please, don’t do that anymore. It’s OK if you did in the past but we built a better solution for you, called Enhanced Filtering for Connectors. We still encourage you to switch your MX record to Office 365, but if you are not prepared to do so yet, Enhanced Filtering can help.

 

Do I need to add on-premises public IP on SPF for hybrid mail flow from on-premises to EXO?

Yes. Even if Internal email bypasses spoof verdict for hybrid mail flow, we encourage you to add your on-premises public IP on SPF. The reason is you might have some application which rely on your Exchange anonymously to send to EXO or even sending directly to the Internet. Without on-prem public IP on SPF, those kinds of messages should land in junk folder – or follow the anti-spoof action.

 

Do I need to include EOP on my SPF if I’m sending email to internet from my on-premises server?

You should. The connector attribution process looks at the TLS certificate sent by your on-premises. If the recipient’s tenant is in the same forest as yours, the message will be attributed to your tenant before sending to the recipient’s tenant. The SPF check in the recipient’s tenant will be against an EOP IP address. That is why you should include EOP SPF in your SPF Record.  If you’re seeing outbound traffic from on-premises being routed via your Office 365 tenant, or is causing mail loops, please review FAQ 6-b from this earlier post.

There are two possible exceptions for this scenario: 

  1. The last on-prem hop is a 3rd party gateway using a different TLS cert CN or SAN which doesn’t match at all the Inbound Connector TlsSenderCertificateName. If your Inbound Connector uses IP instead of TLS, the message won’t be attributed to your tenant only if the 3rd party public IP doesn’t match the Inbound Connector SenderIPAddresses.
  2. Exchange 2013 or later using two Send Connectors, one just for Office 365 (aka Outbound to Office 365) and the other to send to internet AND they have different TlsCertificateName assigned to them. “Outbound to Office 365” Send Connector will have the certificate which matches TlsSenderCertificateName Inbound Connector and “Outbound to Internet” Send Connector will have a different TLS cert CN or SAN which doesn’t match at all the Inbound Connector TlsSenderCertificateName. Example:

hybmailfl03.jpg

 

How can I force X-MS-Exchange-Organization-AuthAs: Internal for non-authenticated messages?

For Exchange on-premises, the only supported scenario for this would be using a receive connector assigned as Externally Secured permission (which grants other permissions). For Exchange Online, you can use an inbound connector with TreatMessagesAsInternal. Any other method such as Transport Rule is not supported.

 

I have a lot of custom settings on connectors, my concern is if I run HCW and break mail flow, what should I do?

If you don’t have Centralized Mail Transport enabled, technically you have no reason to be afraid. If you have Centralized Mail Transport enabled and use many other custom settings, we encourage you to assess the environment before running HCW. Avoiding HCW is not really a solution; sooner or later you should run it to change a certificate that will expire, right?

You can get and save all attribute values of Receive Connectors, Send Connectors, Inbound Connectors, Outbound Connectors, accepted domains, and remote domains. Once you assess all this information, even if HCW changes some parameter that breaks the mail flow, you will be able to compare before and after state and fix it.

Let me give you a common example: for Exchange 2010, HCW creates an ad hoc receive connector to receive emails from EXO, called “Inbound From Office 365” containing the whole EOP IP range on RemoteIPRange attribute. If you have a NAT which translates the public IP to an internal IP, you must add only this internal NAT IP to RemoteIPRange, otherwise Exchange 2010 will refuse EXO messages. When you run HCW, it will overwrite your NAT IP and add the whole EOP IP range again. So, you need to know the NAT IP before running HCW to re-add as soon as HCW finishes.

Well, that was a lot! Hope you could find relevant information to perform your next SMTP troubleshooting and please feel free to leave comments and feedback below!

Thanks to Arindam Thokder, Nino Bilic and Scott Landry for their review and contribution of this post.

Denis Vilaça Signorelli

2 Comments
New Contributor

Hi, we have to use Centralized Mail Transport for Agency to Agency SEEMail encryption. We have a partner connector created in EXO for Journal messages. This connector validates successfully and I can see that connector was used in Message Trace, however the journaled message for the same goes out through our Hybrid connector. I understand the more specific connector should be used. Or is that not the case when Centralized Mail Transport is used?

How can I resolve/troubleshoot this?

@PhilR2020 CMT forces all messages (except Originating or CBR) to land through the Outbound Connector which RouteAllMessagesViaOnPremises is enabled. You can evidence that using Message Trace Extended Report or Message Trace Detail. CBR doesn’t help in this case because it runs as transport rule, and Journal reports don’t trigger transport rules.

That said, your best chance to manage this situation would be through your on-prem solution and forget about EXO partner connector, or disabling CMT and enabling CBR to route just those “must encrypt” messages through on-prem, but pay super close attention to create a transport rule which won't result in mail looping.