Home
%3CLINGO-SUB%20id%3D%22lingo-sub-750618%22%20slang%3D%22en-US%22%3ERe%3A%20Office%20365%20Message%20Attribution%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-750618%22%20slang%3D%22en-US%22%3E%3CP%3ECommand%20should%20be%3A%3C%2FP%3E%3CPRE%3E%3CFONT%20color%3D%22%23FF0000%22%3ENew%3C%2FFONT%3E-InboundConnector%20%E2%80%93Name%20%22Block%20delivery%20unless%20via%20MX%20record%22%20-ConnectorType%20Partner%20-SenderDomains%20*%20%3CFONT%20color%3D%22%23FF0000%22%3E-RequireTls%3A%24true%3C%2FFONT%3E%20-RestrictDomainsToCertificate%3A%24true%20-TlsSenderCertificateName%20%26lt%3Bon-premises%20or%203rd%20party%20service%20certificate%20subject%20name%26gt%3B%3C%2FPRE%3E%3CP%3E%3Asmileyhappy%3A%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-749143%22%20slang%3D%22en-US%22%3EOffice%20365%20Message%20Attribution%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-749143%22%20slang%3D%22en-US%22%3E%3CP%3EExchange%20message%20transport%20%26amp%3B%20routing%20has%20at%20times%20been%20a%20bit%20challenging%20to%20understand.%20Whether%20it%20was%20the%20X400%20based%20Mail%20Transport%20Agent%20(MTA)%2C%20Open%20Shortest%20Path%20First%20(OSPF)%20based%20routing%20in%20Exchange%202000%2B%2C%20or%20the%20effect%20of%20Database%20Availability%20Groups%20(DAGs)%20on%20mail%20delivery%20and%20resilience.%20Of%20course%20if%20your%20mailboxes%20are%20completely%20hosted%20in%20Office%20365%2C%20then%20this%20is%20no%20longer%20your%20problem%20to%20worry%20about.%26nbsp%3B%20But%20for%20many%20of%20our%20customers%2C%20Hybrid%20or%20some%20form%20of%20coexistence%20is%20still%20a%20concern.%20If%20your%20Office%20365%20mail%20routing%20is%20anything%20but%20the%20most%20basic%20case%2C%20you%20probably%20need%20to%20know%20a%20little%20something%20about%20how%20we%20do%20message%20attribution.%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId-1988858079%22%20id%3D%22toc-hId-1988858079%22%20id%3D%22toc-hId-1988858079%22%20id%3D%22toc-hId-1988858079%22%20id%3D%22toc-hId-1988858079%22%3EWhat%20is%20message%20attribution%20and%20why%20do%20we%20need%20it%3F%3C%2FH1%3E%0A%3CP%3EOne%20of%20the%20harder%20things%20to%20wrap%20your%20mind%20around%20is%20how%20Office%20365%20attributes%20messages%20to%20particular%20organizations%20(tenants).%26nbsp%3B%20Office%20365%20is%20a%20completely%20multi-tenant%20environment%20%E2%80%93%20meaning%20virtually%20all%20infrastructure%20can%20be%20shared%20with%20other%20tenants.%26nbsp%3B%20This%20includes%20IP%20addresses%2C%20certificates%2C%20transport%20servers%20to%20name%20just%20a%20few%20components.%3C%2FP%3E%0A%3CP%3EWhen%20a%20message%20arrives%20at%20Office%20365%2C%20one%20of%20the%20first%20things%20we%20need%20to%20do%20is%20figure%20out%20which%20organization%20it%20belongs%20to.%26nbsp%3B%20At%20first%2C%20this%20sounds%20simple%20%E2%80%93%20just%20look%20at%20the%20recipient%2C%20right%3F%26nbsp%3B%20Well%2C%20it%20is%20more%20complicated%20than%20that%2C%20because%20of%20Hybrid%20and%20complex%20routing%20scenarios.%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EFor%20this%20entire%20post%2C%20we%E2%80%99ll%20refer%20to%20a%20message%20that%20is%20sent%20by%20Office%20365%20customer%20contoso.com%2C%20destined%20to%20another%20Office%20365%20customer%2C%20tailspintoys.com.%26nbsp%3B%20%3C%2FSTRONG%3EBoth%20customers%20may%20be%20hybrid%2C%20and%20so%20it%20is%20possible%20that%20the%20mailbox%20of%20the%20initial%20sender%20at%20contoso.com%20is%20hosted%20on-premises%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20720px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122988i9ADFAB047AA44D78%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Message%20Attribution%201.jpg%22%20title%3D%22Message%20Attribution%201.jpg%22%20%2F%3E%3C%2FSPAN%3EBased%20on%20connectors%2C%20Office%20365%20has%20to%20quickly%20determine%20which%20topology%20is%20the%20intent.%26nbsp%3B%20Both%20organizations%20may%20have%20rules%20that%20they%E2%80%99d%20like%20to%20apply%20to%20the%20message%2C%20and%20both%20organizations%20would%20probably%20like%20to%20keep%20tabs%20on%20the%20message%20as%20it%20passes%20through%20their%20organization%20and%20Office%20365%20tenant.%26nbsp%3B%20So%2C%20we%20need%20to%20be%20able%20to%20distinguish%20which%20tenant%20the%20message%20is%20currently%20traveling%20through.%26nbsp%3B%20Back%20to%20our%20example%2C%20each%20time%20the%20message%20comes%20into%20Office%20365%20we%20need%20to%20decide%20if%20it%20is%20incoming%20to%20tailspintoys.com%20or%20originating%20from%20contoso.com.%26nbsp%3B%20That%20way%20we%20can%20decide%20which%20set%20of%20rules%20to%20run%2C%20connectors%20to%20apply%2C%20and%20which%20customer%20to%20provide%20with%20the%20message%20trace%20data.%3C%2FP%3E%0A%3CP%3EBy%20the%20way%2C%20it%E2%80%99s%20also%20possible%20that%20the%20configuration%20could%20be%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20450px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122989i185C68617D53A05E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Message%20Attribution%202.jpg%22%20title%3D%22Message%20Attribution%202.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EOr%20even%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20624px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122990i3C88D812C1FA2310%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Message%20Attribution%203.jpg%22%20title%3D%22Message%20Attribution%203.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThere%20are%20many%20other%20possibilities%2C%20some%20of%20which%20are%20more%20complex.%20The%20point%20is%20that%20Office%20365%20is%20extremely%20flexible.%26nbsp%3B%20So%20knowing%20the%20rules%20can%20keep%20you%20out%20of%20trouble.%26nbsp%3B%20For%20a%20list%20of%20all%20the%20scenarios%20which%20we%20support%2C%20see%20our%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fexchange%2Fmail-flow-best-practices%2Fmail-flow-best-practices%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ebest%20practices%20document%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EImportant%20Note%3A%3C%2FU%3E%3C%2FSTRONG%3E%26nbsp%3Bjust%20because%20it%20is%20possible%20to%20route%20mail%20in%20a%20complex%20manner%20does%20not%20necessarily%20mean%20that%20the%20required%20headers%20and%20permissions%20will%20be%20preserved.%20We%20frequently%20see%20customers%20configured%20in%20complex%20routing%20scenarios%20who%20are%20having%20a%20poor%20experience%20with%20spam%2C%20spoof%2C%20and%20phishing%20%E2%80%93%20either%20false%20positives%20or%20false%20negatives.%20This%20blog%20only%20focuses%20on%20the%20mail%20attribution%20related%20pieces.%20Successful%20attribution%20doesn%E2%80%99t%20make%20any%20statement%20about%20the%20security%20of%20your%20configuration.%3C%2FP%3E%0A%3CP%3EBefore%20we%20get%20into%20the%20exact%20logic%2C%20I%20think%20it%E2%80%99s%20important%20to%20dispel%20some%20myths%20we%20frequently%20hear.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--759812387%22%20id%3D%22toc-hId--759812387%22%20id%3D%22toc-hId--759812387%22%20id%3D%22toc-hId--759812387%22%20id%3D%22toc-hId--759812387%22%3EFAQ%20%231%20%E2%80%93%20Why%20can%E2%80%99t%20you%20use%20DNS%20to%20determine%20attribution%3F%3C%2FH2%3E%0A%3CP%3EWhen%20you%20pick%20your%20initial%20onmicrosoft.com%20domain%2C%20you%20also%20pick%20a%20primary%20geography%20for%20your%20tenant.%26nbsp%3B%20Office%20365%20then%20assigns%20you%20a%20unique%20DNS%20entry%20for%20your%20onmicrosoft.com%20domain%20(and%20any%20other%20domains%20you%20verify).%26nbsp%3B%20This%20means%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ECurrently%2C%20all%20of%20your%20domains%20should%20resolve%20to%20the%20same%20set%20of%20IP%20addresses%20(so%20technically%2C%20you%20can%20use%20a%20single%20A%20record%20for%20all%20MX%20domain%20records)%3C%2FLI%3E%0A%3CLI%3EAs%20with%20other%20Exchange%20protocols%2C%20your%20IP%20addresses%20are%20all%20the%20same%20as%20every%20other%20Office%20365%20customer%20in%20that%20same%20geography%3B%20assigning%20unique%20IP%20addresses%20is%20not%20an%20option%20%E2%80%93%20we%20would%20require%20roughly%203%20IPs%20per%20customer%2C%20and%20that%20would%20be%20a%20too%20many%2C%20given%20IPv4%20addresses%20are%20hard%20to%20come%20by%20these%20days%3C%2FLI%3E%0A%3CLI%3EThese%20records%20%26amp%3B%20IPs%20are%20used%20for%20all%20mail%20flow%2C%20coming%20from%20your%20tenant%20(originating)%20or%20going%20to%20your%20tenant%20(incoming)%3C%2FLI%3E%0A%3CLI%3ESMTP%20has%20no%20concept%20at%20the%20application%20layer%20that%20is%20equivalent%20to%20HTTP%20host%20headers%2C%20so%20our%20SMTP%20endpoint%20has%20no%20idea%20which%20DNS%20entries%20were%20used%20to%20find%20us%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EIn%20other%20words%20%E2%80%93%20we%20can%E2%80%99t%20use%20DNS%20as%20an%20attribution%20method.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-982997948%22%20id%3D%22toc-hId-982997948%22%20id%3D%22toc-hId-982997948%22%20id%3D%22toc-hId-982997948%22%20id%3D%22toc-hId-982997948%22%3EFAQ%20%232%20%E2%80%93%20Is%20Office%20365%20an%20open%20relay%3F%3C%2FH2%3E%0A%3CP%3EOffice%20365%20has%20a%20feature%20that%20allows%20you%20to%20relay%20messages%20from%20your%20on-premises%20environment.%26nbsp%3B%20The%20way%20you%20enable%20this%20is%20by%20creating%20an%20inbound%20connector%20of%20type%20on-premises.%26nbsp%3B%20This%20connector%20can%20authorize%20relay%20either%20by%20IP%20address%2C%20or%20by%20certificate.%26nbsp%3B%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FExchange-Team-Blog%2FImportant-notice-for-Office-365-email-customers-who-have%2Fba-p%2F605322%22%20target%3D%22_self%22%3EThe%20latter%20is%20highly%20preferred%3C%2FA%3E%2C%20particularly%20when%20you%E2%80%99re%20sending%20email%20for%20domains%20which%20you%20don%E2%80%99t%20own%20or%20haven%E2%80%99t%20added%20to%20your%20tenant.%26nbsp%3B%20Certificates%20are%20significantly%20more%20secure%20and%20identify%20you%20better%20than%20just%20a%20IP%20addresses%20%E2%80%93%20as%20it%20is%20very%20difficult%20to%20prove%20IP%20ownership%20definitively.%26nbsp%3B%20Should%20two%20Office%20365%20tenants%20specify%20the%20same%20IP%20or%20overlapping%20ranges%2C%20then%20things%20start%20to%20go%20wrong%20%E2%80%93%20for%20example%2C%20if%20inbound%20on-premises%20connectors%20are%20created%20for%20a%20shared%20service.%3C%2FP%3E%0A%3CP%3ESometimes%20when%20checking%20to%20see%20if%20Office%20365%20is%20an%20open%20relay%20or%20not%2C%20the%20IP%20address%20from%20which%20the%20test%20is%20being%20run%20is%20listed%20on%20a%20connector%20%E2%80%93%20inside%20your%20tenant%2C%20or%20someone%20else%E2%80%99s.%26nbsp%3B%20And%20since%20the%20relay%20feature%20is%20enabled%20for%20that%20IP%2C%20the%20%E2%80%98open%20relay%E2%80%99%20test%20will%20fail.%26nbsp%3B%20More%20on%20how%20to%20protect%20against%20abuse%20later.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1569159013%22%20id%3D%22toc-hId--1569159013%22%20id%3D%22toc-hId--1569159013%22%20id%3D%22toc-hId--1569159013%22%20id%3D%22toc-hId--1569159013%22%3EFAQ%20%233%20%E2%80%93%20Does%20mail%20between%20Office%20365%20tenants%20always%20use%20MX%20records%3F%3C%2FH2%3E%0A%3CP%3EYes%20-%20except%20when%20we%E2%80%99re%20not%20expected%20to.%20Going%20back%20to%20our%20example%2C%20if%20a%20message%20is%20truly%20attributed%20to%20contoso.com%20initially%2C%20then%20when%20we%E2%80%99re%20ready%20to%20send%20the%20message%20to%20tailspintoys.com%2C%20we%20will%20absolutely%20look%20up%20the%20MX%20record.%26nbsp%3B%20However%2C%20there%20are%20some%20exceptions%20you%20should%20be%20aware%20of%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EContoso.com%20can%20override%20the%20routing%20logic%20by%20creating%20an%20outbound%20connector%20for%20tailspintoys.com.%26nbsp%3B%20This%20case%20is%20the%20most%20obvious%20and%20is%20no%20different%20than%20Exchange%E2%80%99s%20(or%20any%20other%20SMTP%20server%E2%80%99s)%20routing%20logic.%3C%2FLI%3E%0A%3CLI%3EIf%20the%20mail%20appears%20to%20already%20be%20incoming%20to%20tailspintoys.com%2C%20then%20we%20wouldn%E2%80%99t%20want%20to%20route%20it%20back%20out%20to%20the%20tailspintoys.com%20MX%20record.%26nbsp%3B%20This%20can%20happen%20if%20contoso.com%20doesn%E2%80%99t%20have%20a%20properly%20configured%20inbound%20connector.%20Without%20a%20proper%20connector%2C%20we%20see%20the%20message%20as%20incoming%20to%20tailspintoys.com.%3C%2FLI%3E%0A%3CLI%3EWe%20also%20give%20each%20tenant%20an%20onmicrosoft.com%20address.%26nbsp%3B%20These%20addresses%20can%20always%20be%20used%20to%20route%20directly%20to%20Office%20365%2C%20no%20matter%20where%20the%20MX%20record%20points%20(this%20is%20how%20cross%20premise%20mail%20flow%20works%20between%20on-premises%20and%20the%20cloud).%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EIf%20tailspintoys.com%20does%20not%20point%20their%20MX%20record%20to%20Office%20365%2C%20they%20can%20tell%20Office%20365%20to%20reject%20messages%20which%20do%20not%20originate%20from%20the%20endpoint%20they%20want%20all%20mails%20to%20first%20route%20through%20(including%20onmicrosoft.com%20domains).%26nbsp%3B%20You%20can%20do%20this%20by%20creating%20an%20inbound%20connector%20something%20like%20this%3A%3C%2FP%3E%0A%3CPRE%3ENew-InboundConnector%20%E2%80%93Name%20%22Block%20delivery%20unless%20via%20MX%20record%22%20-ConnectorType%20Partner%20-SenderDomains%20*%20-RestrictDomainsToCertificate%20%24true%20-TlsSenderCertificateName%20%26lt%3Bon-premises%20or%203rd%20party%20service%20certificate%20subject%20name%26gt%3B%3C%2FPRE%3E%0A%3CP%3ENote%20that%20by%20creating%20a%20connector%20like%20this%20will%20cause%20NDRs%20to%20be%20generated%20for%20messages%20which%20are%20submitted%20directly%20to%20your%20tenant%20and%20don%E2%80%99t%20match%20the%20certificate%20name%20you%20provide%20above.%26nbsp%3B%20Certificate%20is%20always%20the%20preferred%20method.%26nbsp%3B%20Whether%20you%20end%20up%20using%20certificates%20or%20IP(s)%2C%20if%20either%20certificate%20or%20IP(s)%20changes%2C%20you%20will%20reject%20good%20messages.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-173651322%22%20id%3D%22toc-hId-173651322%22%20id%3D%22toc-hId-173651322%22%20id%3D%22toc-hId-173651322%22%20id%3D%22toc-hId-173651322%22%3EFAQ%20%234%20%E2%80%93%20Can%20I%20use%20production%20domains%20for%20testing%20without%20risk%3F%3C%2FH2%3E%0A%3CP%3EIf%20you%20create%20a%20tenant%20in%20Office%20365%2FAzure%20and%20add%20production%20domains%20to%20the%20tenant%2C%20you%20need%20to%20be%20careful.%26nbsp%3B%20It%20is%20likely%20that%20your%20organization%20already%20sends%20email%20to%20many%20other%20Office%20365%20customers.%26nbsp%3B%20As%20such%2C%20real%20production%20email%20will%20be%20sent%20to%20Office%20365%20at%20some%20point.%26nbsp%3B%20As%20soon%20as%20you%20verify%20the%20domain%2C%20it%20is%20possible%20that%20mail%20will%20be%20associated%20with%20your%20test%20tenant%2C%20especially%20if%20there%20is%20an%20inbound%20connector%20inside%20your%20test%20tenant%2C%20or%20if%20the%20other%20party%20has%20a%20configuration%20issue%20that%20causes%20the%20mail%20to%20be%20attributed%20differently%20than%20they%20intend.%3C%2FP%3E%0A%3CP%3EPut%20another%20way%2C%20we%E2%80%99ll%20start%20accepting%20mail%20for%20verified%20domains%20%E2%80%93%20unless%20you%20tell%20us%20not%20to%20accept%20or%20tell%20us%20to%20only%20accept%20conditionally.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1916461657%22%20id%3D%22toc-hId-1916461657%22%20id%3D%22toc-hId-1916461657%22%20id%3D%22toc-hId-1916461657%22%20id%3D%22toc-hId-1916461657%22%3EFAQ%20%235(a)%20%E2%80%93%20Why%20does%20Office%20365%20allow%20spoofing%3F%3C%2FH2%3E%0A%3CP%3EFirst%2C%20SMTP%20is%20inherently%20not%20very%20secure.%26nbsp%3B%20It%20is%20also%20possible%20that%20someone%20else%20is%20spoofing%20the%20sender%20of%20the%20message%20%E2%80%93%20whether%20this%20spoofing%20is%20legitimate%20(like%20a%20bulk%20email%20service%2C%20a%20partner%20organization%2C%203%3CSUP%3Erd%3C%2FSUP%3Eparty%20service%2C%20etc.)%20%E2%80%93%20or%20not%20(spam%2C%20phish%2C%20etc.).%26nbsp%3B%20While%20EOP%20does%20it%E2%80%99s%20best%20to%20protect%20you%20from%20the%20latter%2C%20we%20must%20be%20extremely%20careful%20not%20to%20block%20the%20legitimate%20messages.%26nbsp%3B%20%3CSTRONG%3EThis%20is%20no%20different%20than%20any%20other%20SMTP%20server%2C%20multi-tenant%20or%20not.%26nbsp%3B%20%3C%2FSTRONG%3EVery%20few%20email%20servers%20will%20outright%20block%20email%20at%20the%20SMTP%20level%20based%20on%20a%20spoofed%20MAIL%20FROM%2C%20because%20there%20are%20so%20many%20legitimate%20uses.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--635695304%22%20id%3D%22toc-hId--635695304%22%20id%3D%22toc-hId--635695304%22%20id%3D%22toc-hId--635695304%22%20id%3D%22toc-hId--635695304%22%3EFAQ%20%235(b)%20%E2%80%93%20Is%20Office%20365%20more%20insecure%20because%20of%20this%3F%3C%2FH2%3E%0A%3CP%3EThere%20are%20two%20main%20standards%20for%20detecting%20bad%20spoofing.%26nbsp%3B%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Foffice365%2Fsecuritycompliance%2Fanti-spoofing-protection%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3ESPF%20based%20spoof%20detection%3C%2FA%3Eisn%E2%80%99t%20the%20best%20method%20for%20a%20multi-tenant%20service%20and%20is%20certainly%20the%20weaker%20of%20the%20two.%26nbsp%3B%20We%20don%E2%80%99t%20typically%20use%20SPF%20alone%20to%20determine%20that%20mail%20is%20suspicious%20%E2%80%93%20it%20has%20%3CSTRONG%3Eproven%3C%2FSTRONG%3Etoo%20unreliable.%26nbsp%3B%20The%20other%20standard%20which%20we%20use%2C%20DKIM%2C%20is%20more%20secure.%26nbsp%3B%20We%20have%20some%20level%20of%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Foffice365%2FSecurityCompliance%2Fuse-dkim-to-validate-outbound-email%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eanti-spoofing%20by%20default%3C%2FA%3E%3CSPAN%3Eusing%20DKIM%3C%2FSPAN%3E%2C%20and%20you%20can%20always%20make%20it%20better%20by%20publishing%20and%20using%20both%20%3CA%20href%3D%22https%3A%2F%2Fblogs.msdn.microsoft.com%2Ftzink%2F2016%2F03%2F07%2Fa-powershell-script-to-help-you-validate-your-dkim-config-in-office-365%2F%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EDKIM%3C%2FA%3Eand%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Foffice365%2FSecurityCompliance%2Fuse-dmarc-to-validate-email%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EDMARC%3C%2FA%3E.%20%26nbsp%3BWe%20have%20a%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Foffice365%2Fsecuritycompliance%2Flearn-about-spoof-intelligence%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3ESpoof%20Intelligence%3C%2FA%3Efeature%20that%20uses%20our%20knowledge%20of%20mail%20flow%20patterns%20as%20the%20world%E2%80%99s%20largest%20email%20provider%2C%20and%20also%20using%20SPF%2C%20DKIM%2C%20and%20DMARC%20as%20inputs.%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20you%20use%20one%20(or%20both)%20of%20these%20standards%20to%20authorize%20Office%20365%20to%20send%20mail%20on%20your%20behalf%2C%20you%20are%20essentially%20saying%20that%20you%20trust%20us%20to%20prevent%20bad%20spoofing%20of%20your%20domain%20by%20other%20Office%20365%20customers.%26nbsp%3B%20Read%20through%20the%20links%20above%20to%20build%20your%20confidence%20that%20we%20do%20not%20take%20this%20trust%20lightly.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1107115031%22%20id%3D%22toc-hId-1107115031%22%20id%3D%22toc-hId-1107115031%22%20id%3D%22toc-hId-1107115031%22%20id%3D%22toc-hId-1107115031%22%3EFAQ%20%236(a)%20%E2%80%93%20When%20does%20the%20hybrid%20wizard%20create%20an%20inbound%20connector%20with%20a%20wildcard%20in%20the%20TLSSenderCertificateName%3F%3C%2FH2%3E%0A%3CP%3EMost%20customers%20have%20been%20using%20certificates%20on-premises%20that%20take%20the%20form%20of%20%3CHOST%3E.%3CROOTDOMAIN%3E%2C%20for%20example%2C%20exchange.contoso.com.%26nbsp%3B%20However%2C%20exchange.contoso.com%20is%20not%20usually%20registered%20inside%20of%20the%20Office%20365%20tenant%20when%20the%20hybrid%20wizard%20is%20run.%20In%20order%20to%20make%20sure%20that%20mail%20works%2C%20we%20optimized%20the%20wizard%20to%20instead%20create%20the%20connector%20with%20*.contoso.com%20as%20the%20matching%20certificate.%20That%20way%20(a)%20the%20on-premises%20certificate%20matches%20and%20(b)%20the%20accepted%20domain%20(contoso.com)%20also%20matches.%20Hybrid%20wizard%20does%20tell%20you%20that%20it%20is%20going%20to%20do%20this.%3C%2FROOTDOMAIN%3E%3C%2FHOST%3E%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1445041930%22%20id%3D%22toc-hId--1445041930%22%20id%3D%22toc-hId--1445041930%22%20id%3D%22toc-hId--1445041930%22%20id%3D%22toc-hId--1445041930%22%3EFAQ%20%236(b)%20%E2%80%93%20I%20don%E2%80%99t%20want%20outbound%20email%20originating%20from%20my%20on-premises%20gateway%20going%20through%20my%20Office%20365%20tenant.%20How%20do%20I%20fix%20this%3F%3C%2FH2%3E%0A%3CP%3EUnfortunately%2C%20for%20customers%20with%20multiple%20tenants%2C%20or%20complicated%20outbound%20on-premises%20routing%2C%20having%20a%20wildcard%20match%20may%20be%20catching%20too%20much%20mail%20and%20attributing%20it%20all%20to%20the%20matching%20Office%20365%20tenant.%26nbsp%3B%20The%20simplest%20fix%20%E2%80%93%20if%20the%20hybrid%20wizard%20created%20the%20connector%20%E2%80%93%20is%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EFigure%20out%20the%20specific%20certificate%20name%20utilized%20by%20Exchange%20on-premises%20(e.g.%20exchange.contoso.com).%3C%2FLI%3E%0A%3CLI%3EAdd%20%26amp%3B%20verify%20the%20Exchange%20certificate%20name%20(e.g.%20exchange.contoso.com)%20as%20an%20accepted%20domain%20inside%20of%20the%20correct%20Office%20365%20tenant.%3C%2FLI%3E%0A%3CLI%3EMake%20sure%20that%20the%20on-premises%20gateway%20is%20utilizing%20a%20different%20certificate%20(e.g.%20mailgateway.contoso.com).%3C%2FLI%3E%0A%3CLI%3ERe-run%20the%20hybrid%20wizard.%26nbsp%3B%20If%20you%20don%E2%80%99t%20want%20to%20re-run%20the%20hybrid%20wizard%2C%20then%20update%20the%20TlsSenderCertificateName%20on%20the%20inbound%20connector%20to%20match%20the%20exchange%20on-premises%20certificate%20only%20(e.g.%20exchange.contoso.com).%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH1%20id%3D%22toc-hId-494281910%22%20id%3D%22toc-hId-494281910%22%20id%3D%22toc-hId-494281910%22%20id%3D%22toc-hId-494281910%22%20id%3D%22toc-hId-494281910%22%3EHow%20does%20message%20attribution%20work%3F%3C%2FH1%3E%0A%3CP%3ESo%2C%20back%20to%20the%20reason%20for%20the%20title%20of%20the%20post%20-%20when%20a%20message%20is%20sent%20to%20Office%20365%2C%20the%20Front-end%20transport%20servers%20that%20receive%20the%20message%20need%20to%20determine%20if%20the%20message%20is%20%3CSTRONG%3Eoriginating%3C%2FSTRONG%3E(coming%20from%20a%20customer)%20or%20%3CSTRONG%3Eincoming%3C%2FSTRONG%3E(going%20to%20a%20customer).%26nbsp%3B%20In%20other%20words%2C%20is%20the%20%3CSTRONG%3Ecurrent%20hop%3C%2FSTRONG%3Einside%20of%20contoso.com%E2%80%99s%20routing%20configuration%20or%20inside%20of%20tailspintoys.com%3F%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1369111991%22%20id%3D%22toc-hId--1369111991%22%20id%3D%22toc-hId--1369111991%22%20id%3D%22toc-hId--1369111991%22%20id%3D%22toc-hId--1369111991%22%3EDefinitions%3C%2FH2%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EOriginating%3A%3C%2FSTRONG%3EA%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%20%3CEM%3EOnPremises%3C%2FEM%3E)%2C%20or%20from%20an%20Exchange%20Online%20mailbox.%20If%20Office%20365%20is%20unable%20to%20identify%20the%20message%20as%20%3CSTRONG%3Eoriginating%3C%2FSTRONG%3Eand%20the%20recipient%20domain%20is%20an%20accepted%20domain%20in%20an%20Office%20365%20organization%2C%20the%20service%20will%20identify%20the%20message%20as%20%3CSTRONG%3Eincoming%3C%2FSTRONG%3Eto%20the%20recipient%20organization.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EIncoming%3A%3C%2FSTRONG%3EMessages%20sent%20to%20accepted%20domains%20that%20are%20in%20Office%20365%20that%20do%20not%20match%20a%20tenant%20connector%20that%20is%20of%20type%20%3CEM%3EOnPremises%3C%2FEM%3E.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH2%20id%3D%22toc-hId-373698344%22%20id%3D%22toc-hId-373698344%22%20id%3D%22toc-hId-373698344%22%20id%3D%22toc-hId-373698344%22%20id%3D%22toc-hId-373698344%22%3EHow%20Office%20365%20determines%20to%20which%20tenant%20a%20specific%20message%20belongs%3C%2FH2%3E%0A%3CP%3EThis%20is%20the%20basic%20logic%20used.%26nbsp%3B%20This%20has%20been%20simplified%20to%20a%20small%20degree%20in%20order%20to%20cover%20the%20top%20scenarios%20and%20make%20it%20easier%20to%20understand.%3C%2FP%3E%0A%3CH4%20id%3D%22toc-hId--1477394039%22%20id%3D%22toc-hId--1477394039%22%20id%3D%22toc-hId--1477394039%22%20id%3D%22toc-hId--1477394039%22%20id%3D%22toc-hId--1477394039%22%3EOriginating%3C%2FH4%3E%0A%3COL%3E%0A%3CLI%3EFirst%2C%20we%20check%20to%20see%20if%20the%20message%20is%20Originating.%20The%20service%20uses%20the%20following%20envelope%20information%3A%3C%2FLI%3E%0A%3CUL%3E%0A%3CLI%3ECertificate%20presented%20by%20the%20sending%20server%20or%20the%20Connecting%20IP%3C%2FLI%3E%0A%3CLI%3EMailFrom%20domain%3C%2FLI%3E%0A%3CLI%3ERcptTo%20domain%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CLI%3EThe%20certificate%20name%2C%20or%20Subject%20Alternative%20Name%20(SAN)%20on%20the%20certificate%2C%20is%20used%20to%20lookup%20matching%20tenant%20Inbound%20connectors%20that%20are%20of%20type%20OnPremises%20across%20all%20tenants%20within%20the%20EOP%20forest.%3C%2FLI%3E%0A%3CLI%3EFor%20all%20matched%20connectors%20we%20next%20look%20at%20which%20tenant%20has%20the%20TlsSenderCertificateName%20domain%20configured%20as%20an%20accepted%20domain.%20The%20most%20specific%20match%20will%20win.%3C%2FLI%3E%0A%3CUL%3E%0A%3CLI%3EIf%20one%20is%20found%20the%20messages%20is%20attributed%20as%20Originating%20from%20that%20tenant.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CLI%3EIf%20no%20tenant%20matches%20were%20found%2C%20we%20next%20look%20at%20the%20Connecting%20IP%20and%20find%20all%20tenants%20with%20Inbound%20OnPremises%20connectors%20which%20match%20the%20IP.%3C%2FLI%3E%0A%3CUL%3E%0A%3CLI%3EFor%20all%20matched%20connectors%20we%20next%20look%20at%20what%20tenant%20has%20the%20MailFrom%20domain%20configured%20as%20an%20accepted%20domain.%20If%20one%20is%20found%20the%20message%20is%20attributed%20as%20Originating%20from%20that%20tenant.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FOL%3E%0A%3CH4%20id%3D%22toc-hId-265416296%22%20id%3D%22toc-hId-265416296%22%20id%3D%22toc-hId-265416296%22%20id%3D%22toc-hId-265416296%22%20id%3D%22toc-hId-265416296%22%3EIncoming%3C%2FH4%3E%0A%3COL%3E%0A%3CLI%3EIf%20the%20message%20has%20NOT%20been%20attributed%20as%20Originating%2C%20at%20this%20point%20the%20service%20assumes%20the%20message%20is%20coming%20to%20us%20either%20as%20MX%20routed%20or%20via%20relay%20smart%20host%20(we%20have%20no%20way%20of%20telling).%20We%20then%20lookup%20if%20the%20RcptTo%20matches%20an%20accepted%20domain%20in%20a%20tenant%20and%20attribute%20the%20message%20as%20Incoming%20to%20that%20tenant.%20We%20then%20look%20to%20see%20if%20the%20message%20matches%20any%20inbound%20partner%20connectors%20in%20that%20tenant%2C%20and%20if%20a%20match%20is%20made%2C%20the%20message%20is%20attributed%20to%20that%20connector.%20If%20no%20match%20is%20made%2C%20then%20the%20message%20arrives%20at%20that%20tenant%20through%20the%20default%20inbound%20connector.%3C%2FLI%3E%0A%3CUL%3E%0A%3CLI%3EIf%20no%20tenant%20is%20found%20which%20has%20the%20recipient%20domain%20has%20a%20validated%20domain%2C%20the%20message%20will%20be%20rejected%20by%20the%20service.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FOL%3E%0A%3CP%3ESo%20now%20you%20know%20how%20Office%20365%20Message%20Attribution%20works.%3C%2FP%3E%0A%3CP%3E-Scott%20Landry%2C%20with%20contributions%20%26amp%3B%20feedback%20from%20many%20others%2C%20especially%20Bruce%20Wilson%2C%20Stan%20Aleksiev%2C%20Markus%20Dahlweid%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-749143%22%20slang%3D%22en-US%22%3E%3CP%3EWhen%20a%20message%20arrives%20at%20Office%20365%2C%20one%20of%20the%20first%20things%20we%20need%20to%20do%20is%20figure%20out%20which%20organization%20it%20belongs%20to.%26nbsp%3B%20At%20first%2C%20this%20sounds%20simple%20%E2%80%93%20just%20look%20at%20the%20recipient%2C%20right%3F%26nbsp%3B%20Well%2C%20it%20is%20more%20complicated%20than%20that%2C%20because%20of%20Hybrid%20and%20complex%20routing%20scenarios.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-749143%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAdministration%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Eall%20posts%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExchange%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExchange%20Online%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Etransport%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-751337%22%20slang%3D%22en-US%22%3ERE%3A%20Office%20365%20Message%20Attribution%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-751337%22%20slang%3D%22en-US%22%3EWell%20spotted.%20Fixed.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-764282%22%20slang%3D%22en-US%22%3ERe%3A%20Office%20365%20Message%20Attribution%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-764282%22%20slang%3D%22en-US%22%3E%3CP%3EFAQ%20%232%20-%20When%20setting%20up%20and%20inbound%20connector%20(for%20sending%20mail%20to%20both%20internal%20and%20external%20recipients)%2C%20I%20remember%20it%20was%20important%20to%20have%20the%20IP%20address%20of%20the%20mail%20server%20in%20SPF%2C%20otherwise%20the%20mail%20would%20end%20up%20in%20spam%20-%20is%20that%20still%20a%20case%20when%20certificate%20is%20used%3F%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fexchange%2Fmail-flow-best-practices%2Fhow-to-set-up-a-multifunction-device-or-application-to-send-email-using-office-3%23step-by-step-configuration-instructions-for-smtp-relay%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EReference%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-765696%22%20slang%3D%22en-US%22%3ERe%3A%20Office%20365%20Message%20Attribution%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-765696%22%20slang%3D%22en-US%22%3E%3CA%20href%3D%22https%3A%2F%2Fwww.bolapedia.me%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.bolapedia.me%3C%2FA%3E%3C%2FLINGO-BODY%3E

