<?txt version="1.0" encoding="US-ASCII"?>
<!-- change the "txt" on the previous line to "xml" to make this a valid XML2RFC template --> 
<!-- this is version 5 of this xml2rfc template -->
<!--
    DOCTYPE processing

To use this XML template, the rfc2629.dtd from the xml2rfc distribution should 
be in the local directory. The xml2rfc distribution is available from 
http://xml.resource.org/

 The ENTITY clauses create an include of the named XML files, which
contains references written in xml2rfc format.

 XML2RFC offers an include feature described in the XML2RFC README
  file.  That syntax, however, contradicts the DTD requirements to
  have <reference> elements within the <references> element, so an 
  XML parser is likely to find your XML file invalid.  It may be
  possible that XML2RFC will change their DTD so that the XML file
  remains valid when their style of include is used.

Some editors, such as XXE, resolve the ENTITY clauses before displaying the 
document to be edited.
-->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY rfc2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC6125 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6125.xml">
<!ENTITY RFC5246 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5246.xml">
<!ENTITY RFC2818 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2818.xml">
<!ENTITY RFC2595 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2595.xml">
<!ENTITY RFC3207 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3207.xml">
<!ENTITY RFC6698 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6698.xml">
<!ENTITY RFC5321 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5321.xml">
]>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc strict="no"?>
<?rfc rfcedstyle="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>

<!-- Document  section 

Specify the category attribute per RFC2026 
options are info, std, bcp, or exp. 

docname is the name of the output document. This is optional;
the default is to use the base portion of the XML filename. 

For Internet-drafts, indicate which intellectual property notice 
to use per the rules of RFC3978. The value (as of this template) can be:
    trust200902 -
    noModificationTrust200902 -
    noDerivativesTrust200902 -
    pre5378Trust200902 -

 The Intellectual Property section will be generated automatically by
  XML2RFC, based on the ipr attribute in the rfc element.

If this document obsoletes an RFC, specify the RFC in the "obsoletes" attribute
If this document updates an RFC, specify the RFC in the "updates" attribute
-->
<rfc category="std" docName="draft-friedl-uta-smtp-mta-certs-00" ipr="trust200902">
  <front>
    <!--
Enter the full document title and an abbreviated version
  to use in the page header.
-->

    <title abbrev="SMTP MTA TLS  Identity Verification">TLS Certificate Identity Verification Procedure for SMTP MTA to MTA Connections</title>

    <!-- copy the author block as many times as needed, one for each author.-->

    <!-- If the author is acting as editor, use the <role=editor> attribute-->

    <!-- see RFC2223 for guidelines regarding author names -->

<author fullname="Stephan Friedl" initials="S.F."
            surname="Friedl">
      <organization>Cisco Systems, Inc.</organization>

      <address>
        <postal>
          <street>170 West Tasman Drive</street>

          <!-- Reorder these if your country does things differently -->

          <city>San Jose</city>

          <region>CA</region>

          <code>95134</code>

          <country>USA</country>
        </postal>

        <phone>(720)562-6785</phone>

        <email>sfriedl@cisco.com</email>

        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>

    <author fullname="Tom Kaupe" initials="T.K."
            surname="Kaupe">
      <organization>Microsoft Corp.</organization>

      <address>
        <postal>
          <street>One Microsoft Way</street>
          <city>Redmond</city>
          <region>WA</region>
          <code>98052</code>
          <country>USA</country>
        </postal>

        <email>Tom.Kaupe@microsoft.com</email>

        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>


<author fullname="Sriram Gorti" initials="S.G."
            surname="Gorti">
      <organization>Cisco Systems, Inc.</organization>

      <address>
        <postal>
          <street>170 West Tasman Drive</street>

          <!-- Reorder these if your country does things differently -->

          <city>San Jose</city>

          <region>CA</region>

          <code>95134</code>

          <country>USA</country>
        </postal>

        <phone>+91 80 4365 7100</phone>

        <email>sgorti@cisco.com</email>

        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>



    <!-- month and day will be generated automatically by XML2RFC; 
be sure the year is current.-->

    <date  year="2014" />

    <!-- IETF area is optional -->

    <area>General</area>

    <!--WG name at the upperleft corner of the doc, 
IETF is fine for non-WG IETF submissions -->

    <workgroup>Using TLS in Applications</workgroup>

   <keyword>draft</keyword>

    <!--add additional keywords here for IETF website search engine -->
<abstract>

