<?xml version="1.0" encoding="US-ASCII"?>

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC4271 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4271.xml">
<!ENTITY RFC4486 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4486.xml">
<!ENTITY RFC5226 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5226.xml">
<!ENTITY RFC5492 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5492.xml">
<!ENTITY RFC7908 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7908.xml">
<!ENTITY I-D.ietf-idr-route-leak-detection-mitigation SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.draft-ietf-idr-route-leak-detection-mitigation-04.xml">
<!ENTITY I-D.ietf-sidr-bgpsec-protocol SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.draft-ietf-sidr-bgpsec-protocol-18.xml">
]>

<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc strict="yes" ?>
<?rfc toc="yes"?>
<?rfc tocdepth="4"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>

<rfc category="std" docName="draft-ymbk-idr-bgp-open-policy-01" ipr="trust200902">
 <front>

   <title abbrev="Route Leak Detection and Filtering"> Route Leak Detection and Filtering using Roles in Update and Open messages </title>

   <author fullname="Alexander Azimov" initials="A"
           surname="Azimov">
     <organization>Qrator Labs</organization>
     <address>
       <email>aa@qrator.net</email>
     </address>
   </author>

   <author fullname="Eugene Bogomazov" initials="E"
           surname="Bogomazov">
     <organization>Qrator Labs</organization>
     <address>
       <email>eb@qrator.net</email>
     </address>
   </author>

   <author fullname="Randy Bush" initials="R"
           surname="Bush">
     <organization>Internet Initiative Japan</organization>
     <address>
       <email>randy@psg.com</email>
     </address>
   </author>

   <date year="2016"/>
   <area>Routing</area>

   <keyword>BGP</keyword>
   <keyword>Route leak</keyword>
   <keyword>BGP role</keyword>

   <abstract>
     <t>
       Route Leaks are propagation of BGP prefixes which violate
       assumptions of BGP topology relationships; e.g. passing a route
       learned from one peer to another peer or to a transit provider,
       passing a route learned from one transit provider to another
       transit provider or to a peer.  Today, approaches to leak
       prevention rely on marking routes according to some configuration
       options without any check of the configuration corresponds to
       that of the BGP neighbor, or enforcement that the two BGP
       speakers agree on the relationship.  This document enhances BGP
       Open to establish agreement of the (peer, customer, provider,
       internal) relationship of two BGP neighboring speakers to enforce
       appropriate configuration on both sides. Propagated routes are
       then marked with a eOTC and iOTC attributes according to agreed relationship allowing
       prevetion and detection of route leaks.
     </t>
   </abstract>

   <note title="Requirements Language">
     <t>
       The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
       "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" are to be
       interpreted as described in <xref target="RFC2119">RFC 2119</xref>
       only when they appear in all upper case.  They may also appear in lower
       or mixed case as English words, without normative meaning.
     </t>
   </note>
 </front>

 <middle>
   <section title="Introduction" anchor="intro">
     <t>
       For the purposes of this document BGP route leaks are when a BGP
       route was learned from transit provider or peer and is announced
       to another provider or peer.  See
       <xref target="RFC7908"/>.
       These are usually the result of misconfigured or absent BGP route
       filtering or lack of coordination between two BGP speakers.
     </t>

     <t>
       <xref target="I-D.ietf-idr-route-leak-detection-mitigation"/>
       describes a method of marking and detecting leaks which relies on
       operator maintained markings.  Unfortunately, in most cases, a
       leaking router will likely also be misconfigured to mark
       incorrectly.  The proposed mechanism provides an opportunity to
       detect route leaks made by third parties but provides no support
       to prevent route leak creation. The leak prevention still relies on
       communities which are optional and often missed due to mistakes
       or misunderstanding of the BGP configuration process.
     </t>

     <t>
       It has been suggested to use white list filtering, relying on
       knowing the prefixes in the customer cone as import filtering, in
       order to detect route leaks.  Unfortunately, a large number of
       incidents is created medium size transit operators use a single prefix list
       as only the ACL for export filtering, without community tagging
       and paying attention to the source of a learned route. So, if
       they learn a customer's route from their provider or peer - they
       will announce it in all directions, including other providers or
       peers.  This misconfiguration affects a limited number of
       prefixes; but such route leaks will obviously bypass customer
       cone import filtering made by upper level upstream providers.
     </t>
     <t>
       Also, route tagging which relies on operator maintained policy
       configuration is too easily and too often misconfigured.
     </t>

     <t>This document specifies a new BGP Capability Code,
     <xref target="RFC5492"></xref> Sec 4, which two BGP speakers MAY
     use to ensure that they MUST agree on their relationship;
     i.e. customer and provider or peers.  Either or both may optionally
     be configured to require that this option be exchanged for the BGP
     Open to succeed. </t>

     <t>
       Also this document specifies a way to mark routes according to
       BGP Roles and a way to create double-boundary filters for
       prevention and detection of route leaks via a two new BGP
       Path Attributes.
     </t>
   </section>

   <section anchor="bgp_role" title="BGP Role">
     <t>BGP Role is new mandatory configuration option which must be set per each address family. It reflects the
     real-world agreement between two BGP speakers about their business
     relationship.</t>

     <t>
       Allowed Role values are: <list style="symbols">
         <t>Provider - sender is a transit provider to neighbor;</t>
         <t>Customer - sender is customer of neighbor;</t>
         <t>Peer     - sender and neighbor are peers;</t>
         <t>Internal - sender is part of an internal AS of an
         organization which has multiple ASs, is a confederation, ...</t>
         <t>Complex  - sender has non-standard agreement and wants to use
         manual policies. </t>
       </list>
     </t>
     <t>
       Since BGP Role reflects the relationship between two BGP
       speakers, it could also be used for more than route leak
       mitigation.
     </t>
   </section>

   <section anchor="capability" title="Role capability">
     <t> The TLV (type, length, value) of the BGP Role capability
     are: <list style="symbols">
     <t> Type   - &lt;TBD1&gt;;</t>
     <t> Length - 1 (octet);</t>
     <t> Value - integer corresponding to speaker' BGP Role.</t>
     </list></t>
     <texttable anchor="values" title="Predefined BGP Role Values" suppress-title="false">
     <ttcol align="center"> Value </ttcol>
     <ttcol align="left"> Role name </ttcol>
     <c> 0   </c> <c> Undefined </c>
     <c> 1   </c> <c> Sender is Peer      </c>
     <c> 2   </c> <c> Sender is Provider  </c>
     <c> 3   </c> <c> Sender is Customer  </c>
     <c> 4   </c> <c> Sender is Internal  </c>
     <c> 5 </c> <c> Sender is Complex   </c>
     </texttable>

     </section>

   <section anchor="correctness" title="Role correctness">
     <t><xref target="bgp_role"/> described how BGP Role is a reflection
     of the relationship between two BGP speakers. But the mere presence
     of BGP Role doesn't automatically guarantee role agreement between
     two BGP peers.</t>

     <t>To enforce correctness, use the BGP Role check with a set
     of constrains on how speakers' BGP Roles MUST corresponded.  Of
     course, each speaker MUST announce and accept the BGP Role
     capability in the BGP OPEN message exchange.</t>

     <t>If a speaker receives a BGP Role capability, it SHOULD check
     value of the received capability with its own BGP Role. The allowed
     pairings are (first a sender's Role, second the receiver's
     Role):</t>
     <texttable anchor="allowed" title="Allowed Role Capabilities" suppress-title="false">
     <ttcol align="left"> Sender Role </ttcol>
     <ttcol align="left"> Receiver Role </ttcol>
     <c> Peer     </c> <c> Peer     </c>
     <c> Provider </c> <c> Customer </c>
     <c> Customer </c> <c> Provider </c>
     <c> Internal </c> <c> Internal </c>
     <c> Complex  </c> <c> Complex  </c>
     </texttable>
     <t> In all other cases speaker MUST send a Role Mismatch
     Notification (code 2, sub-code &lt;TBD2&gt;). </t>

     <section title="Strict mode" anchor="strict">
     <t>A new BGP configuration option "strict mode" is defined with
     values of true or false. If set to true, then the speaker MUST
     refuse to establish a BGP session with peers which do not announce
     BGP Role capability in their OPEN message. If a speaker rejects a
     connection, it MUST send a Connection Rejected Notification
     <xref target="RFC4486"/> (Notification with error code 6, subcode
     5).  By default strict mode SHOULD be set to false for backward
     compatibility with BGP speakers, that do not yet support this
     mechanism.</t>
    </section>
   </section>

   <section anchor="complex_role" title="Restrictions on the Complex role">
     <t>
       Complex role should be set only if relations between BGP neighbors
       could not be described using simple Customer/Provider/Peer roles. For a example,
       if neighbor is literal peer, but for some prefixes it provides full transit,
       complex role SHOULD be set on both sides. In this case configuration of
       detection and filtering mechanisms (<xref target="prevention_attribute" /> and
       <xref target="detection_attribute" />) should be set on per-prefix basis
       upon local policy.
     </t>
   </section>

   <section anchor="prevention_attribute" title="BGP Internal Only To Customer attribute">
     <t>
       The Internal Only To Customer (iOTC) attribute is a new optional,
       non-transitive BGP Path attribute with the Type Code &lt;TBD3&gt;.
       This attribute has zero length as it used only as a flag.
     </t>
     
     <t> There are two rules for setting the iOTC attribute:
       <list style="numbers">
         <t>
           The iOTC attribute MUST be added to all incoming routes if
           the receiver's Role is Customer or Peer;
         </t>
         <t>
           Routes with the iOTC attribute set MUST NOT be announced if
           the sender's Role is Customer or Peer;
         </t>
       </list>
       These two rules provide mechanism that prevent route leak creation by an AS.
       In case of Complex role usage the way of iOTC process is not automated
       and upon local policy.
       </t>
   </section>
   
   <section anchor="detection_attribute" title="BGP External Only To Customer attribute">
     <t>
       The External Only To Customer (eOTC) attribute is a new optional,
       transitive BGP Path attribute with the Type Code &lt;TBD4&gt;.
       This attribute has four bytes length and contain an AS number of AS,
       that added attribute to the route.
     </t>
       <t> There are two rules for setting the eOTC attribute:
       <list style="numbers">
         <t>
           If eOTC is not set and sender's Role is Provider or Peer
           the eOTC attribute MUST be added with value equal to its ASN.
         </t>
         <t>
           If eOTC is set, receiver's Role is Provider or Peer, and its value
           is not equal to neighbor ASN then such incoming route is route leak
           and MUST be given a lower local preference, or they MAY be dropped.
         </t>
       </list>
         These two rules provide mechanism for route leak detection that is made by
         some party in ASPath. In case of Complex role usage the way of eOTC process
         is not automated and upon local policy.
       </t>
   </section>

   <section anchor="security" title="Compatibility with BGPsec">
     <t>
       In BGPsec <xref target="I-D.ietf-sidr-bgpsec-protocol"></xref> enabled routers
       eOTC attribute MUST be turned into one bit of Flags field of Secure_Path Segment and
       MUST NOT be added as separate attribute.
     </t>
     <t>
       When route is transmitted from BGPsec enabled router to BGPsec disabled device,
       in addition to AS_PATH reconstruction MUST be performed eOTC attribute
       reconstruction. If corresponded bit was set in one of Secure_Path Segments,
       eOTC attribute SHOULD be added with value that equals to ASN in which segment it appears for the first time.
     </t>
   </section>
   

   <section anchor="considerations" title="Additional Considerations">
     <t>
       As BGP Role reflects the relationship between neighbors, it can
       also have other uses.  As an example, BGP Role might affect route
       priority, or be used to distinguish borders of a network if a
       network consists of multiple AS.
     </t>
     <t>Though such uses may be worthwhile, they are not the goal of
      this document.  Note that such uses would require local policy
      control.
     </t>
     <t>
       This document doesn't provide any security measures to check correctness
       of attributes usage in case of Complex role, so Complex role should be set with great caution.
     </t>
   </section>


   <section anchor="IANA" title="IANA Considerations">
     <t>This document defines a new Capability Codes option [to be
     removed upon publication:
     http://www.iana.org/assignments/capability-codes/capability-codes.xhtml]
     <xref target="RFC5492"/>, named "BGP Role", assigned value
     &lt;TBD1&gt; . The length of this capability is 1. </t>

     <t>The BGP Role capability includes a Value field, for which IANA
     is requested to create and maintain a new sub-registry called "BGP
     Role Value".  Assignments consist of Value and corresponding Role
     name.  Initially this registry is to be populated with the data in
     <xref target="values"/>.  Future assignments may be made by a
     standard action procedure <xref target="RFC5226"/>.</t>
     <t>
       This document defines new subcode, "Role Mismatch", assigned
       value &lt;TBD2&gt; in the OPEN Message Error subcodes registry
       [to be removed upon publication:
       http://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml#bgp-parameters-6]
       <xref target="RFC4271"/>.</t>
	 
     <t>
       This document defines a new optional, non-transitive BGP Path
       Attributes option, named "Internal Only To Customer", assigned value
       &lt;TBD3&gt; [To be removed upon publication:
       http://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml#bgp-parameters-2]
       <xref target="RFC4271"/>. The length of this attribute is 0.
     </t>
     <t>
       This document defines a new optional, transitive BGP Path
       Attributes option, named "External Only To Customer", assigned value
       &lt;TBD4&gt; [To be removed upon publication:
       http://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml#bgp-parameters-2]
       <xref target="RFC4271"/>. The length of this attribute is 4.
     </t>
   </section>

   <section anchor="Security" title="Security Considerations">
     <t> This document proposes a mechanism for prevention and detection of route leaks,
       that are the result of BGP policy misconfiguration. That includes
       preventing route leaks created inside an AS (company), and route
       leak detection, if a route was leaked by third party.</t>
     <t> Deliberate sending of a known conflicting BGP Role could be
       used to sabotage a BGP connection.  This is easily detectable.</t>
     <t> Deliberate mis-marking of the eOTC flag could be used to
       could affect BGP decision process but could not sabotage a route's propagation.</t>
     <t> BGP Role is disclosed only to an immediate BGP speaker, so it
       will not itself reveal any sensitive information to third
       parties. </t>
     <t> On the other hand, eOTC is a transitive BGP AS_PATH attribute
       which reveals a bit about a BGP speaker's business relationship.
       It will give a strong hint that some link isn't customer to
       provider, but will not help to distinguish if it is provider to
       customer or peer to peer.  If eOTC is BGPsec signed, it can not be
       removed for business confidentiality.</t>

   </section>
 </middle>

 <back>
   <references title="Normative References">
     &RFC2119;
     &RFC4271;
     &RFC4486;
     &RFC5492;
   </references>

   <references title="Informative References">
     &RFC5226;
     &RFC7908;
     &I-D.ietf-idr-route-leak-detection-mitigation;
     &I-D.ietf-sidr-bgpsec-protocol;
  </references>
 </back>
</rfc>