Exchange message transport & routing has at times been a bit challenging to understand. Whether it was the X400 based Mail Transport Agent (MTA), Open Shortest Path First (OSPF) based routing in Exchange 2000+, or the effect of Database Availability Groups (DAGs) on mail delivery and resilience. Of course if your mailboxes are completely hosted in Office 365, then this is no longer your problem to worry about.  But for many of our customers, Hybrid or some form of coexistence is still a concern. If your Office 365 mail routing is anything but the most basic case, you probably need to know a little something about how we do message attribution.

What is message attribution and why do we need it?

One of the harder things to wrap your mind around is how Office 365 attributes messages to particular organizations (tenants).  Office 365 is a completely multi-tenant environment – meaning virtually all infrastructure can be shared with other tenants.  This includes IP addresses, certificates, transport servers to name just a few components.

When a message arrives at Office 365, one of the first things we need to do is figure out which organization it belongs to.  At first, this sounds simple – just look at the recipient, right?  Well, it is more complicated than that, because of Hybrid and complex routing scenarios.

For this entire post, we’ll refer to a message that is sent by Office 365 customer contoso.com, destined to another Office 365 customer, tailspintoys.com.  Both customers may be hybrid, and so it is possible that the mailbox of the initial sender at contoso.com is hosted on-premises:

 

