<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc linkmailto="no" ?>
<?rfc editing="no" ?>
<?rfc comments="yes" ?>
<?rfc inline="yes"?>
<?rfc rfcedstyle="yes"?>
<?rfc-ext allow-markup-in-artwork="yes" ?>
<?rfc-ext include-index="no" ?>
<!--<?rfc strict="no"?> -->
<rfc category="std" docName="draft-ietf-netconf-tls-client-server-09"
     ipr="trust200902">
  <front>
    <title abbrev="Groupings for TLS Clients and Servers">YANG Groupings for
    TLS Clients and TLS Servers</title>

    <author fullname="Kent Watsen" initials="K." surname="Watsen">
      <organization>Watsen Networks</organization>

      <address>
        <email>kent+ietf@watsen.net</email>
      </address>
    </author>

    <author fullname="Gary Wu" initials="G." surname="Wu">
      <organization>Cisco Systems</organization>

      <address>
        <email>garywu@cisco.com</email>
      </address>
    </author>

    <author fullname="Liang Xia" initials="L." surname="Xia">
      <organization>Huawei</organization>

      <address>
        <email>frank.xialiang@huawei.com</email>
      </address>
    </author>

    <date/>

    <area>Operations</area>

    <workgroup>NETCONF Working Group</workgroup>

    <abstract>
      <t>This document defines three YANG modules: the first defines groupings
      for a generic TLS client, the second defines groupings for a generic TLS
      server, and the third defines common identities and groupings used by
      both the client and the server. It is intended that these groupings will
      be used by applications using the TLS protocol.</t>
    </abstract>

    <note title="Editorial Note (To be removed by RFC Editor)">
      <t>This draft contains many placeholder values that need to be replaced
      with finalized values at the time of publication. This note summarizes
      all of the substitutions that are needed. No other RFC Editor
      instructions are specified elsewhere in this document.</t>

      <t>This document contains references to other drafts in progress, both
      in the Normative References section, as well as in body text throughout.
      Please update the following references to reflect their final RFC
      assignments: <list style="symbols">
          <t>I-D.ietf-netconf-trust-anchors</t>

          <t>I-D.ietf-netconf-keystore</t>
        </list></t>

      <t>Artwork in this document contains shorthand references to drafts in
      progress. Please apply the following replacements: <list style="symbols">
          <t><spanx style="verb">XXXX</spanx> --&gt; the assigned RFC value
          for this draft</t>

          <t><spanx style="verb">YYYY</spanx> --&gt; the assigned RFC value
          for I-D.ietf-netconf-trust-anchors</t>

          <t><spanx style="verb">ZZZZ</spanx> --&gt; the assigned RFC value
          for I-D.ietf-netconf-keystore</t>
        </list></t>

      <t>Artwork in this document contains placeholder values for the date of
      publication of this draft. Please apply the following replacement: <list
          style="symbols">
          <t><spanx style="verb">2019-03-09</spanx> --&gt; the publication
          date of this draft</t>
        </list></t>

      <t>The following Appendix section is to be removed prior to publication:
      <list style="symbols">
          <t>Appendix A. Change Log</t>
        </list></t>
    </note>
  </front>

  <middle>
    <section title="Introduction">
      <t>This document defines three YANG 1.1 <xref target="RFC7950"/>
      modules: the first defines a grouping for a generic TLS client, the
      second defines a grouping for a generic TLS server, and the third
      defines identities and groupings common to both the client and the
      server (TLS is defined in <xref target="RFC5246"/>). It is intended that
      these groupings will be used by applications using the TLS protocol. For
      instance, these groupings could be used to help define the data model
      for an HTTPS <xref target="RFC2818"/> server or a NETCONF over TLS <xref
      target="RFC7589"/> based server.</t>

      <t>The client and server YANG modules in this document each define one
      grouping, which is focused on just TLS-specific configuration, and
      specifically avoids any transport-level configuration, such as what
      ports to listen-on or connect-to. This affords applications the
      opportunity to define their own strategy for how the underlying TCP
      connection is established. For instance, applications supporting NETCONF
      Call Home <xref target="RFC8071"/> could use the "ssh-server-grouping"
      grouping for the TLS parts it provides, while adding data nodes for the
      TCP-level call-home configuration.</t>

      <t>The modules defined in this document use groupings defined in <xref
      target="I-D.ietf-netconf-keystore"/> <!-- and
        <xref target="I-D.kwatsen-netconf-trust-anchors"/> --> enabling keys
      <!-- and trust anchors, respectively,--> to be either locally defined or
      a reference to globally configured values.</t>
    </section>

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

    <section anchor="tls-client-model" title="The TLS Client Model">
      <section title="Tree Diagram">
        <t>This section provides a tree diagram <xref target="RFC8340"/> for
        the "ietf-tls-client" module that does not have groupings
        expanded.</t>

        <t><figure>
            <artwork><![CDATA[
module: ietf-tls-client

  grouping tls-client-grouping
    +---u client-identity-grouping
    +---u server-auth-grouping
    +---u hello-params-grouping
    +---u keepalives-grouping
  grouping client-identity-grouping
    +-- tls-client-identity
       +-- (auth-type)?
          +--:(certificate)
             +-- certificate
                +---u client-identity-grouping
  grouping server-auth-grouping
    +-- tls-server-auth
       +-- pinned-ca-certs?       ta:pinned-certificates-ref
       |       {ta:x509-certificates}?
       +-- pinned-server-certs?   ta:pinned-certificates-ref
               {ta:x509-certificates}?
  grouping hello-params-grouping
    +-- tls-hello-params {tls-client-hello-params-config}?
       +---u hello-params-grouping
  grouping keepalives-grouping
    +-- tls-keepalives {tls-client-keepalives}?
       +-- max-wait?       uint16
       +-- max-attempts?   uint8
]]></artwork>
          </figure></t>
      </section>

      <section title="Example Usage">
        <t>This section presents two examples showing the tls-client-grouping
        populated with some data. These examples are effectively the same
        except the first configures the client identity using a local key
        while the second uses a key configured in a keystore. Both examples
        are consistent with the examples presented in Section 3 of <xref
        target="I-D.ietf-netconf-trust-anchors"/> and Section 3.2 of <xref
        target="I-D.ietf-netconf-keystore"/>.</t>

        <t>The following example configures the client identity using a local
        key: <figure>
            <artwork><![CDATA[
========== NOTE: '\\' line wrapping per BCP XX (RFC XXXX) ===========

<tls-client xmlns="urn:ietf:params:xml:ns:yang:ietf-tls-client">

  <!-- how this client will authenticate itself to the server -->
  <tls-client-identity>
    <certificate>
      <local-definition>
        <algorithm xmlns:ct="urn:ietf:params:xml:ns:yang:ietf-crypto\
\-types">ct:rsa2048</algorithm>
        <private-key>base64encodedvalue==</private-key>
        <public-key>base64encodedvalue==</public-key>
        <cert>base64encodedvalue==</cert>
      </local-definition>
    </certificate>
  </tls-client-identity>

  <!-- which certificates will this client trust -->
  <tls-server-auth>
    <pinned-ca-certs>explicitly-trusted-server-ca-certs</pinned-ca-c\
\erts>
    <pinned-server-certs>explicitly-trusted-server-certs</pinned-ser\
\ver-certs>
  </tls-server-auth>

  <tls-keepalives>
    <max-wait>30</max-wait>
    <max-attempts>3</max-attempts>
  </tls-keepalives>

</tls-client>
]]></artwork>
          </figure></t>

        <t>The following example configures the client identity using a key
        from the keystore: <figure>
            <artwork><![CDATA[
========== NOTE: '\\' line wrapping per BCP XX (RFC XXXX) ===========

<tls-client xmlns="urn:ietf:params:xml:ns:yang:ietf-tls-client">

  <!-- how this client will authenticate itself to the server -->
  <tls-client-identity>
    <certificate>
      <keystore-reference>ex-rsa-cert</keystore-reference>
    </certificate>
  </tls-client-identity>

  <!-- which certificates will this client trust -->
  <tls-server-auth>
    <pinned-ca-certs>explicitly-trusted-server-ca-certs</pinned-ca-c\
\erts>
    <pinned-server-certs>explicitly-trusted-server-certs</pinned-ser\
\ver-certs>
  </tls-server-auth>

  <tls-keepalives>
    <max-wait>30</max-wait>
    <max-attempts>3</max-attempts>
  </tls-keepalives>

</tls-client>
]]></artwork>
          </figure></t>
      </section>

      <section anchor="tls-client-yang-module" title="YANG Module">
        <t>This YANG module has normative references to <xref
        target="I-D.ietf-netconf-trust-anchors"/> and <xref
        target="I-D.ietf-netconf-keystore"/>.</t>

        <t><figure>
            <artwork><![CDATA[
<CODE BEGINS> file "ietf-tls-client@2019-03-09.yang"
module ietf-tls-client {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-tls-client";
  prefix "tlsc";

  import ietf-tls-common {
    prefix tlscmn;
    revision-date 2019-03-09; // stable grouping definitions
    reference
      "RFC XXXX: YANG Groupings for TLS Clients and TLS Servers";
  }

  import ietf-trust-anchors {
    prefix ta;
    reference
      "RFC YYYY: YANG Data Model for Global Trust Anchors";
  }

  import ietf-keystore {
    prefix ks;
    reference
      "RFC ZZZZ: YANG Data Model for a 'Keystore' Mechanism";
  }

  organization
   "IETF NETCONF (Network Configuration) Working Group";

  contact
   "WG Web:   <http://datatracker.ietf.org/wg/netconf/>
    WG List:  <mailto:netconf@ietf.org>
    Author:   Kent Watsen <mailto:kent+ietf@watsen.net>
    Author:   Gary Wu <mailto:garywu@cisco.com>";

  description
   "This module defines reusable groupings for TLS clients that
    can be used as a basis for specific TLS client instances.

    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 [RFC2119]
    [RFC8174] when, and only when, they appear in all
    capitals, as shown here.

    Copyright (c) 2019 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
    (http://trustee.ietf.org/license-info).

    This version of this YANG module is part of RFC XXXX; see
    the RFC itself for full legal notices.";

  revision "2019-03-09" {
    description
     "Initial version";
    reference
     "RFC XXXX: YANG Groupings for TLS Clients and TLS Servers";
  }

  // Features

  feature tls-client-hello-params-config {
    description
      "TLS hello message parameters are configurable on a TLS
       client.";
  }

  feature tls-client-keepalives {
    description
      "Per socket TLS keepalive parameters are configurable for
       TLS clients on the server implementing this feature.";
  }

  // Groupings

  grouping tls-client-grouping {
    description
      "A reusable grouping for configuring a TLS client without
       any consideration for how an underlying TCP session is
       established.";
    uses client-identity-grouping;
    uses server-auth-grouping;
    uses hello-params-grouping;
    uses keepalives-grouping;
  }

  grouping client-identity-grouping {
    description
      "A reusable grouping for configuring a TLS client identity.";
    container tls-client-identity {
      description
        "The credentials used by the client to authenticate to
         the TLS server.";

      choice auth-type {
        description
          "The authentication type.";
        container certificate {
          uses
            ks:local-or-keystore-end-entity-cert-with-key-grouping;
          description
            "A locally-defined or referenced certificate
             to be used for client authentication.";
          reference
            "RFC ZZZZ: YANG Data Model for a 'Keystore' Mechanism";
        }
      }
    }
  }

  grouping server-auth-grouping {
    description
      "A reusable grouping for configuring TLS server
       authentication.";
    container tls-server-auth {
      must 'pinned-ca-certs or pinned-server-certs';
      description
        "Trusted server identities.";
      leaf pinned-ca-certs {
        if-feature "ta:x509-certificates";
        type ta:pinned-certificates-ref;
        description
          "A reference to a list of certificate authority (CA)
           certificates used by the TLS client to authenticate
           TLS server certificates.  A server certificate is
           authenticated if it has a valid chain of trust to
           a configured pinned CA certificate.";
      }
      leaf pinned-server-certs {
        if-feature "ta:x509-certificates";
        type ta:pinned-certificates-ref;
        description
          "A reference to a list of server certificates used by
           the TLS client to authenticate TLS server certificates.
           A server certificate is authenticated if it is an
           exact match to a configured pinned server certificate.";
      }
    }
  }

  grouping hello-params-grouping {
    description
      "A reusable grouping for configuring a TLS transport
       parameters.";
    container tls-hello-params {
      if-feature tls-client-hello-params-config;
      uses tlscmn:hello-params-grouping;
      description
        "Configurable parameters for the TLS hello message.";
    }
  }

  grouping keepalives-grouping {
    description
      "A reusable grouping for configuring TLS client keepalive
       parameters.";
    container tls-keepalives {
      if-feature "tls-client-keepalives";
      description
        "Configures the keep-alive policy, to proactively test
         the aliveness of the TLS server.  An unresponsive
         TLS server is dropped after approximately max-wait
         * max-attempts seconds.";
      leaf max-wait {
        type uint16 {
          range "1..max";
        }
        units seconds;
        default 30;
        description
         "Sets the amount of time in seconds after which if no data
          has been received from the TLS server, a TLS-level message
          will be sent to test the aliveness of the TLS server.";
      }
      leaf max-attempts {
        type uint8;
        default 3;
        description
         "Sets the maximum number of sequential keep-alive messages
         that can fail to obtain a response from the TLS server
         before assuming the TLS server is no longer alive.";
      }
    }
  }
}
<CODE ENDS>
]]></artwork>
          </figure></t>
      </section>
    </section>

    <section anchor="tls-server-model" title="The TLS Server Model">
      <section title="Tree Diagram">
        <t>This section provides a tree diagram <xref target="RFC8340"/> for
        the "ietf-tls-server" module that does not have groupings
        expanded.</t>

        <t><figure>
            <artwork><![CDATA[
module: ietf-tls-server

  grouping tls-server-grouping
    +---u server-identity-grouping
    +---u client-auth-grouping
    +---u hello-params-grouping
    +---u keepalives-grouping
  grouping server-identity-grouping
    +-- tls-server-identity
       +---u server-identity-grouping
  grouping client-auth-grouping
    +-- tls-client-auth
       +-- pinned-ca-certs?       ta:pinned-certificates-ref
       |       {ta:x509-certificates}?
       +-- pinned-client-certs?   ta:pinned-certificates-ref
               {ta:x509-certificates}?
  grouping hello-params-grouping
    +-- tls-hello-params {tls-server-hello-params-config}?
       +---u hello-params-grouping
  grouping keepalives-grouping
    +-- tls-keepalives {tls-server-keepalives}?
       +-- max-wait?       uint16
       +-- max-attempts?   uint8
]]></artwork>
          </figure></t>
      </section>

      <section title="Example Usage">
        <t>This section presents two examples showing the tls-server-grouping
        populated with some data. These examples are effectively the same
        except the first configures the server identity using a local key
        while the second uses a key configured in a keystore. Both examples
        are consistent with the examples presented in Section 3 of <xref
        target="I-D.ietf-netconf-trust-anchors"/> and Section 3.2 of <xref
        target="I-D.ietf-netconf-keystore"/>.</t>

        <t>The following example configures the server identity using a local
        key: <figure>
            <artwork><![CDATA[
========== NOTE: '\\' line wrapping per BCP XX (RFC XXXX) ===========

<tls-server xmlns="urn:ietf:params:xml:ns:yang:ietf-tls-server">

  <!-- how this server will authenticate itself to the client -->
  <tls-server-identity>
    <local-definition>
      <algorithm xmlns:ct="urn:ietf:params:xml:ns:yang:ietf-crypto-t\
\ypes">ct:rsa2048</algorithm>
      <private-key>base64encodedvalue==</private-key>
      <public-key>base64encodedvalue==</public-key>
      <cert>base64encodedvalue==</cert>
    </local-definition>
  </tls-server-identity>

  <!-- which certificates will this server trust -->
  <tls-client-auth>
    <pinned-ca-certs>explicitly-trusted-client-ca-certs</pinned-ca-c\
\erts>
    <pinned-client-certs>explicitly-trusted-client-certs</pinned-cli\
\ent-certs>
  </tls-client-auth>

</tls-server>
]]></artwork>
          </figure></t>

        <t>The following example configures the server identity using a key
        from the keystore: <figure>
            <artwork><![CDATA[
========== NOTE: '\\' line wrapping per BCP XX (RFC XXXX) ===========

<tls-server xmlns="urn:ietf:params:xml:ns:yang:ietf-tls-server">

  <!-- how this server will authenticate itself to the client -->
  <tls-server-identity>
    <keystore-reference>ex-rsa-cert</keystore-reference>
  </tls-server-identity>

  <!-- which certificates will this server trust -->
  <tls-client-auth>
    <pinned-ca-certs>explicitly-trusted-client-ca-certs</pinned-ca-c\
\erts>
    <pinned-client-certs>explicitly-trusted-client-certs</pinned-cli\
\ent-certs>
  </tls-client-auth>

</tls-server>
]]></artwork>
          </figure></t>
      </section>

      <section anchor="tls-server-yang-module" title="YANG Module">
        <t>This YANG module has a normative references to <xref
        target="RFC5246"/>, <xref target="I-D.ietf-netconf-trust-anchors"/>
        and <xref target="I-D.ietf-netconf-keystore"/>.</t>

        <t><figure>
            <artwork><![CDATA[
<CODE BEGINS> file "ietf-tls-server@2019-03-09.yang"
module ietf-tls-server {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-tls-server";
  prefix "tlss";

  import ietf-tls-common {
    prefix tlscmn;
    revision-date 2019-03-09; // stable grouping definitions
    reference
      "RFC XXXX: YANG Groupings for TLS Clients and TLS Servers";
  }

  import ietf-trust-anchors {
    prefix ta;
    reference
      "RFC YYYY: YANG Data Model for Global Trust Anchors";
  }

  import ietf-keystore {
    prefix ks;
    reference
      "RFC ZZZZ: YANG Data Model for a 'Keystore' Mechanism";
  }

  organization
   "IETF NETCONF (Network Configuration) Working Group";

  contact
   "WG Web:   <http://datatracker.ietf.org/wg/netconf/>
    WG List:  <mailto:netconf@ietf.org>
    Author:   Kent Watsen <mailto:kent+ietf@watsen.net>
    Author:   Gary Wu <mailto:garywu@cisco.com>";

  description
   "This module defines reusable groupings for TLS servers that
    can be used as a basis for specific TLS server instances.

    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 [RFC2119]
    [RFC8174] when, and only when, they appear in all
    capitals, as shown here.

    Copyright (c) 2019 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
    (http://trustee.ietf.org/license-info).

    This version of this YANG module is part of RFC XXXX; see
    the RFC itself for full legal notices.";

  revision "2019-03-09" {
    description
     "Initial version";
    reference
     "RFC XXXX: YANG Groupings for TLS Clients and TLS Servers";
  }

  // Features

  feature tls-server-hello-params-config {
    description
      "TLS hello message parameters are configurable on a TLS
       server.";
  }

  feature tls-server-keepalives {
    description
      "Per socket TLS keepalive parameters are configurable for
       TLS servers on the server implementing this feature.";
  }

  
  // Groupings

  grouping tls-server-grouping {
    description
      "A reusable grouping for configuring a TLS server without
       any consideration for how underlying TCP sessions are
       established.";
    uses server-identity-grouping;
    uses client-auth-grouping;
    uses hello-params-grouping;
    uses keepalives-grouping;
  }

  grouping server-identity-grouping {
    description
      "A reusable grouping for configuring a TLS server identity.";
    container tls-server-identity {
      description
        "A locally-defined or referenced end-entity certificate,
         including any configured intermediate certificates, the
         TLS server will present when establishing a TLS connection
         in its Certificate message, as defined in Section 7.4.2
         in RFC 5246.";
      reference
        "RFC 5246:
           The Transport Layer Security (TLS) Protocol Version 1.2
         RFC ZZZZ:
           YANG Data Model for a 'Keystore' Mechanism";
      uses ks:local-or-keystore-end-entity-cert-with-key-grouping;
    }
  }

  grouping client-auth-grouping {
    description
      "A reusable grouping for configuring a TLS client
       authentication.";
    container tls-client-auth {
      description
        "A reference to a list of pinned certificate authority (CA)
         certificates and a reference to a list of pinned client
         certificates.";
      leaf pinned-ca-certs {
        if-feature "ta:x509-certificates";
        type ta:pinned-certificates-ref;
        description
          "A reference to a list of certificate authority (CA) 
           certificates used by the TLS server to authenticate
           TLS client certificates.  A client certificate is
           authenticated if it has a valid chain of trust to
           a configured pinned CA certificate.";
        reference
          "RFC YYYY: YANG Data Model for Global Trust Anchors";
      }
      leaf pinned-client-certs {
        if-feature "ta:x509-certificates";
        type ta:pinned-certificates-ref;
        description
          "A reference to a list of client certificates used by 
           the TLS server to authenticate TLS client certificates.
           A clients certificate is authenticated if it is an
           exact match to a configured pinned client certificate.";
        reference
          "RFC YYYY: YANG Data Model for Global Trust Anchors";
      }
    }
  }

  grouping hello-params-grouping {
    description
      "A reusable grouping for configuring a TLS transport
       parameters.";
    container tls-hello-params {
      if-feature tls-server-hello-params-config;
      uses tlscmn:hello-params-grouping;
      description
        "Configurable parameters for the TLS hello message.";
    }
  }

  grouping keepalives-grouping {
    description
      "A reusable grouping for configuring TLS server keepalive
       parameters.";
    container tls-keepalives {
      if-feature "tls-server-keepalives";
      description
        "Configures the keep-alive policy, to proactively test
         the aliveness of the TLS client.  An unresponsive
         TLS client is dropped after approximately max-wait
         * max-attempts seconds.";
      leaf max-wait {
        type uint16 {
          range "1..max";
        }
        units seconds;
        default 30;
        description
         "Sets the amount of time in seconds after which if no data
          has been received from the TLS client, a TLS-level message
          will be sent to test the aliveness of the TLS client.";
      }
      leaf max-attempts {
        type uint8;
        default 3;
        description
         "Sets the maximum number of sequential keep-alive messages
         that can fail to obtain a response from the TLS client
         before assuming the TLS client is no longer alive.";
      }
    }
  }
}
<CODE ENDS>
]]></artwork>
          </figure></t>
      </section>
    </section>

    <section anchor="tls-common-model" title="The TLS Common Model">
      <t>The TLS common model presented in this section contains identities
      and groupings common to both TLS clients and TLS servers. The
      hello-params-grouping can be used to configure the list of TLS
      algorithms permitted by the TLS client or TLS server. The lists of
      algorithms are ordered such that, if multiple algorithms are permitted
      by the client, the algorithm that appears first in its list that is also
      permitted by the server is used for the TLS transport layer connection.
      The ability to restrict the algorithms allowed is provided in this
      grouping for TLS clients and TLS servers that are capable of doing so
      and may serve to make TLS clients and TLS servers compliant with local
      security policies. This model supports both TLS1.2 <xref
      target="RFC5246"/> and TLS 1.3 <xref target="RFC8446"/>.</t>

      <t>TLS 1.2 and TLS 1.3 have different ways defining their own supported
      cryptographic algorithms, see TLS and DTLS IANA registries page
      (https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml):</t>

      <t><list style="symbols">
          <t>TLS 1.2 defines four categories of registries for cryptographic
          algorithms: TLS Cipher Suites, TLS SignatureAlgorithm, TLS
          HashAlgorithm, TLS Supported Groups. TLS Cipher Suites plays the
          role of combining all of them into one set, as each value of the set
          represents a unique and feasible combination of all the
          cryptographic algorithms, and thus the other three registry
          categories do not need to be considered here. In this document, the
          TLS common model only chooses those TLS1.2 algorithms in TLS Cipher
          Suites which are marked as recommended:
          TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,
          TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,
          TLS_DHE_PSK_WITH_AES_128_GCM_SHA256,
          TLS_DHE_PSK_WITH_AES_256_GCM_SHA384, and so on. All chosen
          algorithms are enumerated in Table 1-1 below;</t>

          <t>TLS 1.3 defines its supported algorithms differently. Firstly, it
          defines three categories of registries for cryptographic algorithms:
          TLS Cipher Suites, TLS SignatureScheme, TLS Supported Groups.
          Secondly, all three of these categories are useful, since they
          represent different parts of all the supported algorithms
          respectively. Thus, all of these registries categories are
          considered here. In this draft, the TLS common model chooses only
          those TLS1.3 algorithms specified in B.4, 4.2.3, 4.2.7 of <xref
          target="RFC8446"/>.</t>
        </list></t>

      <t>Thus, in order to support both TLS1.2 and TLS1.3, the cipher-suites
      part of the hello-params-grouping should include three parameters for
      configuring its permitted TLS algorithms, which are: TLS Cipher Suites,
      TLS SignatureScheme, TLS Supported Groups. Note that TLS1.2 only uses
      TLS Cipher Suites.</t>

      <t><xref target="I-D.ietf-netconf-crypto-types"/> defines six categories
      of cryptographic algorithms (hash-algorithm,
      symmetric-key-encryption-algorithm, mac-algorithm,
      asymmetric-key-encryption-algorithm, signature-algorithm,
      key-negotiation-algorithm) and lists several widely accepted algorithms
      for each of them. The TLS client and server models use one or more of
      these algorithms. The following tables are provided, in part to define
      the subset of algorithms defined in the crypto-types model used by TLS,
      and in part to ensure compatibility of configured TLS cryptographic
      parameters for configuring its permitted TLS algorithms:<figure
          title="Table 1-1   TLS 1.2 Compatibility Matrix Part 1: ciper-suites mapping to hash-algorithm">
          <artwork align="center">+-----------------------------------------------+---------+
| ciper-suites in hello-params-grouping         |  HASH   |
+-----------------------------------------------+---------+
| TLS_DHE_RSA_WITH_AES_128_GCM_SHA256           | sha-256 |
| TLS_DHE_RSA_WITH_AES_256_GCM_SHA384           | sha-384 |
| TLS_DHE_PSK_WITH_AES_128_GCM_SHA256           | sha-256 |
| TLS_DHE_PSK_WITH_AES_256_GCM_SHA384           | sha-384 |
| TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256       | sha-256 |
| TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384       | sha-384 |
| TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256         | sha-256 |
| TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384         | sha-384 |
| TLS_DHE_RSA_WITH_AES_128_CCM                  | sha-256 |
| TLS_DHE_RSA_WITH_AES_256_CCM                  | sha-256 |
| TLS_DHE_PSK_WITH_AES_128_CCM                  | sha-256 |
| TLS_DHE_PSK_WITH_AES_256_CCM                  | sha-256 |
| TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256   | sha-256 |
| TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 | sha-256 |
| TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256     | sha-256 |
| TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256   | sha-256 |
| TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256     | sha-256 |
| TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256         | sha-256 |
| TLS_ECDHE_PSK_WITH_AES_256_GCM_SHA384         | sha-384 |
| TLS_ECDHE_PSK_WITH_AES_128_CCM_SHA256         | sha-256 |
+-----------------------------------------------+---------+</artwork>
        </figure><figure
          title="Table 1-2   TLS 1.2 Compatibility Matrix Part 2: ciper-suites mapping to symmetric-key-encryption-algorithm">
          <artwork align="center">+--------------------------------------------- +---------------------+
|  ciper-suites in hello-params-grouping       |      symmetric      |
|                                              |                     |
+--------------------------------------------- +---------------------+
| TLS_DHE_RSA_WITH_AES_128_GCM_SHA256          |   enc-aes-128-gcm   |
| TLS_DHE_RSA_WITH_AES_256_GCM_SHA384          |   enc-aes-256-gcm   |
| TLS_DHE_PSK_WITH_AES_128_GCM_SHA256          |   enc-aes-128-gcm   |
| TLS_DHE_PSK_WITH_AES_256_GCM_SHA384          |   enc-aes-256-gcm   |
| TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256      |   enc-aes-128-gcm   |
| TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384      |   enc-aes-256-gcm   |
| TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256        |   enc-aes-128-gcm   |
| TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384        |   enc-aes-256-gcm   |
| TLS_DHE_RSA_WITH_AES_128_CCM                 |   enc-aes-128-ccm   |
| TLS_DHE_RSA_WITH_AES_256_CCM                 |   enc-aes-256-ccm   |
| TLS_DHE_PSK_WITH_AES_128_CCM                 |   enc-aes-128-ccm   |
| TLS_DHE_PSK_WITH_AES_256_CCM                 |   enc-aes-256-ccm   |
| TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256  |enc-chacha20-poly1305|
| TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256|enc-chacha20-poly1305|
| TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256    |enc-chacha20-poly1305|
| TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256  |enc-chacha20-poly1305|
| TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256    |enc-chacha20-poly1305|
| TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256        |   enc-aes-128-gcm   |
| TLS_ECDHE_PSK_WITH_AES_256_GCM_SHA384        |   enc-aes-256-gcm   |
| TLS_ECDHE_PSK_WITH_AES_128_CCM_SHA256        |   enc-aes-128-ccm   |
+--------------------------------------------- +---------------------+</artwork>
        </figure><figure
          title="Table 1-3   TLS 1.2 Compatibility Matrix Part 3: ciper-suites mapping to MAC-algorithm">
          <artwork align="center">+--------------------------------------------- +---------------------+
|  ciper-suites in hello-params-grouping       |         MAC         |
|                                              |                     |
+--------------------------------------------- +---------------------+
| TLS_DHE_RSA_WITH_AES_128_GCM_SHA256          |   mac-aes-128-gcm   |
| TLS_DHE_RSA_WITH_AES_256_GCM_SHA384          |   mac-aes-256-gcm   |
| TLS_DHE_PSK_WITH_AES_128_GCM_SHA256          |   mac-aes-128-gcm   |
| TLS_DHE_PSK_WITH_AES_256_GCM_SHA384          |   mac-aes-256-gcm   |
| TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256      |   mac-aes-128-gcm   |
| TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384      |   mac-aes-256-gcm   |
| TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256        |   mac-aes-128-gcm   |
| TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384        |   mac-aes-256-gcm   |
| TLS_DHE_RSA_WITH_AES_128_CCM                 |   mac-aes-128-ccm   |
| TLS_DHE_RSA_WITH_AES_256_CCM                 |   mac-aes-256-ccm   |
| TLS_DHE_PSK_WITH_AES_128_CCM                 |   mac-aes-128-ccm   |
| TLS_DHE_PSK_WITH_AES_256_CCM                 |   mac-aes-256-ccm   |
| TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256  |mac-chacha20-poly1305|
| TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256|mac-chacha20-poly1305|
| TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256    |mac-chacha20-poly1305|
| TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256  |mac-chacha20-poly1305|
| TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256    |mac-chacha20-poly1305|
| TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256        |   mac-aes-128-gcm   |
| TLS_ECDHE_PSK_WITH_AES_256_GCM_SHA384        |   mac-aes-256-gcm   |
| TLS_ECDHE_PSK_WITH_AES_128_CCM_SHA256        |   mac-aes-128-ccm   |
+--------------------------------------------- +---------------------+</artwork>
        </figure><figure
          title="Table 1-4   TLS 1.2 Compatibility Matrix Part 4: ciper-suites mapping to signature-algorithm">
          <artwork align="center">+----------------------------------------------+----------------------+
|ciper-suites in hello-params-grouping         |        signature     |
+--------------------------------------------- +----------------------+
| TLS_DHE_RSA_WITH_AES_128_GCM_SHA256          | rsa-pkcs1-sha256     |
| TLS_DHE_RSA_WITH_AES_256_GCM_SHA384          | rsa-pkcs1-sha384     |
| TLS_DHE_PSK_WITH_AES_128_GCM_SHA256          |         N/A          |
| TLS_DHE_PSK_WITH_AES_256_GCM_SHA384          |         N/A          |
| TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256      |ecdsa-secp256r1-sha256|
| TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384      |ecdsa-secp384r1-sha384|
| TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256        | rsa-pkcs1-sha256     |
| TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384        | rsa-pkcs1-sha384     |
| TLS_DHE_RSA_WITH_AES_128_CCM                 | rsa-pkcs1-sha256     |
| TLS_DHE_RSA_WITH_AES_256_CCM                 | rsa-pkcs1-sha256     |
| TLS_DHE_PSK_WITH_AES_128_CCM                 |         N/A          |
| TLS_DHE_PSK_WITH_AES_256_CCM                 |         N/A          |
| TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256  | rsa-pkcs1-sha256     |
| TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256|ecdsa-secp256r1-sha256|
| TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256    | rsa-pkcs1-sha256     |
| TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256  |         N/A          |
| TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256    |         N/A          |
| TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256        |         N/A          |
| TLS_ECDHE_PSK_WITH_AES_256_GCM_SHA384        |         N/A          |
| TLS_ECDHE_PSK_WITH_AES_128_CCM_SHA256        |         N/A          |
+----------------------------------------------+----------------------+</artwork>
        </figure><figure
          title="Table 1-5   TLS 1.2 Compatibility Matrix Part 5: ciper-suites mapping to key-negotiation-algorithm">
          <artwork align="center">+----------------------------------------------+-----------------------+
|ciper-suites in hello-params-grouping         |     key-negotiation   |
+----------------------------------------------+-----------------------+
| TLS_DHE_RSA_WITH_AES_128_GCM_SHA256          | dhe-ffdhe2048, ...    |
| TLS_DHE_RSA_WITH_AES_256_GCM_SHA384          | dhe-ffdhe2048, ...    |
| TLS_DHE_PSK_WITH_AES_128_GCM_SHA256          | psk-dhe-ffdhe2048, ...|
| TLS_DHE_PSK_WITH_AES_256_GCM_SHA384          | psk-dhe-ffdhe2048, ...|
| TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256      | ecdhe-secp256r1, ...  |
| TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384      | ecdhe-secp256r1, ...  |
| TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256        | ecdhe-secp256r1, ...  |
| TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384        | ecdhe-secp256r1, ...  |
| TLS_DHE_RSA_WITH_AES_128_CCM                 | dhe-ffdhe2048, ...    |
| TLS_DHE_RSA_WITH_AES_256_CCM                 | dhe-ffdhe2048, ...    |
| TLS_DHE_PSK_WITH_AES_128_CCM                 | psk-dhe-ffdhe2048, ...|
| TLS_DHE_PSK_WITH_AES_256_CCM                 | psk-dhe-ffdhe2048, ...|
| TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256  | ecdhe-secp256r1, ...  |
| TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256| ecdhe-secp256r1, ...  |
| TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256    | dhe-ffdhe2048, ...    |
| TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256  |psk-ecdhe-secp256r1,...|
| TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256    | psk-dhe-ffdhe2048, ...|
| TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256        |psk-ecdhe-secp256r1,...|
| TLS_ECDHE_PSK_WITH_AES_256_GCM_SHA384        |psk-ecdhe-secp256r1,...|
| TLS_ECDHE_PSK_WITH_AES_128_CCM_SHA256        |psk-ecdhe-secp256r1,...|
+----------------------------------------------+-----------------------+</artwork>
        </figure><figure
          title="Table 2-1   TLS 1.3 Compatibility Matrix Part 1: ciper-suites mapping to hash-algorithm">
          <artwork align="center">+------------------------------+---------+
|    ciper-suites in hello     |   HASH  |
|      -params-grouping        |         |
+------------------------------+---------+
| TLS_AES_128_GCM_SHA256       | sha-256 |
| TLS_AES_256_GCM_SHA384       | sha-384 |
| TLS_CHACHA20_POLY1305_SHA256 | sha-256 |
| TLS_AES_128_CCM_SHA256       | sha-256 |
+------------------------------+---------+</artwork>
        </figure><figure
          title="Table 2-2   TLS 1.3 Compatibility Matrix Part 2: ciper-suites mapping to symmetric-key--encryption-algorithm">
          <artwork align="center">+------------------------------+-----------------------+
|    ciper-suites in hello     |    symmetric          |
|      -params-grouping        |                       |
+------------------------------+-----------------------+
| TLS_AES_128_GCM_SHA256       | enc-aes-128-gcm       |
| TLS_AES_256_GCM_SHA384       | enc-aes-128-gcm       |
| TLS_CHACHA20_POLY1305_SHA256 | enc-chacha20-poly1305 |
| TLS_AES_128_CCM_SHA256       | enc-aes-128-ccm       |
+------------------------------+-----------------------+</artwork>
        </figure><figure
          title="Table 2-3   TLS 1.3 Compatibility Matrix Part 3: ciper-suites mapping to MAC-algorithm">
          <artwork align="center">+------------------------------+-----------------------+
|    ciper-suites in hello     |    symmetric          |
|      -params-grouping        |                       |
+------------------------------+-----------------------+
| TLS_AES_128_GCM_SHA256       | mac-aes-128-gcm       |
| TLS_AES_256_GCM_SHA384       | mac-aes-128-gcm       |
| TLS_CHACHA20_POLY1305_SHA256 | mac-chacha20-poly1305 |
| TLS_AES_128_CCM_SHA256       | mac-aes-128-ccm       |
+------------------------------+-----------------------+</artwork>
        </figure><figure
          title="Table 2-4   TLS 1.3 Compatibility Matrix Part 4: SignatureScheme mapping to signature-algorithm">
          <artwork align="center">+----------------------------+-------------------------+
|signatureScheme in hello    |  signature              |
|   -params-grouping         |                         |
+----------------------------+-------------------------+
| rsa-pkcs1-sha256           |  rsa-pkcs1-sha256       |
| rsa-pkcs1-sha384           |  rsa-pkcs1-sha384       |
| rsa-pkcs1-sha512           |  rsa-pkcs1-sha512       |
| rsa-pss-rsae-sha256        |  rsa-pss-rsae-sha256    |
| rsa-pss-rsae-sha384        |  rsa-pss-rsae-sha384    |
| rsa-pss-rsae-sha512        |  rsa-pss-rsae-sha512    |
| rsa-pss-pss-sha256         |  rsa-pss-pss-sha256     |
| rsa-pss-pss-sha384         |  rsa-pss-pss-sha384     |
| rsa-pss-pss-sha512         |  rsa-pss-pss-sha512     |
| ecdsa-secp256r1-sha256     |  ecdsa-secp256r1-sha256 |
| ecdsa-secp384r1-sha384     |  ecdsa-secp384r1-sha384 |
| ecdsa-secp521r1-sha512     |  ecdsa-secp521r1-sha512 |
| ed25519                    |  ed25519                |
| ed448                      |  ed448                  |
+----------------------------+-------------------------+</artwork>
        </figure><figure
          title="Table 2-5   TLS 1.3 Compatibility Matrix Part 5: Supported Groups mapping to key-negotiation-algorithm">
          <artwork align="center">+----------------------------+-------------------------+
|supported Groups in hello   |     key-negotiation     |
|   -params-grouping         |                         |
+----------------------------+-------------------------+
| dhe-ffdhe2048              | dhe-ffdhe2048           |
| dhe-ffdhe3072              | dhe-ffdhe3072           |
| dhe-ffdhe4096              | dhe-ffdhe4096           |
| dhe-ffdhe6144              | dhe-ffdhe6144           |
| dhe-ffdhe8192              | dhe-ffdhe8192           |
| psk-dhe-ffdhe2048          | psk-dhe-ffdhe2048       |
| psk-dhe-ffdhe3072          | psk-dhe-ffdhe3072       |
| psk-dhe-ffdhe4096          | psk-dhe-ffdhe4096       |
| psk-dhe-ffdhe6144          | psk-dhe-ffdhe6144       |
| psk-dhe-ffdhe8192          | psk-dhe-ffdhe8192       |
| ecdhe-secp256r1            | ecdhe-secp256r1         |
| ecdhe-secp384r1            | ecdhe-secp384r1         |
| ecdhe-secp521r1            | ecdhe-secp521r1         |
| ecdhe-x25519               | ecdhe-x25519            |
| ecdhe-x448                 | ecdhe-x448              |
| psk-ecdhe-secp256r1        | psk-ecdhe-secp256r1     |
| psk-ecdhe-secp384r1        | psk-ecdhe-secp384r1     |
| psk-ecdhe-secp521r1        | psk-ecdhe-secp521r1     |
| psk-ecdhe-x25519           | psk-ecdhe-x25519        |
| psk-ecdhe-x448             | psk-ecdhe-x448          |
+----------------------------+-------------------------+
</artwork>
        </figure></t>

      <t>Note that in Table 1-5:<list style="symbols">
          <t>dhe-ffdhe2048, ... is the abbreviation of dhe-ffdhe2048,
          dhe-ffdhe3072, dhe-ffdhe4096, dhe-ffdhe6144, dhe-ffdhe8192;</t>

          <t>psk-dhe-ffdhe2048, ... is the abbreviation of psk-dhe-ffdhe2048,
          psk-dhe-ffdhe3072, psk-dhe-ffdhe4096, psk-dhe-ffdhe6144,
          psk-dhe-ffdhe8192;</t>

          <t>ecdhe-secp256r1, ... is the abbreviation of ecdhe-secp256r1,
          ecdhe-secp384r1, ecdhe-secp521r1, ecdhe-x25519, ecdhe-x448;</t>

          <t>psk-ecdhe-secp256r1, ... is the abbreviation of
          psk-ecdhe-secp256r1, psk-ecdhe-secp384r1, psk-ecdhe-secp521r1,
          psk-ecdhe-x25519, psk-ecdhe-x448.</t>
        </list></t>

      <t>Features are defined for algorithms that are OPTIONAL or are not
      widely supported by popular implementations. Note that the list of
      algorithms is not exhaustive.</t>

      <section title="Tree Diagram">
        <t>The following tree diagram <xref target="RFC8340"/> provides an
        overview of the data model for the "ietf-tls-common" module.</t>

        <t><figure>
            <artwork><![CDATA[
module: ietf-tls-common

  grouping hello-params-grouping
    +-- tls-versions
    |  +-- tls-version*   identityref
    +-- cipher-suites
       +-- cipher-suite*   identityref
]]></artwork>
          </figure></t>
      </section>

      <section title="Example Usage">
        <t>This section shows how it would appear if the
        transport-params-grouping were populated with some data.</t>

        <t><figure>
            <artwork><![CDATA[
<hello-params
   xmlns="urn:ietf:params:xml:ns:yang:ietf-tls-common"
   xmlns:tlscmn="urn:ietf:params:xml:ns:yang:ietf-tls-common">
  <tls-versions>
    <tls-version>tlscmn:tls-1.1</tls-version>
    <tls-version>tlscmn:tls-1.2</tls-version>
  </tls-versions>
  <cipher-suites>
    <cipher-suite>tlscmn:dhe-rsa-with-aes-128-cbc-sha</cipher-suite>
    <cipher-suite>tlscmn:rsa-with-aes-128-cbc-sha</cipher-suite>
    <cipher-suite>tlscmn:rsa-with-3des-ede-cbc-sha</cipher-suite>
  </cipher-suites>
</hello-params>
]]></artwork>
          </figure></t>
      </section>

      <section anchor="tls-common-yang-module" title="YANG Module">
        <t>This YANG module has a normative references to <xref target="RFC4346"/>, <xref
        target="RFC5246"/>, <xref target="RFC5288"/>, <xref
        target="RFC5289"/>, and <xref target="RFC8422"/>.</t>

        <t>This YANG module has a informative references to <xref
        target="RFC2246"/>, <xref target="RFC4346"/>, <xref
        target="RFC5246"/>, and <xref target="RFC8446"/>.</t>

        <t><figure>
            <artwork><![CDATA[
<CODE BEGINS> file "ietf-tls-common@2019-03-09.yang"
module ietf-tls-common {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-tls-common";
  prefix "tlscmn";

  organization
   "IETF NETCONF (Network Configuration) Working Group";

  contact
   "WG Web:   <http://datatracker.ietf.org/wg/netconf/>
    WG List:  <mailto:netconf@ietf.org>
    Author:   Kent Watsen <mailto:kent+ietf@watsen.net>
    Author:   Gary Wu <mailto:garywu@cisco.com>";

  description
   "This module defines a common features, identities, and
    groupings for Transport Layer Security (TLS).

    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 [RFC2119]
    [RFC8174] when, and only when, they appear in all
    capitals, as shown here.

    Copyright (c) 2019 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
    (http://trustee.ietf.org/license-info).

    This version of this YANG module is part of RFC XXXX; see
    the RFC itself for full legal notices.";

  revision "2019-03-09" {
    description
     "Initial version";
    reference
     "RFC XXXX: YANG Groupings for TLS Clients and TLS Servers";
  }

  // Features

  feature tls-1_0 {
    description
      "TLS Protocol Version 1.0 is supported.";
    reference
      "RFC 2246: The TLS Protocol Version 1.0";
  }

  feature tls-1_1 {
    description
      "TLS Protocol Version 1.1 is supported.";
    reference
      "RFC 4346: The Transport Layer Security (TLS) Protocol
                 Version 1.1";
  }

  feature tls-1_2 {
    description
      "TLS Protocol Version 1.2 is supported.";
    reference
      "RFC 5246: The Transport Layer Security (TLS) Protocol
                 Version 1.2";
  }

  feature tls-1_3 {
    description
      "TLS Protocol Version 1.2 is supported.";
    reference
      "RFC 8446: The Transport Layer Security (TLS) Protocol
                 Version 1.3";
  }

  feature tls-ecc {
    description
      "Elliptic Curve Cryptography (ECC) is supported for TLS.";
    reference
      "RFC 8422: Elliptic Curve Cryptography (ECC) Cipher Suites
                 for Transport Layer Security (TLS)";
  }

  feature tls-dhe {
    description
      "Ephemeral Diffie-Hellman key exchange is supported for TLS.";
    reference
      "RFC 5246: The Transport Layer Security (TLS) Protocol
                 Version 1.2";
  }

  feature tls-3des {
    description
      "The Triple-DES block cipher is supported for TLS.";
    reference
      "RFC 5246: The Transport Layer Security (TLS) Protocol
                 Version 1.2";
  }

  feature tls-gcm {
    description
      "The Galois/Counter Mode authenticated encryption mode is
       supported for TLS.";
    reference
      "RFC 5288: AES Galois Counter Mode (GCM) Cipher Suites for
                 TLS";
  }

  feature tls-sha2 {
    description
      "The SHA2 family of cryptographic hash functions is supported
       for TLS.";
    reference
      "FIPS PUB 180-4: Secure Hash Standard (SHS)";
  }

  // Identities

  identity tls-version-base {
    description
      "Base identity used to identify TLS protocol versions.";
  }

  identity tls-1.0 {
    base tls-version-base;
    if-feature tls-1_0;
    description
      "TLS Protocol Version 1.0.";
    reference
      "RFC 2246: The TLS Protocol Version 1.0";
  }

  identity tls-1.1 {
    base tls-version-base;
    if-feature tls-1_1;
    description
      "TLS Protocol Version 1.1.";
    reference
      "RFC 4346: The Transport Layer Security (TLS) Protocol
                 Version 1.1";
  }

  identity tls-1.2 {
    base tls-version-base;
    if-feature tls-1_2;
    description
      "TLS Protocol Version 1.2.";
    reference
      "RFC 5246: The Transport Layer Security (TLS) Protocol
                 Version 1.2";
  }

  identity cipher-suite-base {
    description
      "Base identity used to identify TLS cipher suites.";
  }

  identity rsa-with-aes-128-cbc-sha {
    base cipher-suite-base;
    description
      "Cipher suite TLS_RSA_WITH_AES_128_CBC_SHA.";
    reference
      "RFC 5246: The Transport Layer Security (TLS) Protocol
                 Version 1.2";
  }

  identity rsa-with-aes-256-cbc-sha {
    base cipher-suite-base;
    description
      "Cipher suite TLS_RSA_WITH_AES_256_CBC_SHA.";
    reference
      "RFC 5246: The Transport Layer Security (TLS) Protocol
                 Version 1.2";
  }

  identity rsa-with-aes-128-cbc-sha256 {
    base cipher-suite-base;
    if-feature tls-sha2;
    description
      "Cipher suite TLS_RSA_WITH_AES_128_CBC_SHA256.";
    reference
      "RFC 5246: The Transport Layer Security (TLS) Protocol
                 Version 1.2";
  }

  identity rsa-with-aes-256-cbc-sha256 {
    base cipher-suite-base;
    if-feature tls-sha2;
    description
      "Cipher suite TLS_RSA_WITH_AES_256_CBC_SHA256.";
    reference
      "RFC 5246: The Transport Layer Security (TLS) Protocol
                 Version 1.2";
  }

  identity dhe-rsa-with-aes-128-cbc-sha {
    base cipher-suite-base;
    if-feature tls-dhe;
    description
      "Cipher suite TLS_DHE_RSA_WITH_AES_128_CBC_SHA.";
    reference
      "RFC 5246: The Transport Layer Security (TLS) Protocol
                 Version 1.2";
  }

  identity dhe-rsa-with-aes-256-cbc-sha {
    base cipher-suite-base;
    if-feature tls-dhe;
    description
      "Cipher suite TLS_DHE_RSA_WITH_AES_256_CBC_SHA.";
    reference
      "RFC 5246: The Transport Layer Security (TLS) Protocol
                 Version 1.2";
  }

  identity dhe-rsa-with-aes-128-cbc-sha256 {
    base cipher-suite-base;
    if-feature "tls-dhe and tls-sha2";
    description
      "Cipher suite TLS_DHE_RSA_WITH_AES_128_CBC_SHA256.";
    reference
      "RFC 5246: The Transport Layer Security (TLS) Protocol
                 Version 1.2";
  }

  identity dhe-rsa-with-aes-256-cbc-sha256 {
    base cipher-suite-base;
    if-feature "tls-dhe and tls-sha2";
    description
      "Cipher suite TLS_DHE_RSA_WITH_AES_256_CBC_SHA256.";
    reference
      "RFC 5246: The Transport Layer Security (TLS) Protocol
                 Version 1.2";
  }

  identity ecdhe-ecdsa-with-aes-128-cbc-sha256 {
    base cipher-suite-base;
    if-feature "tls-ecc and tls-sha2";
    description
      "Cipher suite TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256.";
    reference
      "RFC 5289: TLS Elliptic Curve Cipher Suites with
                 SHA-256/384 and AES Galois Counter Mode (GCM)";
  }

  identity ecdhe-ecdsa-with-aes-256-cbc-sha384 {
    base cipher-suite-base;
    if-feature "tls-ecc and tls-sha2";
    description
      "Cipher suite TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384.";
    reference
      "RFC 5289: TLS Elliptic Curve Cipher Suites with
                 SHA-256/384 and AES Galois Counter Mode (GCM)";
  }

  identity ecdhe-rsa-with-aes-128-cbc-sha256 {
    base cipher-suite-base;
    if-feature "tls-ecc and tls-sha2";
    description
      "Cipher suite TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256.";
    reference
      "RFC 5289: TLS Elliptic Curve Cipher Suites with
                 SHA-256/384 and AES Galois Counter Mode (GCM)";
  }

  identity ecdhe-rsa-with-aes-256-cbc-sha384 {
    base cipher-suite-base;
    if-feature "tls-ecc and tls-sha2";
    description
      "Cipher suite TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384.";
    reference
      "RFC 5289: TLS Elliptic Curve Cipher Suites with
                 SHA-256/384 and AES Galois Counter Mode (GCM)";
  }

  identity ecdhe-ecdsa-with-aes-128-gcm-sha256 {
    base cipher-suite-base;
    if-feature "tls-ecc and tls-gcm and tls-sha2";
    description
      "Cipher suite TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256.";
    reference
      "RFC 5289: TLS Elliptic Curve Cipher Suites with
                 SHA-256/384 and AES Galois Counter Mode (GCM)";
  }

  identity ecdhe-ecdsa-with-aes-256-gcm-sha384 {
    base cipher-suite-base;
    if-feature "tls-ecc and tls-gcm and tls-sha2";
    description
      "Cipher suite TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384.";
    reference
      "RFC 5289: TLS Elliptic Curve Cipher Suites with
                 SHA-256/384 and AES Galois Counter Mode (GCM)";
  }

  identity ecdhe-rsa-with-aes-128-gcm-sha256 {
    base cipher-suite-base;
    if-feature "tls-ecc and tls-gcm and tls-sha2";
    description
      "Cipher suite TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256.";
    reference
      "RFC 5289: TLS Elliptic Curve Cipher Suites with
                 SHA-256/384 and AES Galois Counter Mode (GCM)";
  }

  identity ecdhe-rsa-with-aes-256-gcm-sha384 {
    base cipher-suite-base;
    if-feature "tls-ecc and tls-gcm and tls-sha2";
    description
      "Cipher suite TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384.";
    reference
      "RFC 5289: TLS Elliptic Curve Cipher Suites with
                 SHA-256/384 and AES Galois Counter Mode (GCM)";
  }

  identity rsa-with-3des-ede-cbc-sha {
    base cipher-suite-base;
    if-feature tls-3des;
    description
      "Cipher suite TLS_RSA_WITH_3DES_EDE_CBC_SHA.";
    reference
      "RFC 5246: The Transport Layer Security (TLS) Protocol
                 Version 1.2";
  }

  identity ecdhe-rsa-with-3des-ede-cbc-sha {
    base cipher-suite-base;
    if-feature "tls-ecc and tls-3des";
    description
      "Cipher suite TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA.";
    reference
      "RFC 8422: Elliptic Curve Cryptography (ECC) Cipher Suites
                 for Transport Layer Security (TLS)";
  }

  identity ecdhe-rsa-with-aes-128-cbc-sha {
    base cipher-suite-base;
    if-feature "tls-ecc";
    description
      "Cipher suite TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA.";
    reference
      "RFC 8422: Elliptic Curve Cryptography (ECC) Cipher Suites
                 for Transport Layer Security (TLS)";
  }

  identity ecdhe-rsa-with-aes-256-cbc-sha {
    base cipher-suite-base;
    if-feature "tls-ecc";
    description
      "Cipher suite TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA.";
    reference
      "RFC 8422: Elliptic Curve Cryptography (ECC) Cipher Suites
                 for Transport Layer Security (TLS)";
  }

  // Groupings

  grouping hello-params-grouping {
    description
      "A reusable grouping for TLS hello message parameters.";
    reference
      "RFC 5246: The Transport Layer Security (TLS) Protocol
                 Version 1.2";

    container tls-versions {
      description
        "Parameters regarding TLS versions.";
      leaf-list tls-version {
        type identityref {
          base tls-version-base;
        }
        description
          "Acceptable TLS protocol versions.

           If this leaf-list is not configured (has zero elements)
           the acceptable TLS protocol versions are implementation-
           defined.";
      }
    }
    container cipher-suites {
      description
        "Parameters regarding cipher suites.";
      leaf-list cipher-suite {
        type identityref {
          base cipher-suite-base;
        }
        ordered-by user;
        description
          "Acceptable cipher suites in order of descending
           preference.  The configured host key algorithms should
           be compatible with the algorithm used by the configured
           private key.  Please see Section 5 of RFC XXXX for
           valid combinations.

           If this leaf-list is not configured (has zero elements)
           the acceptable cipher suites are implementation-
           defined.";
        reference
         "RFC XXXX: YANG Groupings for TLS Clients and TLS Servers";
      }
    }

  }
}
<CODE ENDS>
]]></artwork>
          </figure></t>
      </section>
    </section>

    <section title="Security Considerations">
      <t>The YANG modules defined in this document are designed to be accessed
      via YANG based management protocols, such as NETCONF <xref
      target="RFC6241"/> and RESTCONF <xref target="RFC8040"/>. Both of these
      protocols have mandatory-to-implement secure transport layers (e.g.,
      SSH, TLS) with mutual authentication.</t>

      <t>The NETCONF access control model (NACM) <xref target="RFC8341"/>
      provides the means to restrict access for particular users to a
      pre-configured subset of all available protocol operations and
      content.</t>

      <t>Since the modules defined in this document only define groupings,
      these considerations are primarily for the designers of other modules
      that use these groupings.</t>

      <t>There are a number of data nodes defined in the YANG modules 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. These are the subtrees and data nodes and their
      sensitivity/vulnerability: <list hangIndent="6" style="hanging">
          <t hangText="   /:">The entire data tree of all the groupings
          defined in this draft is sensitive to write operations. For
          instance, the addition or removal of references to keys,
          certificates, trusted anchors, etc., can dramatically alter the
          implemented security policy. However, no NACM annotations are
          applied as the data SHOULD be editable by users other than a
          designated 'recovery session'.</t>

          <!-- KENT, FIXME -->
        </list></t>

      <t>Some of the readable data nodes in the YANG modules 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. These are the subtrees and data nodes
      and their sensitivity/vulnerability: <list hangIndent="6"
          style="hanging">
          <t hangText="   NONE"/>
        </list></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. These are the
      operations and their sensitivity/vulnerability: <list hangIndent="6"
          style="hanging">
          <t hangText="   NONE"/>
        </list></t>
    </section>

    <section title="IANA Considerations">
      <section title="The IETF XML Registry">
        <t>This document registers three URIs in the "ns" subregistry of the
        IETF XML Registry <xref target="RFC3688"/>. Following the format in
        <xref target="RFC3688"/>, the following registrations are
        requested:</t>

        <t><figure>
            <artwork>
   URI: urn:ietf:params:xml:ns:yang:ietf-tls-client
   Registrant Contact: The NETCONF WG of the IETF.
   XML: N/A, the requested URI is an XML namespace.

   URI: urn:ietf:params:xml:ns:yang:ietf-tls-server
   Registrant Contact: The NETCONF WG of the IETF.
   XML: N/A, the requested URI is an XML namespace.

   URI: urn:ietf:params:xml:ns:yang:ietf-tls-common
   Registrant Contact: The NETCONF WG of the IETF.
   XML: N/A, the requested URI is an XML namespace.
</artwork>
          </figure></t>
      </section>

      <section title="The YANG Module Names Registry">
        <t>This document registers three 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>
   name:         ietf-tls-client
   namespace:    urn:ietf:params:xml:ns:yang:ietf-tls-client
   prefix:       tlsc
   reference:    RFC XXXX

   name:         ietf-tls-server
   namespace:    urn:ietf:params:xml:ns:yang:ietf-tls-server
   prefix:       tlss
   reference:    RFC XXXX

   name:         ietf-tls-common
   namespace:    urn:ietf:params:xml:ns:yang:ietf-tls-common
   prefix:       tlscmn
   reference:    RFC XXXX
</artwork>
          </figure></t>
      </section>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include="reference.RFC.2119.xml"?>
      <?rfc include="reference.RFC.5288.xml"?>
      <?rfc include="reference.RFC.5289.xml"?>
      <?rfc include="reference.RFC.6020.xml"?>
      <?rfc include="reference.RFC.7589.xml"?>
      <?rfc include="reference.RFC.7950.xml"?>
      <?rfc include="reference.RFC.8174.xml"?>
      <?rfc include="reference.RFC.8341.xml"?>
      <?rfc include="reference.RFC.8422.xml"?>
      <?rfc include="reference.RFC.8446.xml"?>
      <?rfc include="reference.I-D.ietf-netconf-trust-anchors"?>
      <?rfc include="reference.I-D.ietf-netconf-keystore"?>
      <?rfc include="reference.I-D.ietf-netconf-crypto-types"?>
    </references>

    <references title="Informative References">
      <?rfc include="reference.RFC.2818.xml"?>
      <?rfc include="reference.RFC.2246.xml"?>
      <?rfc include="reference.RFC.3688.xml"?>
      <?rfc include="reference.RFC.4346.xml"?>
      <?rfc include="reference.RFC.5246.xml"?>
      <?rfc include="reference.RFC.6241.xml"?>
      <?rfc include="reference.RFC.8040.xml"?>
      <?rfc include="reference.RFC.8071.xml"?>
      <?rfc include="reference.RFC.8340.xml"?>
    </references>

    <section title="Change Log">
      <section title="00 to 01">
        <t><list style="symbols">
            <t>Noted that '0.0.0.0' and '::' might have special meanings.</t>

            <t>Renamed "keychain" to "keystore".</t>
          </list></t>
      </section>

      <section title="01 to 02">
        <t><list style="symbols">
            <t>Removed the groupings containing transport-level configuration.
            Now modules contain only the transport-independent groupings.</t>

            <t>Filled in previously incomplete 'ietf-tls-client' module.</t>

            <t>Added cipher suites for various algorithms into new
            'ietf-tls-common' module.</t>
          </list></t>
      </section>

      <section title="02 to 03">
        <t><list style="symbols">
            <t>Added a 'must' statement to container 'server-auth' asserting
            that at least one of the various auth mechanisms must be
            specified.</t>

            <t>Fixed description statement for leaf 'trusted-ca-certs'.</t>
          </list></t>
      </section>

      <section title="03 to 04">
        <t><list style="symbols">
            <t>Updated title to "YANG Groupings for TLS Clients and TLS
            Servers"</t>

            <t>Updated leafref paths to point to new keystore path</t>

            <t>Changed the YANG prefix for ietf-tls-common from 'tlscom' to
            'tlscmn'.</t>

            <t>Added TLS protocol verions 1.0 and 1.1.</t>

            <t>Made author lists consistent</t>

            <t>Now tree diagrams reference ietf-netmod-yang-tree-diagrams</t>

            <t>Updated YANG to use typedefs around leafrefs to common keystore
            paths</t>

            <t>Now inlines key and certificates (no longer a leafref to
            keystore)</t>
          </list></t>
      </section>

      <section title="04 to 05">
        <t><list style="symbols">
            <t>Merged changes from co-author.</t>
          </list></t>
      </section>

      <section title="05 to 06">
        <t><list style="symbols">
            <t>Updated to use trust anchors from trust-anchors draft (was
            keystore draft)</t>

            <t>Now Uses new keystore grouping enabling asymmetric key to be
            either locally defined or a reference to the keystore.</t>
          </list></t>
      </section>

      <section title="06 to 07">
        <t><list style="symbols">
            <t>factored the tls-[client|server]-groupings into more reusable
            groupings.</t>

            <t>added if-feature statements for the new "x509-certificates"
            feature defined in draft-ietf-netconf-trust-anchors.</t>
          </list></t>
      </section>

      <section title="07 to 08">
        <t>
          <list style="symbols">
            <t>Added a number of compatibility matrices to Section 5 (thanks Frank!)</t>
            <t>Clarified that any configured "cipher-suite" values need to be 
               compatible with the configured private key.</t>
          </list>
        </t>
      </section>

      <section title="08 to 09">
        <t>
          <list style="symbols">
            <t>Updated examples to reflect update to groupings defined in the keystore draft.</t>
            <t>Add TLS keepalives features and groupings.</t>
            <t>Prefixed top-level TLS grouping nodes with 'tls-' and support mashups.</t>
            <t>Updated copyright date, boilerplate template, affiliation, and folding algorithm.</t>
          </list>
        </t>
      </section>

    </section>

    <section numbered="no" title="Acknowledgements">
      <t>The authors would like to thank for following for lively discussions
      on list and in the halls (ordered by last name): Andy Bierman, Martin
      Bjorklund, Benoit Claise, Mehmet Ersue, Balázs Kovács, David Lamparter,
      Alan Luchuk, Ladislav Lhotka, Radek Krejci, Tom Petch, Juergen
      Schoenwaelder, Phil Shafer, Sean Turner, and Bert Wijnen.</t>
    </section>
  </back>
</rfc>
