<?xml version="1.0" encoding="US-ASCII"?>
<?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-ietf-bfd-optimizing-authentication-14"
    ipr="trust200902"
    updates="5880"
    submissionType="IETF"
    consensus="true">
  <front>
    <title abbrev="BFD Authentication Optimization">Optimizing BFD
    Authentication</title>

    <author fullname="Mahesh Jethanandani" initials="M."
            surname="Jethanandani">
      <organization>Kloud Services</organization>
      <address>
        <postal>
          <street/>
          <city/>
          <region/>
          <code/>
          <country>USA</country>
        </postal>
        <phone/>
        <facsimile/>
        <email>mjethanandani@gmail.com</email>
        <uri/>
      </address>
    </author>

    <author fullname="Ashesh Mishra" initials="A" surname="Mishra">
      <organization>Aalyria Technologies</organization>
      <address>
        <postal>
          <street/>
          <city/>
          <region/>
          <code/>
          <country/>
        </postal>
        <phone/>
        <email>ashesh@aalyria.com</email>
      </address>
    </author>

    <author fullname="Ankur Saxena" initials="A" surname="Saxena">
      <organization>Ciena Corporation</organization>
      <address>
        <postal>
          <street>3939 N 1st Street</street>
          <city>San Jose</city>
          <region>CA</region>
          <code>95134</code>
          <country>USA</country>
        </postal>
        <phone/>
        <facsimile/>
        <email>ankurpsaxena@gmail.com</email>
        <uri/>
      </address>
    </author>

    <author fullname="Manav Bhatia " initials="M." surname="Bhatia ">
      <organization>Google</organization>
      <address>
        <postal>
          <street>Doddanekkundi</street>
          <city>Bangalore</city>
          <code>560048</code>
          <country>India</country>
	</postal>
        <email>mnvbhatia@google.com</email>
      </address>
    </author>

    <date/>
    <keyword>BFD</keyword>
    <keyword>authentication</keyword>

    <abstract>
      <t>This document describes an optimization to BFD Authentication as
      described in Section 6.7 of BFD RFC 5880. This document updates RFC
      5880.</t>
    </abstract>
  </front>

  <middle>
    <section anchor="introduction" title="Introduction">
      <t>Authenticating every <xref target="RFC5880">BFD</xref> control packet
      with <xref target="RFC1321">MD5
      Message-Digest Algorithm </xref>, or Secure Hash Algorithm (SHA-1)
      is a computationally intensive process. This makes it
      difficult, if not impossible to authenticate every packet - particularly
      at faster rates. Also, the recent escalating series of attacks on MD5
      and SHA-1 described in <xref target="SHA-1-attack1">Finding Collisions
      in the Full SHA-1 </xref> and <xref target="SHA-1-attack2">New Collision
      Search for SHA-1 </xref> raise concerns about their remaining useful
      lifetime as outlined in <xref target="RFC6151">Updated Security
      Considerations for the MD5 Message-Digest and the HMAC-MD5 Algorithm
      </xref> and <xref target="RFC6194">Security Considerations for the SHA-0
      and SHA-1 Message-Digest Algorithm </xref>. If replaced by stronger
      algorithms, the computational overhead, will make the task of
      authenticating every packet even more difficult to achieve.</t>

      <t>
	This document proposes that BFD control packets that signal a
	state change, a demand mode change (to D bit), a poll sequence
	change (P or F bit change) be categorized as a significant
	change. Control packets that do not require a poll sequence,
	such as bfd.RequiredMinRxInterval or
	bfd.RequiredMinTxInterval, are also considered as a
	significant change. In other words, the contents of an Up
	packet MUST NOT change aside from the authentication section
	without stronger authentication to take advantage of the
	method described in this document.
      </t>

      <t>In the Up state, most packets that are transmitted and received have no state change
      associated with them. Limiting authentication to packets that affect a
      BFD session's state allows more sessions to be supported with this
      optimized method of authentication.</t>

      <t>
	Once the session has reached the Up state, the session can
	choose the Auth Type to be one of:

	<ul>
	  <li>
	    No authentication, i.e., Authentication Present (A-bit) is
	    zero. Having no authentication provides computational
	    relief to the system. However, a malicious user can
	    blindly inject traffic that will be accepted by the BFD
	    session.
	  </li>
	  <li>
	    <xref target="null-auth-type">NULL Auth Type</xref> as
	    defined in this document. This type prevents blind
	    injection, but is vulnerable to active attacks, where the
	    attacker is aware of the sequence number, and potentially
	    becomes the PITM. However, periodic check with stronger
	    authentication can thwart that attack as described below.
	  </li>
	  <li>
	    Meticulous Keyed ISAAC authentication as described in
	    <xref target="I-D.ietf-bfd-secure-sequence-numbers">Secure
	    BFD Sequence Numbers</xref>. This authentication type
	    prevents the attack when the Up packets do not change,
	    because only the paired devices know the shared secret,
	    key, and sequence number to select the ISAAC result.
	  </li>
	</ul>
      </t>

      <t>
	To detect a Person In the Middle (PITM) attack when the
	session is in Up state, implementations have two options. They
	can choose to use:
	<ul>
	  <li>
	    Test periodic strong authentication using a Poll
	    sequence. To perform a strong authentication, a Poll
	    sequence SHOULD be initiated by the sender. If a Fin is
	    not received within the Detect Interval, the session has
	    been compromised, and should be brought down. The interval
	    for initiating a Poll sequence can be configured depending
	    on the capability of the system.
	  </li>
	  <li>
	    Meticulous Keyed ISAAC as defined in <xref
	    target="I-D.ietf-bfd-secure-sequence-numbers">Securing BFD
	    Sequence Numbers</xref>.
	  </li>
	</ul>
      </t>

      <t>
	Most packets transmitted on a BFD session are BFD Up packets.
	Authenticating a small subset of these packets with a Poll
	sequence as described above, for example every one minute,
	significantly reduces the computational demand for the system
	while maintaining security of the session across the
	configured interval.
      </t>

      <t>The rest of this document is structured as follows: Section 2 talks
      about the changes to authentication mode as described in <xref
      target="RFC5880">BFD</xref>. Section 3 goes into the details of the new
      Authentication Type.</t>

      <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">BCP 14</xref> <xref target="RFC8174"/> when, and only
        when, they appear in all capitals, as shown here.</t>
      </section>

      <section anchor="note-to-rfc-editor" title="Note to RFC Editor">
        <t>
	  This document uses several placeholder values throughout the
	  document. Please replace them as follows and remove this
	  note before publication.
	</t>

        <t>
	  RFC XXXX, where XXXX is the number assigned to this document
	  at the time of publication.
	</t>

        <t>
	  2024-02-05 with the actual date of the publication of this
	  document.
	</t>
      </section>

      <section title="Terminology">
        <t>The following terms used in this document have been defined in
        <xref target="RFC5880">BFD</xref>.</t>

        <t><list style="symbols">
            <t>Detect Multiplier</t>

            <t>Detection Time</t>
          </list></t>

        <t>The following terms are introduced in this document.</t>

        <texttable style="full">
          <ttcol>Term</ttcol>
          <ttcol>Meaning</ttcol>
          <c>significant change</c>
          <c>
	    State change, a demand mode change (to D bit) or a poll
	    sequence change (P or F bit). Control packets that do not
	    require a poll sequence, such as bfd.RequiredMinRxInterval
	    bfd.RequiredMinTxInterval, or bfd.DetectMult are also
	    considered as a significant change.
	  </c>
          <c>configured interval</c>
          <c>
	    Interval at which BFD control packets are retried with a
	    stronger authentication.
	  </c>
        </texttable>
      </section>
    </section>

    <section title="Authentication Mode  ">
      <t>The cryptographic authentication mechanisms specified in <xref
      target="RFC5880">BFD</xref> describes enabling and disabling of
      authentication as a one time operation. As a security precaution, it
      mentions that authentication state be allowed to change at most once.
      Once enabled, every packet must have Authentication Bit set and the
      associated Authentication Type appended. In addition, it states that an
      implementation SHOULD NOT allow the authentication state to be changed
      based on the receipt of a BFD control packet.</t>

      <t>This document proposes that the authentication mode be modified to be
      enabled on demand. Instead of authenticating every packet, BFD peers are
      configured for which packets need to be authenticated, and authenticate
      only those packets. The remaining packets MAY be transmitted and received
      without authentication, or use a less expensive authentication.
      For example, the two ends can be configured such
      that BFD control packets that indicate a significant change should be
      authenticated and enable authentication on those packets only. If the
      two ends have previously been configured as such, but at least one side
      decides not to authenticate a significant change packet, then the BFD
      session will fail to come up.</t>

      <t>
	The proposal outlines which BFD control packets are required
	to be authenticated. A BFD control packet that fails
	authentication is discarded, or a BFD control packet that was
	supposed to be authenticated, but was not; e.g. a significant
	change packet, is discarded. However, there is no change to
	the state machine for BFD, as the decision of a significant
	change is still decided by how many valid consecutive packets
	were received, authenticated or otherwise.
      </t>

      <t>
	The following table summarizes when the Auth Type should be
	set with a Auth or a OPT authentication type.  The table
	should be read with the column indicating the BFD state the
	receiver is currently in, and the row indicating the BFD state
	the receiver might transition to based on the BFD control
	packet received.  The intersection of the two indicates
	whether the received BFD control packet should have the
	Auth Type set to either Auth, or OPT.  The BFD state
	refers to the states in BFD state machine described in Section
	6.2 of <xref target="RFC5880">BFD</xref>.
      </t>

      <t>
	<figure align="center" title="Optimized Authentication Map">
          <artwork>
	    <![CDATA[
       Read   : On state change from <column> to <row>
       Auth   : Strongly authenticated BFD control packet
       OPT    : Any or no authentication, as configured.
       n/a    : Invalid state transition.
       Select : Most packets OPT AUTH. Selective (periodic) 
                packets authenticated.
      +--------+--------+--------+--------+
      |        | DOWN   | INIT   | UP     |
      +--------+--------+--------+--------+
      | DOWN   |  OPT   |  Auth  |  Auth  |
      +--------+--------+--------+--------+
      | INIT   |  Auth  |  OPT   |  n/a   |
      +--------+--------+--------+--------+
      | UP     |  Auth  |  Auth  | Select |
      +--------+--------+--------+--------+
	    ]]>
	  </artwork>
	</figure>
      </t>

      <t>
	In other words, the contents of an Up packet MUST NOT change
	aside from the authentication section without stronger
	authentication.
      </t>

      <t>
	Implementations supporting this feature can send BFD packets
	with or without authentication that carries a meticulously
	increasing sequence number.  This meticulously increasing
	sequence number prevents replay attacks, and it supports <xref
	target="I-D.ietf-bfd-stability">BFD Stability</xref>.
      </t>

      <t>
	The NULL Authentication type is defined in <xref
	target="null-auth-type">NULL Authentication
	Type</xref>.  This authentication type does not provide any
	authentication of the BFD Control Up packets, but does carry a
	meticulously increasing sequence number compatible with this
	specification.
      </t>

      <t>
	<xref target="I-D.ietf-bfd-secure-sequence-numbers">Secure BFD
	Sequence Numbers</xref> defines an authentication mechanism
	that does not provide any authentication of the BFD Control
	packets, carries a meticulously increasing sequence number,
	but provides for a stronger mechanism to prevent active
	attacks against these procedures for Up packets without
	requiring strong authentication.
      </t>

    </section>

    <section anchor="null-auth-type" title="NULL Auth Type">
      <t>This section describes a new Authentication Type as:
      <figure
          align="center" title="NULL Auth Type">
        <artwork><![CDATA[       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |   Auth Type   |   Auth Len    |  Auth Key ID  |   Reserved    |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                        Sequence Number                        |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      ]]></artwork>
      </figure>
      where:
      </t>

      <t>
	Auth Type: The Authentication Type, which in this case is TBD
	(NULL, to be assigned by IANA, with a suggested value of 6).
      </t>

      <t>Auth Len: The length of the NULL Auth Type, in bytes; i.e. 8 bytes</t>

      <t>Auth Key ID: The authentication key ID in use for this packet. Must
      be set to zero.</t>

      <t>Reserved: This byte MUST be set to zero on transmit and ignored on
      receive.</t>

      <t>Sequence Number: The sequence number for this packet.  Implementations
      will use sequence numbers (bfd.XmitAuthSeq) as defined in <xref
      target="RFC5880">BFD</xref>.</t>
    </section>

    <section anchor="opt-auth-yang-model" title="Optimizing Authentication YANG Model">
      <section anchor="data-model-overview" title="Data Model Overview">
	<t>
	  The <xref target="RFC7950">YANG 1.1</xref> model defined in
	  this document augments the "ietf-bfd" module to add
	  configuration relevant to the management of the feature
	  defined in this document. In particular, it adds crypto
	  algorithms that are described in this model, and in <xref
	  target="I-D.ietf-bfd-secure-sequence-numbers">Secure BFD
	  Sequence Numbers</xref>. It adds a feature statement to
	  enable optimized authentication. Finally, it adds a flag to
	  enable optimized authentication, an interval value that
	  specifies how often the BFD session should be
	  re-authenticated once it is in the Up state, and the key chain
	  that should be used in the Up state.
	</t>
      </section>
      <section anchor="tree-diagram" title="Tree Diagram">
	<t>
	  The tree diagram for the YANG modules defined in this
	  document use annotations defined in <xref
	  target="RFC8340">YANG Tree Diagrams.</xref>.
	</t>
	<t>
	  <figure>
            <artwork><![CDATA[
module: ietf-bfd-opt-auth

  augment /rt:routing/rt:control-plane-protocols
            /rt:control-plane-protocol/bfd:bfd/bfd-ip-sh:ip-sh
            /bfd-ip-sh:sessions/bfd-ip-sh:session
            /bfd-ip-sh:authentication:
    +--rw optimized-auth?    boolean {optimized-auth}?
    +--rw reauth-interval?   uint32
    +--rw up-auth-type?      key-chain:key-chain-ref
  augment /rt:routing/rt:control-plane-protocols
            /rt:control-plane-protocol/bfd:bfd/bfd-ip-mh:ip-mh
            /bfd-ip-mh:session-groups/bfd-ip-mh:session-group
            /bfd-ip-mh:authentication:
    +--rw optimized-auth?    boolean {optimized-auth}?
    +--rw reauth-interval?   uint32
    +--rw up-auth-type?      key-chain:key-chain-ref
  augment /rt:routing/rt:control-plane-protocols
            /rt:control-plane-protocol/bfd:bfd/bfd-lag:lag
            /bfd-lag:sessions/bfd-lag:session/bfd-lag:authentication:
    +--rw optimized-auth?    boolean {optimized-auth}?
    +--rw reauth-interval?   uint32
    +--rw up-auth-type?      key-chain:key-chain-ref
  augment /rt:routing/rt:control-plane-protocols
            /rt:control-plane-protocol/bfd:bfd/bfd-mpls:mpls
            /bfd-mpls:session-groups/bfd-mpls:session-group
            /bfd-mpls:authentication:
    +--rw optimized-auth?    boolean {optimized-auth}?
    +--rw reauth-interval?   uint32
    +--rw up-auth-type?      key-chain:key-chain-ref
	    ]]></artwork>
          </figure>
	</t>
      </section>
      <section anchor="the-yang-model" title="The YANG Model">
	<t>
	  This YANG module imports <xref target="RFC8177">YANG Key
	  Chain </xref>, <xref target="RFC8349">A YANG Data Model for
	  Routing Management (NMDA version)</xref>, and <xref
	  target="RFC9314">YANG Data Model for Bidirectional Forwading
	  Detection (BFD)</xref>.
	</t>
	<t>
	  <figure>
            <artwork><![CDATA[
	    <CODE BEGINS> file "ietf-bfd-opt-auth@2024-02-05.yang"
module ietf-bfd-opt-auth {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-bfd-opt-auth";
  prefix "bfdoa";

  import ietf-routing {
    prefix "rt";
    reference
      "RFC 8349: A YANG Data Model for Routing Management
       (NMDA version)";
  }

  import ietf-bfd {
    prefix bfd;
    reference
      "RFC 9314: YANG Data Model for Bidirectional
       Forwarding Detection.";
  }

  import ietf-bfd-ip-sh {
    prefix bfd-ip-sh;
    reference
      "RFC 9314: YANG Data Model for Bidirectional
       Forwarding Detection.";
  }

  import ietf-bfd-ip-mh {
    prefix bfd-ip-mh;
    reference
      "RFC 9314: YANG Data Model for Bidirectional
       Forwarding Detection.";
  }

  import ietf-bfd-lag {
    prefix bfd-lag;
    reference
      "RFC 9314: YANG Data Model for Bidirectional
       Forwarding Detection.";
  }

  import ietf-bfd-mpls {
    prefix bfd-mpls;
    reference
      "RFC 9314: YANG Data Model for Bidirectional
       Forwarding Detection.";
  }

  import ietf-key-chain {
    prefix key-chain;
    reference
      "RFC 8177: YANG Key Chain.";
  }

  organization
    "IETF BFD Working Group";

  contact
    "WG Web:   <http://tools.ietf.org/wg/bfd>
     WG List:  <rtg-bfd@ietf.org>

     Authors: Mahesh Jethanandani (mjethanandani@gmail.com)
              Ashesh Mishra (mishra.ashesh@gmail.com)
              Ankur Saxena (ankurpsaxena@gmail.com)
              Manav Bhatia (mnvbhatia@google.com).";
              

  description
    "This YANG module augments the base BFD YANG model to add
     attributes related to BFD Optimized Authentication.

     Copyright (c) 2024 IETF Trust and the persons identified as
     authors of the code.  All rights reserved.

     Redistribution and use in source and binary forms, with or
     without modification, is permitted pursuant to, and subject to
     the license terms contained in, the Revised BSD License set
     forth in Section 4.c of the IETF Trust's Legal Provisions
     Relating to IETF Documents
     (https://trustee.ietf.org/license-info).

     This version of this YANG module is part of RFC XXXX
     (https://www.rfc-editor.org/info/rfcXXXX); see the RFC itself
     for full legal notices.

     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 14 (RFC 2119) (RFC 8174) when, and only when,
     they appear in all capitals, as shown here.";

  revision "2024-02-05" {
    description
      "Initial Version.";
    reference
      "RFC XXXX: Optimizing BFD Authentication.";
  }

  feature optimized-auth {
    description
      "When enabled, this implementation supports optimized
       authentication as described in this document.";
  }

  identity no-auth {
    base key-chain:crypto-algorithm;
    description
      "No authentication will be used.";
  }

  identity null {
    base key-chain:crypto-algorithm;
    description
      "BFD Null type defined in this draft.";
    reference
      "RFC XXXX: Optimizing BFD Authentication.";
  }

  identity meticulous-keyed-isaac {
    base key-chain:crypto-algorithm;
    description
      "BFD ISAAC Keyed Meticulous.";
    reference
      "I-D.ietf-bfd-secure-sequence-numbers: Securing BFD Sequence
                                             Numbers.";
  }

  augment "/rt:routing/rt:control-plane-protocols" +
          "/rt:control-plane-protocol/bfd:bfd/bfd-ip-sh:ip-sh" +
          "/bfd-ip-sh:sessions/bfd-ip-sh:session" +
          "/bfd-ip-sh:authentication" {
    leaf optimized-auth {
      if-feature optimized-auth;
      type boolean;
      default false;
      description
        "If set to true, BFD Single Hop Sessions will be
         enabled for optimized authentication.";
    }

    leaf reauth-interval {
      when "../optimized-auth = 'true'";
      type uint32;
      units "microseconds";
      default "60000000";
      description
        "Interval of time after which a strong authentication
         should be enabled to prevent a Person-In-The-Middle
         attack. Default is 1 minute.

         This value SHOULD have jitter applied to it to avoid
         self-synchronization during expensive authentication
         operations.";
    }

    leaf up-auth-type {
      type key-chain:key-chain-ref;
      must "(../optimized-auth = 'true') and " +
           "(../bfd-ip-sh:meticulous = 'true')";
      description
        "The authentication type that should be used once the
         connection transitions to Up state. In case
         of optimized auth, the choices are Reserved (or no
         authentication), NULL Auth, or Meticulous Keyed ISAAC.";
    }
    description
      "Augment the 'bfd' container to add attributes related to BFD
       optimized authentication.";
  }

  augment "/rt:routing/rt:control-plane-protocols/" +
          "rt:control-plane-protocol/bfd:bfd/bfd-ip-mh:ip-mh/" +
          "bfd-ip-mh:session-groups/bfd-ip-mh:session-group/" +
          "bfd-ip-mh:authentication" {
    leaf optimized-auth {
      if-feature optimized-auth;
      type boolean;
      default false;
      description
        "If set to true, BFD Multi Hop Sessions will be
         enabled for optimized authentication.";
    }

    leaf reauth-interval {
      when "../optimized-auth = 'true'";
      type uint32;
      units "microseconds";
      default "60000000";
      description
        "Interval of time after which a strong authentication
         should be enabled to prevent a Person-In-The-Middle
         attack. Default is 1 minute.

         This value SHOULD have jitter applied to it to avoid
         self-synchronization during expensive authentication
         operations.";
    }

    leaf up-auth-type {
      type key-chain:key-chain-ref;
      must "(../optimized-auth = 'true') and " +
           "(../bfd-ip-mh:meticulous = 'true')";
      description
        "The authentication type that should be used once the
         connection transitions to Up state. In case
         of optimized auth, the choices are Reserved (or no
         authentication), NULL Auth, or Meticulous Keyed ISAAC.";
    }
    description
      "Augment the 'bfd' container to add attributes related to BFD
       optimized authentication.";
  }

  augment "/rt:routing/rt:control-plane-protocols/" +
          "rt:control-plane-protocol/bfd:bfd/bfd-lag:lag/" +
          "bfd-lag:sessions/bfd-lag:session/" +
          "bfd-lag:authentication" {
    leaf optimized-auth {
      if-feature optimized-auth;
      type boolean;
      default false;
      description
        "If set to true, BFD LAG Sessions will be
         enabled for optimized authentication.";
    }

    leaf reauth-interval {
      when "../optimized-auth = 'true'";
      type uint32;
      units "microseconds";
      default "60000000";
      description
        "Interval of time after which a strong authentication
         should be enabled to prevent a Person-In-The-Middle
         attack. Default is 1 minute.

         This value SHOULD have jitter applied to it to avoid
         self-synchronization during expensive authentication
         operations.";
    }

    leaf up-auth-type {
      type key-chain:key-chain-ref;
      must "(../optimized-auth = 'true') and " +
           "(../bfd-lag:meticulous = 'true')";
      description
        "The authentication type that should be used once the
         connection transitions to Up state. In case
         of optimized auth, the choices are Reserved (or no
         authentication), NULL Auth, or Meticulous Keyed ISAAC.";
    }
    description
      "Augment the 'bfd' container to add attributes related to BFD
       optimized authentication.";
  }

  augment "/rt:routing/rt:control-plane-protocols/" +
          "rt:control-plane-protocol/bfd:bfd/bfd-mpls:mpls/" +
          "bfd-mpls:session-groups/bfd-mpls:session-group/" +
          "bfd-mpls:authentication" {
    leaf optimized-auth {
      if-feature optimized-auth;
      type boolean;
      default false;
      description
        "If set to true, BFD MPLS Sessions will be
         enabled for optimized authentication.";
    }

    leaf reauth-interval {
      when "../optimized-auth = 'true'";
      type uint32;
      units "microseconds";
      default "60000000";
      description
        "Interval of time after which a strong authentication
         should be enabled to prevent a Person-In-The-Middle
         attack. Default is 1 minute.

         This value SHOULD have jitter applied to it to avoid
         self-synchronization during expensive authentication
         operations.";
    }

    leaf up-auth-type {
      type key-chain:key-chain-ref;
      must "(../optimized-auth = 'true') and " +
           "(../bfd-mpls:meticulous = 'true')";
      description
        "The authentication type that should be used once the
         connection transitions to Up state. In case
         of optimized auth, the choices are Reserved (or no
         authentication), NULL Auth, or Meticulous Keyed ISAAC.";
    }
    description
      "Augment the 'bfd' container to add attributes related to BFD
       optimized authentication.";
  }
}
	    <CODE ENDS>
	    ]]></artwork>
          </figure>
	</t>
      </section>
    </section>

    <section anchor="IANA" title="IANA Considerations">
      <t>
	This documents requests two new authentication types, one URI,
	one YANG model, and an update to an existing IANA YANG model.
      </t>
      <section anchor="auth-type" title="Auth Type">
	<t>
	  This document requests an update to the registry titled "BFD
	  Authentication Types". IANA is requested to assign two new
	  BFD AuthType:
	  <ul>
	    <li>
	      <xref target="null-auth-type">NULL Auth Type</xref>,
	      with a suggested value of 6.
	    </li>
	    <li>
	      <xref target="I-D.ietf-bfd-secure-sequence-numbers"
	      sectionFormat="parens"
	      section="meticulous-keyed-isaac-authentication">Meticulous
	      Keyed ISAAC Authentication</xref>, with a suggested
	      value of 7.
	    </li>
	  </ul>
	</t>
      </section>
      <section anchor="ietf-xml-registry" title="IETF XML Registry">
	<t>
	  This document registers one URIs in the "ns" subregistry of
	  the "IETF XML" registry <xref target="RFC3688"/>. Following
	  the format in <xref target="RFC3688"/>, the following
	  registration is requested:
	</t>
        <t>
	  <figure>
            <artwork>
	      <![CDATA[
URI: urn:ietf:params:xml:ns:yang:ietf-bfd-opt-auth
Registrant Contact: The IESG
XML: N/A, the requested URI is an XML namespace.
	      ]]>
	    </artwork>
          </figure>
	</t>
      </section>
      <section anchor="yang-module-names" title="The YANG Module Names Registry">
        <t>
	  This document registers one YANG modules in the "YANG Module
	  Names" registry <xref target="RFC6020"/>. Following the
	  format in <xref target="RFC6020"/>, the following
	  registrations are requested:
	</t>
        <t>
	  <figure>
	    <artwork>
	      <![CDATA[
name:         ietf-bfd-opt-auth
namespace:    urn:ietf:params:xml:ns:yang:ietf-bfd-opt-auth
prefix:       bfdoa
reference:    RFC XXXX
	      ]]>
	    </artwork>
          </figure>
	</t>
      </section>
      <section anchor="updated-iana-module" title="Updated IANA Module">
	<t>
	  This document also requests an update to an existing IANA
	  YANG module described in <xref
	  target="updated-bfd-iana-module">Updated BFD IANA
	  Module</xref>
	</t>
      </section>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>
	The YANG module specified in this document defines a schema
	for data that is designed to be accessed via network
	management protocols such as <xref
	target="RFC6241">NETCONF</xref> or <xref
	target="RFC8040">RESTCONF</xref>. The lowest NETCONF layer is
	the secure transport layer, and the mandatory-to-implement
	secure transport is <xref target="RFC6242">Secure Shell
	(SSH)</xref>. The lowest RESTCONF layer is HTTPS, and the
	mandatory-to-implement secure transport is <xref
	target="RFC8446">TLS</xref>. The <xref
	target="RFC8341">NETCONF Access Control Model (NACM) </xref>
	provides the means to restrict access for particular NETCONF
	or RESTCONF users to a preconfigured subset of all available
	NETCONF or RESTCONF protocol operations and content.
      </t>

      <t>
	There are a number of data nodes defined in this YANG module
	that are writable/creatable/deletable (i.e., config true,
	which is the default).  These data nodes may be considered
	sensitive or vulnerable in some network environments. Write
	operations (e.g., edit-config) to these data nodes without
	proper protection can have a negative effect on network
	operations. Some of the subtrees and data nodes and their
	sensitivity/vulnerability are described here.
      </t>

      <ul>
	<li>
	  'optimized-auth' flag is used to enable optimized
	  authentication for the session. If this was not intended, or
	  the other end is not configured with the same flag, the BFD
	  session will fail to come up.
	</li>
	<li>
	  'reauth-interval' specifies the interval in Up state, after
	  which a strong authentication SHOULD be performed to prevent
	  a Person-In-The-Middle (PITM) attack. If this interval is
	  set very low, or very high, then it will make optimization
	  worthless.
	</li>
      </ul>

      <t>
	Some of the readable data nodes in this YANG module may be
	considered sensitive or vulnerable in some network
	environments. It is thus important to control read access
	(e.g., via get, get-config, or notification) to these data
	nodes.
      </t>

      <t>
	There are no read-only data nodes defined in this model.
      </t>

      <t>
	Some of the RPC operations in this YANG module may be
	considered sensitive or vulnerable in some network
	environments. It is thus important to control access to these
	operations.
      </t>

      <t>
	There are no RPC operations defined in this model.
      </t>

      <t>
	The approach described in this document enhances the ability
	to authenticate a BFD session by taking away the onerous
	requirement that every BFD control packet be authenticated. By
	authenticating packets that affect the state of the session,
	the security of the BFD session is maintained. In this mode,
	packets that are a significant change but are not
	authenticated, are dropped by the system. Therefore, a
	malicious user that tries to inject a non-authenticated
	packet; e.g. with a Down state to take a session down will
	fail. That combined with the proposal of using sequence number
	defined in <xref
	target="I-D.ietf-bfd-secure-sequence-numbers">Secure BFD
	Sequence Numbers</xref> further enhances the security of BFD
	sessions.
      </t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include="reference.RFC.2119.xml"?>
      <?rfc include='reference.RFC.3688.xml'?>
      <?rfc include='reference.RFC.5880.xml'?>
      <?rfc include='reference.RFC.6020.xml'?>
      <?rfc include='reference.RFC.6241.xml'?>
      <?rfc include='reference.RFC.6242.xml'?>
      <?rfc include='reference.RFC.7950.xml'?>
      <?rfc include='reference.RFC.8040.xml'?>
      <?rfc include='reference.RFC.8174.xml'?>
      <?rfc include='reference.RFC.8177.xml'?>
      <?rfc include='reference.RFC.8340.xml'?>
      <?rfc include='reference.RFC.8341.xml'?>
      <?rfc include='reference.RFC.8349.xml'?>
      <?rfc include='reference.RFC.8446.xml'?>
      <?rfc include='reference.RFC.9127.xml'?>
      <?rfc include='reference.RFC.9314.xml'?>
      <?rfc include='reference.I-D.ietf-bfd-secure-sequence-numbers.xml'?>
      <?rfc include='reference.I-D.ietf-bfd-stability.xml'?>
    </references>

    <references title="Informative References">
      <reference anchor="SHA-1-attack1">
        <front>
          <title>Finding Collisions in the Full SHA-1</title>

          <author initials="X." surname="Wang">
            <organization/>
          </author>

          <author initials="Y." surname="Yin">
            <organization/>

            <address>
              <postal>
                <street/>

                <city/>

                <region/>

                <code/>

                <country/>
              </postal>

              <phone/>

              <facsimile/>

              <email/>

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

          <author initials="H." surname="Yu">
            <organization/>

            <address>
              <postal>
                <street/>

                <city/>

                <region/>

                <code/>

                <country/>
              </postal>

              <phone/>

              <facsimile/>

              <email/>

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

          <date year="2005"/>
        </front>
      </reference>

      <reference anchor="SHA-1-attack2">
        <front>
          <title>New Collision Search for SHA-1</title>

          <author initials="X." surname="Wang">
            <organization/>
          </author>

          <author initials="A." surname="Yao">
            <organization/>

            <address>
              <postal>
                <street/>

                <city/>

                <region/>

                <code/>

                <country/>
              </postal>

              <phone/>

              <facsimile/>

              <email/>

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

          <author initials="F." surname="Yao">
            <organization/>

            <address>
              <postal>
                <street/>

                <city/>

                <region/>

                <code/>

                <country/>
              </postal>

              <phone/>

              <facsimile/>

              <email/>

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

          <date year="2005"/>
        </front>
      </reference>

      <?rfc include='reference.RFC.1321.xml'?>

      <?rfc include='reference.RFC.6151.xml'?>

      <?rfc include='reference.RFC.6194.xml'?>
    </references>
    <section anchor="updated-bfd-iana-module" title="Updated BFD IANA Module">
      <t>
	This section carries the updated IANA BFD Module,
	iana-bfd-types.yang module, first defined in <xref
	target="RFC9127">YANG Data Model for Bidirectional Forward
	Detection (BFD)</xref>. The updated module carries two new
	authentication type enum definitions, 'null' with a suggested
	value of 6, and 'meticulous-keyed-isaac' with a suggested
	value of 7. This module should replace the version that
	currently exists in the IANA registry.
      </t>
	<t>
          <figure>
            <artwork><![CDATA[
	    <CODE BEGINS> file "iana-bfd-types@2024-02-05.yang"
=============== NOTE: '\' line wrapping per RFC 8792 ===============

module iana-bfd-types {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:iana-bfd-types";
  prefix iana-bfd-types;

  organization
    "IANA";
  contact
    "Internet Assigned Numbers Authority

     Postal: ICANN
             12025 Waterfront Drive, Suite 300
             Los Angeles, CA 90094-2536
             United States of America
     Tel:    +1 310 301 5800
     <mailto:iana@iana.org>";
  description
    "This module defines YANG data types for IANA-registered
     BFD parameters.

     This YANG module is maintained by IANA and reflects the
     'BFD Diagnostic Codes' and 'BFD Authentication Types'
     registries.

     Copyright (c) 2021 IETF Trust and the persons identified as
     authors of the code.  All rights reserved.

     Redistribution and use in source and binary forms, with or
     without modification, is permitted pursuant to, and subject to
     the license terms contained in, the Simplified BSD License set
     forth in Section 4.c of the IETF Trust's Legal Provisions
     Relating to IETF Documents
     (https://trustee.ietf.org/license-info).

     This version of this YANG module is part of RFC 9127; see the
     RFC itself for full legal notices.";
  reference
    "RFC 9127: YANG Data Model for Bidirectional Forwarding
     Detection (BFD)";

  revision 2024-02-05 {
    description
      "Add NULL and Meticulous ISAAC authentication type.";
    reference
      "I-D.ietf-bfd-optimized-auth: Optimizing BFD Authentication.";
  }

  revision 2021-10-21 {
    description
      "Initial revision.";
    reference
      "RFC 9127: YANG Data Model for Bidirectional Forwarding
       Detection (BFD)";
  }

  /*
   * Type definitions
   */

  typedef diagnostic {
    type enumeration {
      enum none {
        value 0;
        description
          "No Diagnostic.";
      }
      enum control-expiry {
        value 1;
        description
          "Control Detection Time Expired.";
      }
      enum echo-failed {
        value 2;
        description
          "Echo Function Failed.";
      }
      enum neighbor-down {
        value 3;
        description
          "Neighbor Signaled Session Down.";
      }
      enum forwarding-reset {
        value 4;
        description
          "Forwarding Plane Reset.";
      }
      enum path-down {
        value 5;
        description
          "Path Down.";
      }
      enum concatenated-path-down {
        value 6;
        description
          "Concatenated Path Down.";
      }
      enum admin-down {
        value 7;
        description
          "Administratively Down.";
      }
      enum reverse-concatenated-path-down {
        value 8;
        description
          "Reverse Concatenated Path Down.";
      }
      enum mis-connectivity-defect {
        value 9;
        description
          "Mis-connectivity defect.";
        reference
          "RFC 5880: Bidirectional Forwarding Detection (BFD)
           RFC 6428: Proactive Connectivity Verification, Continuity
           Check, and Remote Defect Indication for the MPLS Transpo\
rt
           Profile";
      }
    }
    description
      "BFD diagnostic codes as defined in RFC 5880.  Values are
       maintained in the 'BFD Diagnostic Codes' IANA registry.
       Range is 0 to 31.";
    reference
      "RFC 5880: Bidirectional Forwarding Detection (BFD)";
  }

  typedef auth-type {
    type enumeration {
      enum reserved {
        value 0;
        description
          "Reserved.";
      }
      enum simple-password {
        value 1;
        description
          "Simple Password.";
      }
      enum keyed-md5 {
        value 2;
        description
          "Keyed MD5.";
      }
      enum meticulous-keyed-md5 {
        value 3;
        description
          "Meticulous Keyed MD5.";
      }
      enum keyed-sha1 {
        value 4;
        description
          "Keyed SHA1.";
      }
      enum meticulous-keyed-sha1 {
        value 5;
        description
          "Meticulous Keyed SHA1.";
      }
      enum null {
        value 6;
        description
          "NULL Auth.";
      }
      enum meticulous-keyed-isaac {
        value 7;
        description
          "Meticulous Keyed ISAAC.";
      }
    }
    description
      "BFD authentication type as defined in RFC 5880.  Values are
       maintained in the 'BFD Authentication Types' IANA registry.
       Range is 0 to 255.";
    reference
      "RFC 5880: Bidirectional Forwarding Detection (BFD)";
  }
}
	    <CODE ENDS>
            ]]>
            </artwork>
          </figure>
	</t>
    </section>
    <section anchor="examples" title="Examples">
      <t>
	This section tries to show some examples in how the model can
	be configured.
      </t>
      <section anchor="example-a.1.1" title="Single Hop BFD Configuration">
	<t>
          This example demonstrates how a Single Hop BFD session can
          be configured for optimized authentication.
	</t>
	<t>
          <figure>
            <artwork><![CDATA[
=============== NOTE: '\' line wrapping per RFC 8792 ===============

<?xml version="1.0" encoding="UTF-8"?>
<key-chains
    xmlns="urn:ietf:params:xml:ns:yang:ietf-key-chain">
  <key-chain>
    <name>bfd-auth-config</name>
    <description>"An example for BFD Optimized Auth configuration."\
</description>
    <key>
      <key-id>55</key-id>
      <lifetime>
        <send-lifetime>
          <start-date-time>2017-01-01T00:00:00Z</start-date-time>
          <end-date-time>2017-02-01T00:00:00Z</end-date-time>
        </send-lifetime>
        <accept-lifetime>
          <start-date-time>2016-12-31T23:59:55Z</start-date-time>
          <end-date-time>2017-02-01T00:00:05Z</end-date-time>
        </accept-lifetime>
      </lifetime>
      <crypto-algorithm xmlns:opt-auth=
      "urn:ietf:params:xml:ns:yang:ietf-bfd-opt-auth">opt-auth:meti\
culous-keyed-isaac</crypto-algorithm>
      <key-string>
        <keystring>testvector</keystring>
      </key-string>
    </key>
  </key-chain>
</key-chains>
<interfaces
    xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"
    xmlns:if-type="urn:ietf:params:xml:ns:yang:iana-if-type">
  <interface>
    <name>eth0</name>
    <type>if-type:ethernetCsmacd</type>
  </interface>
</interfaces>
<routing
    xmlns="urn:ietf:params:xml:ns:yang:ietf-routing"
    xmlns:bfd-types="urn:ietf:params:xml:ns:yang:ietf-bfd-types"
    xmlns:iana-bfd-types="urn:ietf:params:xml:ns:yang:iana-bfd-type\
s"
    xmlns:opt-auth="urn:ietf:params:xml:ns:yang:ietf-bfd-opt-auth">
  <control-plane-protocols>
    <control-plane-protocol>
      <type>bfd-types:bfdv1</type>
      <name>name:BFD</name>
      <bfd xmlns="urn:ietf:params:xml:ns:yang:ietf-bfd">
        <ip-sh xmlns="urn:ietf:params:xml:ns:yang:ietf-bfd-ip-sh">
          <sessions>
            <session>
              <interface>eth0</interface>
              <dest-addr>2001:db8:0:113::101</dest-addr>
              <desired-min-tx-interval>10000</desired-min-tx-interv\
al>
              <required-min-rx-interval>
                10000
              </required-min-rx-interval>
              <authentication>
                <meticulous>true</meticulous>
                <opt-auth:optimized-auth>true</opt-auth:optimized-a\
uth>
                <opt-auth:reauth-interval>30000</opt-auth:reauth-in\
terval>
                <opt-auth:up-auth-type>bfd-auth-config</opt-auth:up\
-auth-type>
              </authentication>
            </session>
          </sessions>
        </ip-sh>
      </bfd>
    </control-plane-protocol>
  </control-plane-protocols>
</routing>
            ]]>
            </artwork>
          </figure>
	</t>
      </section>
    </section>      
  </back>
</rfc>