Message Attribution 1.jpgBased on connectors, Office 365 has to quickly determine which topology is the intent.  Both organizations may have rules that they’d like to apply to the message, and both organizations would probably like to keep tabs on the message as it passes through their organization and Office 365 tenant.  So, we need to be able to distinguish which tenant the message is currently traveling through.  Back to our example, each time the message comes into Office 365 we need to decide if it is incoming to tailspintoys.com or originating from contoso.com.  That way we can decide which set of rules to run, connectors to apply, and which customer to provide with the message trace data.

By the way, it’s also possible that the configuration could be this:

 

Message Attribution 2.jpg

Or even this:

 

Message Attribution 3.jpg

There are many other possibilities, some of which are more complex. The point is that Office 365 is extremely flexible.  So knowing the rules can keep you out of trouble.  For a list of all the scenarios which we support, see our best practices document.

Important Note:  just because it is possible to route mail in a complex manner does not necessarily mean that the required headers and permissions will be preserved. We frequently see customers configured in complex routing scenarios who are having a poor experience with spam, spoof, and phishing – either false positives or false negatives. This blog only focuses on the mail attribution related pieces. Successful attribution doesn’t make any statement about the security of your configuration.

Before we get into the exact logic, I think it’s important to dispel some myths we frequently hear.

FAQ #1 – Why can’t you use DNS to determine attribution?

