<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc category="std" docName="draft-wang-bess-secservice-02" ipr="trust200902">
  <front>
    <title abbrev="">IPSec for BGP Enabled Services over SRv6</title>

    <author fullname="Haibo Wang" initials="H." surname="Wang">
      <organization>Huawei</organization>

      <address>
        <postal>
          <street/>

          <city>Beijing</city>

          <region/>

          <code/>

          <country>P.R. China</country>
        </postal>

        <phone/>

        <facsimile/>

        <email>rainsword.wang@huawei.com</email>

        <uri/>
      </address>
    </author>

    <author fullname="Linda Dunbar" initials="L." surname="Dunbar">
      <organization>Futurewei</organization>

      <address>
        <postal>
          <street/>

          <city/>

          <region/>

          <code/>

          <country/>
        </postal>

        <phone/>

        <facsimile/>

        <email>ldunbar@futurewei.com</email>

        <uri/>
      </address>
    </author>

    <author fullname="Cheng Sheng" initials="C." surname="Sheng">
      <organization>Huawei</organization>

      <address>
        <postal>
          <street/>

          <city>Beijing</city>

          <region/>

          <code/>

          <country>P.R. China</country>
        </postal>

        <phone/>

        <facsimile/>

        <email>shengcheng@huawei.com</email>

        <uri/>
      </address>
    </author>

    <author fullname="Hang Shi" initials="H." surname="Shi">
      <organization>Huawei</organization>

      <address>
        <postal>
          <street/>

          <city>Beijing</city>

          <region/>

          <code/>

          <country>P.R. China</country>
        </postal>

        <phone/>

        <facsimile/>

        <email>shihang9@huawei.com</email>

        <uri/>
      </address>
    </author>

    <date year="2024"/>

    <abstract>
      <t>This document describes an approach to encrypting selective user data flows using IPsec and then orchestrating the encrypted flows based on the SRv6 Policy path. The method is needed for some users or applications that demand an elevated level of security, necessitating the encryption of their data flows even within networks like SRv6, which are built and managed by Network Service Providers (NSP) and generally considered secure. Employing encryption for selective flows over NSP managed networks, including technologies like SRv6, adds an extra layer of protection, safeguarding valuable data from potential breaches and enhancing overall network security.</t>
    </abstract>

    <note 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">RFC 2119</xref>.</t>
    </note>
  </front>

  <middle>
    <section title="Introduction">
      <t>A Network Service Provider (NSP) managed SRv6 domain, designed to be restricted to authorized users, is often considered a trusted and secure domain (<xref target="RFC8754"/>, <xref target="RFC8402"/>, <xref target="RFC8986"/>). However, in certain cases, users or applications demand an elevated level of security, necessitating the encryption of their data flows even within NSP managed networks like SRv6. The need for such robust security measures arises from the sensitivity and confidentiality of the information being transmitted. By encrypting data flows within those networks, organizations can fortify their defenses against potential threats, ensuring that unauthorized access or tampering is thwarted. This heightened security posture becomes particularly crucial for entities handling sensitive data, such as financial institutions, government agencies, or organizations dealing with proprietary and classified information. Employing encryption over NSP managed networks, including technologies like SRv6, adds an extra layer of protection, safeguarding valuable data from potential breaches and enhancing overall network security.</t> 

      <t>This document describes an approach to encrypting selective user data flows using IPsec and then orchestrating the encrypted flows based on the SRv6 Policy path. This approach ensures that data is protected from unauthorized access or interception during transit while enabling flexible and efficient service orchestration. By leveraging the capabilities of SRv6, it is possible to create a highly dynamic and adaptable network environment that can meet the evolving needs of users and applications.</t>


    </section>

    <section title="Terminology">
      <t>SRv6: Segment Routing over IPv6</t>

      <t>ESP: Encapsulating Security Payload</t>

      <t>IPSec: Internet Protocol Security</t>

      <t>SA: Security Association</t>
    </section>

    <section title="Scenarios">
      <t><figure>
          <artwork><![CDATA[                +--+         +--+       +--+                  
               ,|P1|---------|P3|-------|P5|                  
              / +/-+         +/-+       +/-+\                 
             .`   |            |          |   `.             
VPN1_       /     |            |          |     .        ,VPN1
     '+---+/      |            |          |      \ +---+/     
      |PE1|\      |            |          |       '|PE2|      
     .+---+ \     |            |          |      / +---+-,VPN2
VPN2`.  /    \    |            |          |     /    /  .     
     |  |     \   |            |          |    /     |  |     
     |  |      \ +\-+         +\-+       +\-+ /      |  |     
     |  |       '|P2|---------|P4|-------|P6|/       |  |     
     |  |        +--+         +--+       +--+        |  |     
     |  |<------------------------------------------>|  |     
     |  |                SRv6 Policy                 |  |     
     \<------------------------------------------------>\     
                    VPN Over SRv6 Policy                      
]]></artwork>
        </figure>
		</t>
		<t> As illustrated in the preceding figure, the service route from PE1 to PE2 spans the backbone network. To attain the optimal service SLA, the utilization of SRv6 Policy becomes essential to orchestrate the service path. VPN1, due to its specific service requirements, demands heightened confidentiality.  Consequently, VPN1 packets must undergo encryption before traversing the path orchestrated by SRv6. This precautionary measure ensures the prevention of any potential leakage at intermediate nodes along the route. In contrast, VPN2 entails regular traffic without the necessity for additional encryption. </t>
    </section>

<section title = "Packet Header for Encrypted Payload via SRv6">
     <t>The placement of the SRv6 header [RFC8754] outside the IPsec ESP (Encapsulating Security Payload) [RFC4303] encrypted payload is crucial for the seamless traversal of packets through an SRv6 domain. Placing the SRv6 header outside the encrypted payload allows the SRv6 domain to process and manipulate routing information without compromising the integrity and confidentiality provided by IPsec ESP. As the SRv6 header contains routing instructions and segments that guide the packet through the network, its visibility to the SRv6 domain is essential for proper routing decisions. By keeping the SRv6 header unencrypted, the SRv6-enabled devices within the domain can interpret and apply segment routing policies accurately, ensuring efficient packet forwarding while maintaining the necessary security measures provided by IPsec ESP for the payload. This separation of concerns enables a harmonious integration of SRv6 and IPsec, optimizing both routing flexibility and security within the network.</t>

	<t>The following figure shows the encapsulated packet format:</t>

      <t><figure>
          <artwork align="center"><![CDATA[ 
 +-+-+-+-+-+-+-+-+-+-+-+-+            +-+-+-+-+-+-+-+-+-+-+-+-+
 |   Link MAC Header     |            |   Link MAC Header     |
 +-+-+-+-+-+-+-+-+-+-+-+-+            +-+-+-+-+-+-+-+-+-+-+-+-+
 |   Eth Type =  IPv6    |            |   Eth Type =  IPv6    |
 +-+-+-+-+-+-+-+-+-+-+-+-+            +-+-+-+-+-+-+-+-+-+-+-+-+
 |      IPv6 Header      |            |      IPv6 Header      |
 |     NextHeader=RH     |            |     NextHeader=RH     |
 +-----------------------+            +-----------------------+
 |      IPv6 EH          |            |     IPv6 EH(SRH)      |
 |NextHeader = IPv4/IPv6 |            |   NextHeader = ESP    |
 +-----------------------+            +-----------------------+
 |  User IPv4/6 Payload  |            |    ESP Header         |
 +-----------------------+            +-----------------------+
   Standard SRv6 Packet               |  User IPv4/6 Payload  |
                                      +-----------------------+
                                      |     ESP Trailer       |
                                      +-----------------------+
                                          ESP in SRv6 Packet   ]]></artwork>
        </figure></t>

</section>


<section title="Gap Analysis of the Existing Soluitons">
      <t>The BGP Tunnel Encapsulation Attribute defined in <xref
      target="RFC9012"/> can be advertised with service routes to indicate the properties of the tunnels that can carry the service routes. However, it is worth noting that [RFC9012] does not sufficiently address the integration of IPsec ESP with SRv6, especially regarding segment routing policies. Further analysis is required to determine the optimal approach to leverage the BGP Tunnel Encapsulation Attribute to advertise IPsec ESP-related parameters and the SRv6 SIDS information for the service routes.</t>

      <t>The <xref target="I-D.ietf-bess-secure-evpn"/> defines a methodology for advertising IPSec information for a service route to other PEs via BGP. The <xref target="I-D.ietf-bess-secure-evpn"/> introduces a new Tunnel Type, ESP-Transport, into the existing framework outlined in <xref target="RFC9012"/>. The Tunnel Type ESP-Transport indicates that the service routes should be encapsulated by VXLAN, with the associated IPsec parameters dictating the encryption of the VXLAN encapsulated payload. While this approach facilitates the continued use of VXLAN tunnels and ensures that IPsec ESP encrypts the entire VXLAN encapsulated payload, it is not be ideal for traversing the SRv6 domain. Encrypting the VXLAN encapsulated payload exclusively with IPsec ESP poses a challenge for service providers seeking to leverage SRv6 benefits while maintaining robust security measures. The SRv6 header contains routing instructions and segments that guide the packet through the SRv6 domain; its visibility to the SRv6 domain is essential for proper routing decisions.</t>
	  <t>There is a need for a new Tunnel Type to signify that services must be encrypted prior to the outer SRv6 encapsulation. This enhancement ensures compatibility with SRv6, safeguarding both the advantages of SRv6 and the security of user data.
       </t>
</section>
    <section anchor="Extension" title="BGP Extension">
      <t> This document introduces a new Tunnel Type referred to as ESP-Encrypted-Payload, within the framework of the Tunnel Encapsulation Attribute specified by [RFC9012]. The ESP-Encrypted-Payload Tunnel Type serves the purpose of explicitly specifying that data packets must undergo encryption using ESP Transport. Notably, it provides the flexibility for the Outer header to be integrated into an underlay network, such as SRv6. Pertinent Sub-TLVs associated with IPsec, as detailed in [I-D.ietf-idr-sdwan-edge-discovery], including IPsec SA Nonce, IPsec Public Key, and IPsec SA Proposal, can be appended under the ESP-Encrypted-Payload Tunnel Type. This document seamlessly inherits the IPsec sub-TLVs, ensuring the effective implementation of secure service encryption.</t>

      <t>When a service route includes extra information, such as the color and SRv6 SID (Segment Identifier), a process of iteration is required to direct the route towards an SRv6 Provider Edge (PE) or an SRv6 Policy. The selection of the specific route for this iteration is determined either by the local tunnel policy or explicitly specified by the Tunnel-Encap Extend Community</t>

 
    </section>

    <section anchor="Process Illustration" title="Process Illustration">
      <t>Let's take the scenario described in section 3 as an example.:</t>

      <t>1. PE1 obtains IPSec related parameters by configuration, from its management system, or via negotiation, including IPSec SA encryption algorithms, keying material, nonce, and security policies, etc..</t>

      <t>2. PE1 detects its attached VPN routes, such as EVPN Type 5 Prefix Routes or others.</t> 
	  
      <t> 3. PE1 adds a Tunnel-Encapsulation Attribute to the routes based on local
      policies. The Tunnel-Type parameter is ESP-Encrypted-Payload.</t>

      <t>4. PE1 obtains the VPN route and carries tunnel information, such as
      the VPN SID and Color Extended Community, based on the local policy.</t>

      <t>5. PE1 advertises the route to PE2 through RRs.</t>

      <t>6. After receiving the route advertised by PE1, PE2 performs IPSec
      key negotiation based on the ESP-Transport Tunnel-Encapsulation
      Attribute carried in the route and indicates that the route needs to be
      encrypted using IPSec.</t>

      <t>7. After PE2 receives the route advertised by PE1 and carries
      information such as the VPN ID and color, PE2 associates the route with
      the SRv6 tunnel.</t>

      <t>8. When PE2 receives the CE-side traffic that matches the route advertised
      by PE1. PE2 performs IPSec encryption based on the indicated IPSec
      sub-TLVs advertised by PE1, encapsulates the traffic into an SRv6 tunnel
      based on the indicated tunnel information, and sends the traffic to PE1
      along the tunnel information.</t>

      <t>9. After receiving the traffic from PE2, PE1 finds the corresponding
      VRF based on the SRv6 tunnel information and decrypts the packets to
      obtain the original user packet payload. Searches the VRF table and forwards traffic to the CE based on the user packet header.</t>
    </section>

    <section anchor="IANA" title="IANA Considerations">
      <t>Tunnel-Type ESP-Transport-Only-Payload needs to be allocated by
      IANA.</t>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>In this solution, the specified data packet is encrypted after being
      sent from the PE. This process ensures that even if an intermediate node
      obtains the related data packet, it is difficult to obtain the real
      content information. By implementing this encryption process, the
      security of the entire solution is significantly improved, providing
      better protection for high-security services such as finance.</t>
    </section>

    <section anchor="Acknowledgements" title="Acknowledgements">
      <t>NA</t>
    </section>

    <section title="Contributors">
      <t><figure>
          <artwork><![CDATA[Yulin Shi
Huawei
Email: shiyulin@huawei.com

Xiangfeng Ding
Huawei
Email: dingxiangfeng@huawei.com

Shunwan Zhuang
Huawei
Email: zhuangshunwan@huawei.com
]]></artwork>
        </figure></t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include="reference.RFC.2119"?>
    </references>

    <references title="References">
      <?rfc include="reference.RFC.8754"?>

      <?rfc include="reference.RFC.8402"?>

      <?rfc include="reference.RFC.8986"?>

      <?rfc include="reference.RFC.9012"?>

      <?rfc include="reference.I-D.ietf-bess-secure-evpn"?>

      <?rfc include="reference.I-D.ietf-idr-sdwan-edge-discovery"?>
    </references>
  </back>
</rfc>