<t> 
This document describes TLS server identity verification procedure for Message Transfer Agent (MTA) to Message Transfer Agent connections in an SMTP email network, 
with specific guidance
 on identity verification steps associated with delegated email services.  This document is intended to supplement the identify verification
procedures described in  <xref target="RFC6125"/>.
</t>

 
</abstract>
  
   </front>

  <middle>
    <section title="Introduction">

      <t>The TLS security protocol <xref target="RFC5246"/> is typically used to encapsulate application protocols to provide privacy, 
      data integrity and server identity verification between two application servers which would otherwise be conducting their communication 
      in plain text over potentially insecure network links.  There are two layers:</t>

      <t>
      <list style="symbols">
      <t>The TLS Record protocol provides for private communication and message integrity using negotiated encryption and hashing algorithms.</t>
      <t>The TLS Handshake protocol provides for secure and reliable sharing of secrets used for encryption, together with identification and authentication of one or both peers.</t>
      </list>
      </t>

      <t>
      There are various RFCs, such as  <xref target="RFC6125"/> which describe TLS in the context of more general domain based applications, 
      with the canonical example being a user-agent (e.g. browser) securely accessing content on a server (e.g. web server) <xref target="RFC2818"/>.  
      RFCs also describe TLS in the more specific context of SMTP, however these RFCs focus on a user-agent (e.g. mobile or PC mail client) submitting email to a mail server using the STARTTLS SMTP extension<xref target="RFC2595"/> <xref target="RFC3207"/>.  
      No RFCs explicitly describe TLS in the context of SMTP communication between two MTAs in an email network.  There exist sufficient differences in the MTA-to-MTA scenario, particularly with respect to server identification, which warrant an explicit set of recommendations.  
      This document discusses various strategies that a sending MTA can use for the identification and authentication of a destination MTA when transferring a message within an email network.
      It should be noted that an email network could be defined with MTA to Message Delivery Agent (MDA) connections, in which case the same verification and authentication rules 
      should apply to the MTA to MDA scenario.
      </t>
   </section>


     <section title="Requirements Language">
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
      "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
      document are to be interpreted as described in <xref target="RFC2119"/>.
      </t>
    </section>


    <section title="Terminology">
    	<t>
		<list style="symbols">
			<t>Email Domain: @example.net, found in the <xref target="RFC5321"/> domain section of the RCPT TO command forward path</t>
			<t>Email Server Hostname: mail.example.net</t>
			<t>Email Server IP Address: the IP address (or addresses) for the email server.</t>
			<t>MX Record: A type of DNS record that associates an email domain to one or more email server hostnames.  
			@example.net --> mail1.example.net, mail2.example.net.</t>
			<t>MTA (Message Transfer Agent).  An application that sends messages on behalf of one or more 
			users to a destination email server over SMTP.  The destination email server will also be an MTA or a Message Delivery Agent (MDA) though
			this document will discuss MTA to MTA connections as the difference between MTA to MTA and MTA to MDA connections is immaterial with regard to TLS
			verification and authentication.</t>
			<t>Self-Hosting: The owner of the email domain also owns and manages the email server.  
			In this case, it’s common for the email server host name to be rooted to the email domain (e.g. @example.net --> mail.example.net), but it’s not required.  
			Many organizations have multiple email domains (e.g. @example.net, @sales.example.net, @ejemplo.es) all self-hosted on a shared email server 
			(e.g. mail.example.net).</t>
			<t>Delegated Hosting: The owner of the email domain does not own or manage the email server.   
			Typically, a third-party owns and manages an email server for a multiplicity of Email Domain owners.  
			Delegation is achieved through the MX record (e.g. @example.net --> mail.delegatedexample.net).</t>
			<t>Reference Identity:  An instance of a reference identifier, constructed from a source domain and optionally a service type, 
			used by the client for matching purposes when examining presented identifiers <xref target="RFC6125"/>.</t>
			<t>Presented Identity:  An instance of a presented identifier that is presented by a server to a client within a PKIX certificate 
			when the client attempts to establish secure communication with the server; the certificate can include one or more presented identifiers of different types, 
			and if the server hosts more than one domain then the certificate might present distinct identifiers for each domain <xref target="RFC6125"/>.</t>
	   	</list>
   	</t>
    </section>

    <section title="Procedure for TLS Server Identity Verification for MTA to Email Server Connections">

    <section title="Server Identification and Validation">
	<t>Two fundamental aspects govern how an MTA validates the identity of an email server when establishing a TLS session:</t>
	<t>
		<list style="symbols">
			<t>How the reference identity of the server is determined</t>
			<t>How the presented identity of the server is validated against the reference identity</t>
		</list>
	</t>
	<t>The destination MTA identity is verified through a process of ordered comparison of reference and presented identity pairs in conformance to the rules defined in <xref target="RFC6125"/>.</t>
	
	
      <section title="Reference Identity">
      <t>In the case of an MTA, the reference identity of the destination email server is typically expressed via the MX record for the recipient email domain.  
      A user addresses email to a recipient at a specific email domain (e.g. recipient@example.net) and the MTA then performs a DNS MX query using the <xref target="RFC5321"/> domain section of the RCPT TO command forward path to determine
       the email server hostname 