When you pick your initial onmicrosoft.com domain, you also pick a primary geography for your tenant.  Office 365 then assigns you a unique DNS entry for your onmicrosoft.com domain (and any other domains you verify).  This means:

  • Currently, all of your domains should resolve to the same set of IP addresses (so technically, you can use a single A record for all MX domain records)
  • As with other Exchange protocols, your IP addresses are all the same as every other Office 365 customer in that same geography; assigning unique IP addresses is not an option – we would require roughly 3 IPs per customer, and that would be a too many, given IPv4 addresses are hard to come by these days
  • These records & IPs are used for all mail flow, coming from your tenant (originating) or going to your tenant (incoming)
  • SMTP has no concept at the application layer that is equivalent to HTTP host headers, so our SMTP endpoint has no idea which DNS entries were used to find us

In other words – we can’t use DNS as an attribution method.

FAQ #2 – Is Office 365 an open relay?

Office 365 has a feature that allows you to relay messages from your on-premises environment.  The way you enable this is by creating an inbound connector of type on-premises.  This connector can authorize relay either by IP address, or by certificate.  The latter is highly preferred, particularly when you’re sending email for domains which you don’t own or haven’t added to your tenant.  Certificates are significantly more secure and identify you better than just a IP addresses – as it is very difficult to prove IP ownership definitively.  Should two Office 365 tenants specify the same IP or overlapping ranges, then things start to go wrong – for example, if inbound on-premises connectors are created for a shared service.

