<?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 RFC8126 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8126.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 RFC8174 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8174.xml">
<!ENTITY RFC8212 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8212.xml">

<!ENTITY I-D.ietf-grow-route-leak-detection-mitigation SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.ietf-grow-route-leak-detection-mitigation.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-ietf-idr-bgp-open-policy-15" ipr="trust200902">
  <front>
    <title abbrev="Route Leak Prevention">Route Leak Prevention using Roles in Update and Open messages</title>
    <author fullname="Alexander Azimov" initials="A." surname="Azimov">
      <organization>Qrator Labs &amp; Yandex</organization>
      <address>
        <postal>
          <street>Ulitsa Lva Tolstogo 16</street>
          <city>Moscow</city>
          <code>119021</code>
          <country>Russian Federation</country>
        </postal>
        <email>a.e.azimov@gmail.com</email>
      </address>
    </author>

    <author fullname="Eugene Bogomazov" initials="E." surname="Bogomazov">
      <organization>Qrator Labs</organization>
      <address>
        <postal>
          <street>1-y Magistralnyy tupik 5A</street>
          <city>Moscow</city>
          <code>123290</code>
          <country>Russian Federation</country>
        </postal>
        <email>eb@qrator.net</email>
      </address>
    </author>

    <author fullname="Randy Bush" initials="R." surname="Bush">
      <organization>Internet Initiative Japan &amp; Arrcus, Inc.</organization>
      <address>
        <postal>
          <street>5147 Crystal Springs</street>
          <city>Bainbridge Island</city>
          <region>Washington</region>
          <code>98110</code>
          <country>United States of America</country>
        </postal>
        <email>randy@psg.com</email>
      </address>
    </author>

    <author fullname="Keyur Patel" initials="K." surname="Patel">
      <organization>Arrcus</organization>
      <address>
        <postal>
          <street>2077 Gateway Place, Suite #400</street>
          <city>San Jose</city>
          <region>CA</region>
          <code>95119</code>
          <country>US</country>
          </postal>
        <email>keyur@arrcus.com</email>
      </address>
    </author>

    <author fullname="Kotikalapudi Sriram" initials="K." surname="Sriram">
      <organization abbrev="USA NIST">USA National Institute of Standards and Technology</organization>
      <address>
        <postal>
          <street>100 Bureau Drive</street>
          <city>Gaithersburg</city>
          <region>MD</region>
          <code>20899</code>
          <country>United States of America</country>
        </postal>
        <email>ksriram@nist.gov</email>
      </address>
    </author>


    <date/>

    <keyword>BGP</keyword>
    <keyword>Route leak</keyword>
    <keyword>BGP role</keyword>

    <abstract>
      <t>
        Route leaks are the propagation of BGP prefixes which violate assumptions of BGP topology relationships; e.g. passing a route learned from one lateral peer to another lateral peer or a transit provider, passing a route learned from one transit provider to another transit provider or a lateral peer.
        Existing approaches to leak prevention rely on marking routes by operator configuration, with no check that the configuration corresponds to that of the eBGP neighbor, or enforcement that the two eBGP speakers agree on the relationship.
        This document enhances BGP OPEN to establish agreement of the (peer, customer, provider, Route Server, Route Server client) relationship of two neighboring eBGP speakers to enforce appropriate configuration on both sides.
        Propagated routes are then marked with an Only to Customer (OTC) attribute according to the agreed relationship, allowing both prevention 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", "NOT RECOMMENDED", "MAY", and
	"OPTIONAL" in this  document are to be interpreted as described in
	BCP&nbsp;14 <xref target="RFC2119"/> <xref target="RFC8174"/> when,
	and only when, they appear in all capitals, as shown here.
      </t>
    </note>
  </front>

  <middle>

    <section title="Introduction" anchor="intro">
      <t>
        A BGP route leak occurs when a route is learned from a transit provider or lateral peer and then announced to another provider or lateral peer. See <xref target="RFC7908"/>.
        These are usually the result of misconfigured or absent BGP route filtering or lack of coordination between two eBGP speakers.
      </t>

      <t>
        The mechanism proposed in <xref target="I-D.ietf-grow-route-leak-detection-mitigation"/> uses large-communities to perform detection and mitigation of route leaks.
        While signaling using communities is easy to implement and deploy quickly, it normally relies on operator-maintained policy configuration, which is vulnerable to misconfiguration <xref target="Streibelt"/>.
        The community signal can also be stripped at the ISP boundaries.
      </t>

      <t>
        This document provides configuration automation using 'BGP roles', which are negotiated using a new BGP Capability Code in OPEN message (see Section 4 in <xref target="RFC5492"/>).
        Either or both BGP speakers MAY be configured to require that this capability be agreed for the BGP OPEN to succeed.
      </t>

      <t>
        A new optional, transitive BGP Path Attribute Only to Customer (OTC) is specified that SHOULD be automatically configured using BGP roles.
        This attribute prevents networks from creating leaks, and detects leaks created by third parties.
      </t>
      <t>
        In the rest of this document, we use the term "peer" to refer to "lateral peer" for simplicity.
      </t>
     </section>

    <section anchor="defs" title="Peering Relationships">
      <t>
        Despite the use of terms such as "customer", "peer", etc. in this document, these are not necessarily business relationships based on payment agreements.
        These terms are used to represent restrictions on BGP route propagation, sometimes known as the Gao-Rexford model <xref target="Gao"/>.
        The following is a list of various roles in eBGP peering and the corresponding rules for route propagation:
        <list style="hanging">
          <t hangText="Provider:">
            MAY send to a customer all available prefixes.
          </t>
          <t hangText="Customer:">
            MAY send to a provider prefixes which the sender originates and prefixes learned from any of their customers.
            A customer MUST NOT send to a provider prefixes learned from its peers, from other providers, or from Route Servers.
          </t>
          <t hangText="Route Server (RS):">
            MAY send to an Route Server client (RS-client) all available prefixes.
          </t>
          <t hangText="RS-client:">
            MAY send to an RS prefixes which the sender originates and prefixes learned from its customers.
            An RS-client MUST NOT send to an RS prefixes learned from its peers or providers, or from another RS.
          </t>
          <t hangText="Peer:">
            MAY send to a peer prefixes which the sender originates and prefixes learned from its customers.
            A peer MUST NOT send to a peer prefixes learned from other peers, from its providers, or from RS(s).
          </t>
        </list>
      </t>
      <t>
        Of course, any BGP speaker may apply policy to reduce what is announced, and a recipient may apply policy to reduce the set of routes they accept.
        Violation of the above rules may result in route leaks and MUST NOT be allowed.
        Automatic enforcement of these rules should significantly reduce route leaks that may otherwise occur due to manual configuration mistakes.
        While enforcing the above rules will address most BGP peering scenarios, their configuration is not part of BGP itself; therefore, configuration of ingress and egress prefix filters is still strongly advised.
      </t>
    </section>

    <section anchor="bgp_role" title="BGP Role">
      <t>
        BGP Role is a new configuration option that is configured on a per-session basis.
        BGP Roles reflect the agreement between two BGP speakers about their relationship.
        One of the Roles described below SHOULD be configured on each eBGP session between ISPs that carry IPv4 and(or) IPv6 unicast prefixes.
      </t>
      <t>
        Allowed Role values for eBGP sessions between ISPs are:
        <list style="symbols">
          <t>Provider - sender is a transit provider to neighbor;</t>
          <t>Customer - sender is a transit customer of neighbor;</t>
          <t>RS - sender is a Route Server, usually at an Internet exchange point (IX);</t>
          <t>RS-client - sender is client of an RS;</t>
          <t>Peer - sender and neighbor are peers.</t>
        </list>
      </t>
      <t>
        Since BGP Role reflects the relationship between two BGP speakers, it could also be used for other purposes besides route leak mitigation.
      </t>
    </section>

    <section anchor="capability" title="BGP 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 (byte);</t>
          <t>Value - integer corresponding to speaker's BGP Role (see <xref target="values"/>).</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>Sender is Provider</c>
        <c>1</c>
        <c>Sender is RS</c>
        <c>2</c>
        <c>Sender is RS-client</c>
        <c>3</c>
        <c>Sender is Customer</c>
        <c>4</c>
        <c>Sender is Peer</c>
      </texttable>

    </section>

    <section anchor="correctness" title="Role correctness">
      <t>
        <xref target="bgp_role"/> described how BGP Role encodes the relationship between two eBGP speakers.
        But the mere presence of BGP Role doesn't automatically guarantee role agreement between
        two BGP peers.
      </t>

      <t>
        To enforce correctness, the BGP Role check is applied with a set
        of constraints on how speakers' BGP Roles MUST correspond. 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 MUST check the
        value of the received capability (i.e., the sender's role) with its own BGP Role.
        The allowed pairings are as follows:
      </t>
      <texttable anchor="allowed" title="Allowed Pairs of Role Capabilities" suppress-title="false">
        <ttcol align="left">Sender's Role</ttcol>
        <ttcol align="left">Receiver's Role</ttcol>
        <c>Provider</c>
        <c>Customer</c>

        <c>Customer</c>
        <c>Provider</c>

        <c>RS</c>
        <c>RS-client</c>

        <c>RS-client</c>
        <c>RS</c>

        <c>Peer</c>
        <c>Peer</c>
      </texttable>
      <t>
        If the role of the receiving speaker for the eBGP session in consideration is included in <xref target="values"/> and the observed Role pair is not in the above table, then the receiving speaker MUST reject the eBGP connection, send a Role Mismatch Notification (code 2, subcode &lt;TBD2&gt;), and also send a Connection Rejected Notification <xref target="RFC4486"/> (Notification with error code 6, subcode 5).
      </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 a neighbor which does not announce the BGP Role capability in the OPEN message.
          If a speaker rejects a connection, it MUST send a send a Role Mismatch Notification (code 2, subcode &lt;TBD2&gt;), and also 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="prevention_attribute" title="BGP Only to Customer (OTC) Attribute">
      <t>
        Newly defined here, the Only to Customer (OTC) is an optional, 4 bytes long, transitive BGP Path attribute with the Type Code &lt;TBD3&gt;. 
        The purpose of this attribute is to guarantee that once a route is sent to customer, peer, or RS-client, it will subsequently go only to customers. The value of OTC is an AS number determined by policy as described below.
        The semantics and usage of the OTC attribute are made clear by the ingress and egress policies described below.
      </t>

      <t>
        The following ingress policy applies to the OTC attribute:
        <list style="numbers">
          <t>
            If a route with OTC attribute is received from a Customer or RS-client, then it is a route leak and MUST be rejected.
          </t>
          <t>
            If a route with OTC attribute is received from a Peer and its value is not equal to the sending neighbor's Autonomous System (AS) number, then it is a route leak and MUST be rejected.
          </t>
          <t>
            If a route is received from a Provider, Peer, or RS and the OTC attribute is not present, then it MUST be added with value equal to the sending neighbor's AS number.
          </t>
        </list>
      </t>

      <t>
        The egress policy MUST be:
        <list style="numbers">
          <t>
            A route with the OTC attribute set MUST NOT be sent to Providers, Peers, or RS(s).
          </t>
          <t>
            If route is sent to a Customer or Peer, or an RS-client (when the sender is an RS) and the OTC attribute is not present, then it MUST be added with value equal to AS number of the sender.
          </t>
        </list>
      </t>

      <t>
        Once the OTC attribute has been set, it MUST be preserved unchanged.
      </t>

    </section>

    <section anchor="attrs" title="Enforcement">
      <t>
        Having the relationship unequivocally agreed between the two peers in BGP OPEN is critical;
        BGP implementations MUST enforce the relationship/role establishment rules (see <xref target="correctness"/>) in order to ameliorate operator policy configuration errors (if any).
      </t>

      <t>Similarly, the application of that
        relationship on prefix propagation using OTC MUST be enforced by the
        BGP implementations, and not exposed to user misconfiguration. 
      </t>

      <t>As opposed to communities, BGP attributes may not be generally
        modified or stripped by the operator; BGP router implementations enforce such treatment.
        This is the desired property for the OTC marking. Hence, this
        document specifies OTC as an attribute.
      </t>
    </section>

    <section anchor="considerations" title="Additional Considerations">
      <t>
        There are peering relationships that are 'complex', i.e., both parties are intentionally sending prefixes received from each other to their non-transit peers and/or transit providers.
        If multiple BGP peerings can segregate the 'complex' parts of the relationship, the complex peering roles can be segregated into different normal BGP sessions, and BGP Roles MUST be used on each of the resulting normal (non-complex) BGP sessions.
      </t>

      <t>
        No Roles SHOULD be configured on a 'complex' BGP session (assuming it is not segregated) and in that case, OTC MUST be set by configuration on a per-prefix basis.
        However, there are no built-in measures to check correctness of OTC use if BGP Role is not configured.
      </t>

      <t>
        The incorrect setting of BGP Roles and/or OTC attributes may affect prefix propagation.
        Further, this document doesn't specify any special handling of incorrect/private ASNs in OTC attribute; such errors should not happen with proper configuration.
      </t>

      <t>
        As the BGP Role reflects the peering relationship between neighbors, it might have other uses beyond the route leak solution discussed so far.
        For example, BGP Role might affect route priority, or be used to distinguish borders of a network if a network consists of multiple ASs.
        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>
        The use of BGP Roles are specified for unicast IPv4 and IPv6 address families.
        While BGP roles can be configured on other address families its applicability for these cases is out of scope of this document.
      </t>

      <t>
        As BGP role configuration results in automatic creation of inbound/outbound filters, existence of roles should be treated as existence of Import and Export policy <xref target="RFC8212"/>.
      </t>
    </section>


    <section anchor="IANA" title="IANA Considerations">
      <t>This document defines a new Capability Codes option [to be
        removed upon publication: https://www.iana.org/assignments/capability-codes/capability-codes.xhtml ]
        <xref target="RFC5492"/>, named "BGP Role" with an 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 contained in <xref target="values"/> found in <xref target="capability"/>.
        Future assignments may be made by a Standard Action procedure <xref target="RFC8126"/>.
        The allocation policy for new entries up to and including value 127 is "Expert Review" <xref target="RFC8126"/>.
        The allocation policy for values 128 through 251 is "First Come First Served".
        The values from 252 through 255 are for "Experimental Use".
      </t>
      <t>
        This document defines a new subcode, "Role Mismatch" with an 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, transitive BGP Path
        Attributes option, named "Only to Customer (OTC)" with an 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 four bytes.
      </t>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>This document proposes a mechanism for prevention
        of route leaks that are the result of BGP policy
        misconfiguration.
      </t>

      <t>
        A misconfiguration in OTC setup may affect prefix propagation.
        But the automation that is provided by BGP roles should make such misconfiguration unlikely.
      </t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      &RFC2119;
      &RFC4271;
      &RFC4486;
      &RFC5492;
      &RFC8174;
    </references>

    <references title="Informative References">
      &RFC8126;
      &RFC7908;
      &RFC8212;
      &I-D.ietf-grow-route-leak-detection-mitigation;

      <reference anchor="Streibelt" target="https://people.mpi-inf.mpg.de/~fstreibelt/preprint/communities-imc2018.pdf">
        <front>
          <title>BGP Communities: Even more Worms in the Routing Can</title>
          <author initials="F." surname="Streibelt"/>
          <author initials="F." surname="Lichtblau"/>
          <author initials="R." surname="Beverly"/>
          <author initials="A." surname="Feldmann"/>
          <author initials="C." surname="Cristel"/>
          <author initials="G." surname="Smaragdakis"/>
          <author initials="R." surname="Bush"/>
          <date/>
        </front>
      </reference>
      <reference anchor="Gao" target="https://ieeexplore.ieee.org/document/974523">
        <front>
          <title>Stable Internet routing without global coordination</title>

          <author initials="L." surname="Gao">
          </author>
          <author initials="J." surname="Rexford">
          </author>

          <date month='December' year='2001' />
        </front>
        <seriesInfo name='' value='IEEE/ACM Transactions on Networking, Volume 9, Issue 6, pp 689-692, DOI 10.1109/90.974523' />
      </reference>

    </references>

    <section title="Acknowledgements" numbered="no">
      <t>
        The authors wish to thank Andrei Robachevsky, Daniel Ginsburg, Jeff Haas, Ruediger Volk, Pavel Lunin, Gyan Mishra, Ignas Bagdonas, Sue Hares, and John Scudder for comments, suggestions, and critique.
      </t>
    </section>
    <section title="Contributors" numbered="no">
      <figure><artwork><![CDATA[

Brian Dickson
Independent
Email: brian.peter.dickson@gmail.com

Doug Montgomery
USA National Institute of Standards and Technology
Email: dougm@nist.gov

      ]]></artwork></figure>

    </section>
  </back>
</rfc>