(e.g. mail.example.net) for the recipient email domain.  It is important to note that the email server name will not necessarily 
       be a subdomain of the recipient email domain; this will never be the case with delegated email hosting.</t>
      </section>

    <section title="Presented Identity">
    <t>The server presented identity SHOULD be a SubjectAltName (SAN) of type DNSName 
    of a X.509 public key certificate.  In keeping with <xref target="RFC6125"/>, SAN entries SHOULD be used for the 
    presented identity, but the CN entry of a X.509 public key certificate MAY be used for backwards compatibility with deployed infrastructure 
    if no SAN entries exist in the certificate.</t>
    </section>
  
     <section title="Wildcards">
  <t><xref target="RFC6125"/> recommends deprecating support for SAN entries that include wildcards for two primary reasons: (1) the lack of clarity in existing specification
  as to the allowable locations of wildcard characters and (2) the fact that a wildcard SAN entries vouches for all servers in a domain, including possibly rogue or buggy servers.  
  In the case of MTA to delegated email service connections, this document proposes continued support for DNSNames containing wildcards as wildcard DNSNames are
  needed to support some
 delegated email hosting scenarios.</t>
         <t>For delegated hosting, some third parties may use the same email server hostname(s) for all the domains that they host:</t>
        
       <t>
       <list style="symbol">
      	 <t>@example1.net --> mail.delegatedexample.net</t>
      	 <t>@example2.net --> mail.delegatedexample.net</t>
       </list>
       </t>
       
       <t>Alternatively, a third party email service might use a unique hostname for each email domain:</t>
       <t>
       <list style="symbol">
	<t>@example1.net --> example1net.mail.delegatedexample.net</t>
	<t>@example2.net --> example2net.mail.delegatedexample.net</t>
       </list>
       </t>
       
       <t>If unique hostnames are associated with each email domain, then there will be as many host names as email domains and it will not be possible 
       to include all hostnames as SAN DNSName entries in a certificate.  Wildcarded SAN entries would then be the only mechanism by which a single certificate may be used for all email server 
       hostname reference identities.  If all the email server hostnames are of the form [domainidentifier].[hostnameroot] (e.g. example1net.mail.delegatedexample.net), 
       then the SAN SHOULD include a DNSName
 entry of the form *.[hostnameroot] (e.g. *.mail.delegatedexample.net).  
       The email server certificate SHOULD NOT include a wildcard character in the presented
 identity in any position other than the left-most label.</t>
     </section>

  
      <section title="Server Identity Validation">
      <t>Validation of the server identity entails a comparison of the reference identity to the identity presented in the server certificate.  
      There are several approaches for validation, given the various reference identifiers that may be used and the fundamental difference between the 
      self-hosted and delegated hosting models.</t>

  
  
<section title="Determination of Reference Identity">
  <t>
The reference identity for an email server SHOULD be determined using the following methods:</t>
  
      	<t>
  
      	<list style="symbol">
	  	<t>1. The <xref target="RFC5321"/> domain section of the RCPT TO command forward path</t>
		<t>2. The email server hostname explicitly configured in the MTA by an administrator.</t>
		<t>3. The email server hostname derived via a DNS/MX query against the email domain name determined as the <xref target="RFC5321"/> domain section of the RCPT TO command forward path.</t>
	</list>
   
      	</t>
 