Sometimes when checking to see if Office 365 is an open relay or not, the IP address from which the test is being run is listed on a connector – inside your tenant, or someone else’s.  And since the relay feature is enabled for that IP, the ‘open relay’ test will fail.  More on how to protect against abuse later.

FAQ #3 – Does mail between Office 365 tenants always use MX records?

Yes - except when we’re not expected to. Going back to our example, if a message is truly attributed to contoso.com initially, then when we’re ready to send the message to tailspintoys.com, we will absolutely look up the MX record.  However, there are some exceptions you should be aware of:

  1. Contoso.com can override the routing logic by creating an outbound connector for tailspintoys.com.  This case is the most obvious and is no different than Exchange’s (or any other SMTP server’s) routing logic.
  2. If the mail appears to already be incoming to tailspintoys.com, then we wouldn’t want to route it back out to the tailspintoys.com MX record.  This can happen if contoso.com doesn’t have a properly configured inbound connector. Without a proper connector, we see the message as incoming to tailspintoys.com.
  3. We also give each tenant an onmicrosoft.com address.  These addresses can always be used to route directly to Office 365, no matter where the MX record points (this is how cross premise mail flow works between on-premises and the cloud).

If tailspintoys.com does not point their MX record to Office 365, they can tell Office 365 to reject messages which do not originate from the endpoint they want all mails to first route through (including onmicrosoft.com domains).  You can do this by creating an inbound connector something like this:

New-InboundConnector –Name "Block delivery unless via MX record" -ConnectorType Partner -SenderDomains * -RestrictDomainsToCertificate $true -TlsSenderCertificateName <on-premises or 3rd party service certificate subject name>

Note that by creating a connector like this will cause NDRs to be generated for messages which are submitted directly to your tenant and don’t match the certificate name you provide above.  Certificate is always the preferred method.  Whether you end up using certificates or IP(s), if either certificate or IP(s) changes, you will reject good messages.

FAQ #4 – Can I use production domains for testing without risk?

If you create a tenant in Office 365/Azure and add production domains to the tenant, you need to be careful.  It is likely that your organization already sends email to many other Office 365 customers.  As such, real production email will be sent to Office 365 at some point.  As soon as you verify the domain, it is possible that mail will be associated with your test tenant, especially if there is an inbound connector inside your test tenant, or if the other party has a configuration issue that causes the mail to be attributed differently than they intend.

Put another way, we’ll start accepting mail for verified domains – unless you tell us not to accept or tell us to only accept conditionally.

FAQ #5(a) – Why does Office 365 allow spoofing?

First, SMTP is inherently not very secure.  It is also possible that someone else is spoofing the sender of the message – whether this spoofing is legitimate (like a bulk email service, a partner organization, 3rd party service, etc.) – or not (spam, phish, etc.).  While EOP does it’s best to protect you from the latter, we must be extremely careful not to block the legitimate messages.  This is no different than any other SMTP server, multi-tenant or not.  Very few email servers will outright block email at the SMTP level based on a spoofed MAIL FROM, because there are so many legitimate uses.