</section>
  
      <section title="Exact Match Between SAN and Reference Identity">
      <t>An MTA SHOULD validate an email server identity when an exact match exists between the presented identity as a SAN DNSName entry in the email server's certificate 
      and the email server's reference identity. 
      </t>
      </section>
      
       <section title="Wildcard Match Between SAN and Reference Identity">
       <t>An MTA SHOULD validate an email server identity when a <xref target="RFC6125"/> Section 6.4.3 compliant wildcard match exists between the presented
        identity as a SAN DNSName entry with wildcards in the email server's
 certificate and the email server's reference identity.</t>

    </section>
    
          <section title="Exact Match Between CN and Reference Identity">
      <t>For backward compatibility, if no SAN DNSName entries exist in an email server's certificate but a CN entry exists then an MTA SHOULD validate an email server identity if an exact match exists between the CN and the 
      email server's reference identity.</t>
      </section>

       <section title="Wildcard Match Between CN and Reference Identity">
      <t>For backward compatibility,  if no SAN DNSName entries exist in an email server's certificate but a CN entry exists then an MTA SHOULD validate an email server identity when a <xref target="RFC6125"/> Section 6.4.3 
      compliant wildcard match exists between the presented identity as a CN entry with wildcards in the email server's
 certificate and the email server's reference identity.</t>
    </section>


          <section title="Matching Process">
      <t>The order of evaluation of the different methods for an MTA to validate and email server identity are important and an MTA SHOULD use the following ordering of matching tests:
 
      	</t>
  
      	          <section title="SAN Present">
  
      	          <t>If one or more SAN DNSName entries are present in the email server's certificate the following matching tests SHOULD be used in the order specified:
  
      	          </t>
  
      	          
 
      	<t>
 
      	<list style="number">
	  	<t>1. Exact match of SAN entry to <xref target="RFC5321"/> domain section of the RCPT TO command forward path</t>
	  	<t>2. Wildcard match of SAN entry to <xref target="RFC5321"/> domain section of the RCPT TO command forward path</t>
		<t>3. Exact match of SAN entry to email server hostname explicitly configured in the MTA by an administrator.</t>
		<t>4. Wildcard match of SAN entry to email server hostname explicitly configured in the MTA by an administrator.</t>
		<t>5. Exact match of SAN entry email server hostname derived via a DNS/MX query against the <xref target="RFC5321"/> domain section of the RCPT TO command forward path.</t>
		<t>6. Wildcard match of SAN entry email server hostname derived via a DNS/MX query against the <xref target="RFC5321"/> domain section of the RCPT TO command forward path.</t>
	</list>
	</t>
	  
      	   <t>If one or more SAN DNSName entries are present in the email server's certificate and none of the matching tests specified above pass, then the 
	  
      	   MTA will have failed to validate the email server's identity. and the MTA SHOULD log an error indicating that the validation process failed.
  
      	          </t>
  
      		</section>
 
   
      	          <section title="No SAN Entries Present but a CN Entry is Present">
  
      	          <t>An MTA MUST NOT validate an email server identity against the CN entry of an email server's certificate if there exist one or more SAN DNSName entries in the certificate.
  
      	            If and only if no SAN DNSName entries exist in the email server certificate and a CN is present in the email server's certificate the same matching process detailed in 4.1.4.6.1 above MUST 
      	            be used with the CN as the presented identity instead of the SAN.
  
      	          </t>
  
      		</section>

      </section>

    </section>

    </section>
    
     </section>

   
    <section title="Security Considerations">
<t>
This document addresses only the procedure by which an MTA should verify the identity of an email server with which it wishes to establish a TLS connection.
The procedures described in this document do nothing to address or ameliorate the fundamental security risk associated with obtaining an email server name
through an insecure MX query.  In the abscence of DNSSEC there exist a large number of techniques whereby a false email server name could be returned
to the MTA through an insecure MX query.
  It should be noted that in the absence of DNSSEC, the MX query is no more risk prone than a browser A lookup. 
Use of TLS eliminates risks of passive listening and imposes a requirement that an attacker to obtain a certificate that will be trusted by the sending MTA and actively participate
in the session by terminating the TLS session requested by the sending MTA.
</t>
<t>
Risks associated with insecure DNS MX lookups may be ameliorated by explicit association of the email server name to an email domain in the MTA configuration.
</t>
    </section>

    <section title="IANA Considerations">

      <t>This document includes no request to IANA.</t>
    </section>

    <!-- The Author's Addresses section will be generated automatically by XML2RFC 
    from the front information. -->

    <section title="Acknowledgements">
     <t>Thanks to Dan Wing for multiple reviews of this draft and valuable suggestions for improving it.
     </t>
    </section>
  </middle>

  <back>

   
    <references title="Normative References">

      &rfc2119;

      &RFC6125;

      &RFC5246;

      &RFC2818;
      
      &RFC5321;

      
      &RFC2595;
  
      &RFC3207;
  
      &RFC6698;

    </references>

<!--
    <references title="Informative References">


	<?rfc include="reference.I-D.draft-melnikov-email-tls-certs.xml"?>
    </references>
-->
    
  </back>
</rfc>