FAQ #5(b) – Is Office 365 more insecure because of this?

There are two main standards for detecting bad spoofing.  SPF based spoof detection isn’t the best method for a multi-tenant service and is certainly the weaker of the two.  We don’t typically use SPF alone to determine that mail is suspicious – it has proven too unreliable.  The other standard which we use, DKIM, is more secure.  We have some level of anti-spoofing by default using DKIM, and you can always make it better by publishing and using both DKIM and DMARC.  We have a Spoof Intelligence feature that uses our knowledge of mail flow patterns as the world’s largest email provider, and also using SPF, DKIM, and DMARC as inputs. 

When you use one (or both) of these standards to authorize Office 365 to send mail on your behalf, you are essentially saying that you trust us to prevent bad spoofing of your domain by other Office 365 customers.  Read through the links above to build your confidence that we do not take this trust lightly.

FAQ #6(a) – When does the hybrid wizard create an inbound connector with a wildcard in the TLSSenderCertificateName?

Most customers have been using certificates on-premises that take the form of <host>.<rootdomain>, for example, exchange.contoso.com.  However, exchange.contoso.com is not usually registered inside of the Office 365 tenant when the hybrid wizard is run. In order to make sure that mail works, we optimized the wizard to instead create the connector with *.contoso.com as the matching certificate. That way (a) the on-premises certificate matches and (b) the accepted domain (contoso.com) also matches. Hybrid wizard does tell you that it is going to do this.

FAQ #6(b) – I don’t want outbound email originating from my on-premises gateway going through my Office 365 tenant. How do I fix this?

Unfortunately, for customers with multiple tenants, or complicated outbound on-premises routing, having a wildcard match may be catching too much mail and attributing it all to the matching Office 365 tenant.  The simplest fix – if the hybrid wizard created the connector – is:

  • Figure out the specific certificate name utilized by Exchange on-premises (e.g. exchange.contoso.com).
  • Add & verify the Exchange certificate name (e.g. exchange.contoso.com) as an accepted domain inside of the correct Office 365 tenant.
  • Make sure that the on-premises gateway is utilizing a different certificate (e.g. mailgateway.contoso.com).
  • Re-run the hybrid wizard.  If you don’t want to re-run the hybrid wizard, then update the TlsSenderCertificateName on the inbound connector to match the exchange on-premises certificate only (e.g. exchange.contoso.com).

How does message attribution work?

So, back to the reason for the title of the post - when a message is sent to Office 365, the Front-end transport servers that receive the message need to determine if the message is originating (coming from a customer) or incoming (going to a customer).  In other words, is the current hop inside of contoso.com’s routing configuration or inside of tailspintoys.com?

Definitions

  • 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.

How Office 365 determines to which tenant a specific message belongs

This is the basic logic used.  This has been simplified to a small degree in order to cover the top scenarios and make it easier to understand.

Originating

  1. First, we check to see if the message is Originating. The service uses the following envelope information:
    • Certificate presented by the sending server or the Connecting IP
    • MailFrom domain
    • RcptTo domain
  2. The certificate name, or Subject Alternative Name (SAN) on the certificate, is used to lookup matching tenant Inbound connectors that are of type OnPremises across all tenants within the EOP forest.
  3. For all matched connectors we next look at which tenant has the TlsSenderCertificateName domain configured as an accepted domain. The most specific match will win.
    • If one is found the messages is attributed as Originating from that tenant.
  4. If no tenant matches were found, we next look at the Connecting IP and find all tenants with Inbound OnPremises connectors which match the IP.
    • For all matched connectors we next look at what tenant has the MailFrom domain configured as an accepted domain. If one is found the message is attributed as Originating from that tenant.

Incoming

  1. If the message has NOT been attributed as Originating, at this point the service assumes the message is coming to us either as MX routed or via relay smart host (we have no way of telling). We then lookup if the RcptTo matches an accepted domain in a tenant and attribute the message as Incoming to that tenant. We then look to see if the message matches any inbound partner connectors in that tenant, and if a match is made, the message is attributed to that connector. If no match is made, then the message arrives at that tenant through the default inbound connector.
    • If no tenant is found which has the recipient domain has a validated domain, the message will be rejected by the service.

So now you know how Office 365 Message Attribution works.

-Scott Landry, with contributions & feedback from many others, especially Bruce Wilson, Stan Aleksiev, Markus Dahlweid

4 Comments
Occasional Visitor

Command should be:

New-InboundConnector –Name "Block delivery unless via MX record" -ConnectorType Partner -SenderDomains * -RequireTls:$true -RestrictDomainsToCertificate:$true -TlsSenderCertificateName <on-premises or 3rd party service certificate subject name>

:smileyhappy: 

Well spotted. Fixed.

FAQ #2 - When setting up and inbound connector (for sending mail to both internal and external recipients), I remember it was important to have the IP address of the mail server in SPF, otherwise the mail would end up in spam - is that still a case when certificate is used?

Reference

Occasional Visitor