<?xml version='1.0'?>
<!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"
     ipr="trust200902"
     docName="draft-ietf-netconf-trust-anchors-03" >
    <front>
        <title>YANG Data Model for Global Trust Anchors</title>
        <author initials="K." surname="Watsen" fullname="Kent Watsen">
            <organization>Watsen Networks</organization>
            <address>
                <email>kent+ietf@watsen.net</email>
            </address>
        </author>
        <date/>
        <area>Operations</area>
        <workgroup>NETCONF Working Group</workgroup>
        <abstract>
          <t>This document defines a YANG 1.1 data model for configuring
          global sets of X.509 certificates and SSH host-keys that
          can be referenced by other data models for trust.  While
          the SSH host-keys are uniquely for the SSH protocol, the
          X.509 certificates may have multiple uses, including
          authenticating protocol peers and verifying signatures.</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>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 draft-ietf-netconf-crypto-types</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 a YANG 1.1 <xref target="RFC7950"/> data
        model for configuring global sets of X.509 certificates and SSH
        host-keys that can be referenced by other data models for trust.
        While the SSH host-keys are uniquely for the SSH protocol, the
        X.509 certificates may be used for multiple uses, including
        authenticating protocol peers and verifying signatures.</t>

        <t>This document in compliant with Network Management Datastore Architecture
        (NMDA) <xref target="RFC8342"/>.  For instance, to support trust anchors
        installed during manufacturing, it is expected that such data may appear
        only in &lt;operational&gt;.</t>

        <section title="Requirements Language" anchor="requirements-language">
          <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
          NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED",
          "MAY", and "OPTIONAL" in this document are to be interpreted as
          described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/>
          when, and only when, they appear in all capitals, as shown here.</t>
        </section>

        <section title="Tree Diagram Notation">
          <t>Tree diagrams used in this document follow the notation
          defined in <xref target="RFC8340"/>.</t>
        </section>

      </section>

      <section title="The Trust Anchors Model">
  
        <section title="Tree Diagram">
          <t>The following tree diagram provides an overview of the
          "ietf-trust-anchors" module.</t>
          <t>
            <figure>
              <artwork><![CDATA[
module: ietf-trust-anchors
  +--rw trust-anchors
     +--rw pinned-certificates* [name] {x509-certificates}?
     |  +--rw name                  string
     |  +--rw description?          string
     |  +--rw pinned-certificate* [name]
     |     +--rw name                      string
     |     +--rw cert                      trust-anchor-cert-cms
     |     +---n certificate-expiration
     |        +-- expiration-date    yang:date-and-time
     +--rw pinned-host-keys* [name] {ssh-host-keys}?
        +--rw name               string
        +--rw description?       string
        +--rw pinned-host-key* [name]
           +--rw name        string
           +--rw host-key    ct:ssh-host-key
  ]]></artwork>
            </figure>
          </t>
        </section>
  
        <section title="Example Usage">
          <t>The following example illustrates trust anchors in &lt;operational&gt; as described
          by Section 5.3 in <xref target="RFC8342"/>.  This datastore view illustrates 
          data set by the manufacturing process alongside conventional configuration.  This
          trust anchors instance has six sets of pinned certificates and one set of pinned
          host keys.</t>
          <t>
            <figure>
              <artwork><![CDATA[
<trust-anchors
   xmlns="urn:ietf:params:xml:ns:yang:ietf-trust-anchors"
   xmlns:or="urn:ietf:params:xml:ns:yang:ietf-origin">

  <!-- Manufacturer's trusted root CA certs -->
  <pinned-certificates or:origin="or:system">
    <name>manufacturers-root-ca-certs</name>
    <description>
      Certificates built into the device for authenticating
      manufacturer-signed objects, such as TLS server certificates,
      vouchers, etc.  Note, though listed here, these are not
      configurable; any attempt to do so will be denied.
    </description>
    <pinned-certificate>
      <name>Manufacturer Root CA cert 1</name>
      <cert>base64encodedvalue==</cert>
    </pinned-certificate>
    <pinned-certificate>
      <name>Manufacturer Root CA cert 2</name>
      <cert>base64encodedvalue==</cert>
    </pinned-certificate>
  </pinned-certificates>

  <!-- specific end-entity certs for authenticating servers -->
  <pinned-certificates or:origin="or:intended">
    <name>explicitly-trusted-server-certs</name>
    <description>
      Specific server authentication certificates for explicitly
      trusted servers.  These are needed for server certificates
      that are not signed by a pinned CA.
    </description>
    <pinned-certificate>
      <name>Fred Flintstone</name>
      <cert>base64encodedvalue==</cert>
    </pinned-certificate>
  </pinned-certificates>

  <!-- trusted CA certs for authenticating servers -->
  <pinned-certificates or:origin="or:intended">
    <name>explicitly-trusted-server-ca-certs</name>
    <description>
      Trust anchors (i.e. CA certs) that are used to authenticate 
      server connections.  Servers are authenticated if their
      certificate has a chain of trust to one of these CA
      certificates.
    </description>
    <pinned-certificate>
      <name>ca.example.com</name>
      <cert>base64encodedvalue==</cert>
    </pinned-certificate>
  </pinned-certificates>

  <!-- specific end-entity certs for authenticating clients -->
  <pinned-certificates or:origin="or:intended">
    <name>explicitly-trusted-client-certs</name>
    <description>
      Specific client authentication certificates for explicitly
      trusted clients.  These are needed for client certificates
      that are not signed by a pinned CA.
    </description>
    <pinned-certificate>
      <name>George Jetson</name>
      <cert>base64encodedvalue==</cert>
    </pinned-certificate>
  </pinned-certificates>

  <!-- trusted CA certs for authenticating clients -->
  <pinned-certificates or:origin="or:intended">
    <name>explicitly-trusted-client-ca-certs</name>
    <description>
      Trust anchors (i.e. CA certs) that are used to authenticate 
      client connections.  Clients are authenticated if their
      certificate has a chain of trust to one of these CA
      certificates.
    </description>
    <pinned-certificate>
      <name>ca.example.com</name>
      <cert>base64encodedvalue==</cert>
    </pinned-certificate>
  </pinned-certificates>

  <!-- trusted CA certs for random HTTPS servers on Internet -->
  <pinned-certificates or:origin="or:system">
    <name>common-ca-certs</name>
    <description>
      Trusted certificates to authenticate common HTTPS servers.
      These certificates are similar to those that might be
      shipped with a web browser.
    </description>
    <pinned-certificate>
      <name>ex-certificate-authority</name>
      <cert>base64encodedvalue==</cert>
    </pinned-certificate>
  </pinned-certificates>

  <!-- specific SSH host keys for authenticating clients -->
  <pinned-host-keys or:origin="or:intended">
    <name>explicitly-trusted-ssh-host-keys</name>
    <description>
      Trusted SSH host keys used to authenticate SSH servers.
      These host keys would be analogous to those stored in
      a known_hosts file in OpenSSH.
    </description>
    <pinned-host-key>
      <name>corp-fw1</name>
      <host-key>base64encodedvalue==</host-key>
    </pinned-host-key>
  </pinned-host-keys>

</trust-anchors>
  ]]></artwork>
            </figure>
          </t>
  
          <t>The following example illustrates the "certificate-expiration"
          notification in use with the NETCONF protocol.</t>
          <t>
            <figure>
              <artwork><![CDATA[
========== NOTE: '\\' line wrapping per BCP XX (RFC XXXX) ===========

<notification
  xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
  <eventTime>2018-05-25T00:01:00Z</eventTime>
  <trust-anchors
    xmlns="urn:ietf:params:xml:ns:yang:ietf-trust-anchors">
    <pinned-certificates>
      <name>explicitly-trusted-client-certs</name>
      <pinned-certificate>
        <name>George Jetson</name>
        <certificate-expiration>
          <expiration-date>2018-08-05T14:18:53-05:00</expiration-dat\
\e>
        </certificate-expiration>
      </pinned-certificate>
    </pinned-certificates>
  </trust-anchors>
</notification>

  ]]></artwork>
            </figure>
          </t>
  
        </section>
  
        <section title="YANG Module" anchor="yang-module">
          <t>This YANG module imports modules from <xref target="RFC8341"/>
          and <xref target="I-D.ietf-netconf-crypto-types"/>.</t>
          <t>
            <figure>
              <artwork><![CDATA[
  <CODE BEGINS> file "ietf-trust-anchors@2019-03-09.yang"
module ietf-trust-anchors {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-trust-anchors";
  prefix ta;

  import ietf-netconf-acm {
    prefix nacm;
    reference
      "RFC 8341: Network Configuration Access Control Model";
  }

  import ietf-crypto-types {
    prefix ct;
    reference
      "RFC YYYY: Common YANG Data Types for Cryptography";
  }

  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>";

  description
    "This module defines a data model for configuring global
     trust anchors used by other data models.  The data model
     enables the configuration of sets of trust anchors.
     This data model supports configuring trust anchors for
     both X.509 certificates and SSH host keys.

     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 Data Model for Global Trust Anchors";
  }

  /************************************************************/
  /*   Typedefs for leafrefs to commonly referenced objects   */
  /************************************************************/

  feature x509-certificates {
    description
      "The 'x509-certificates' feature indicates that the server
       implements the /trust-anchors/pinned-certificates subtree.";
  }

  feature ssh-host-keys {
    description
      "The 'ssh-host-keys' feature indicates that the server
       implements the /trust-anchors/pinned-host-keys subtree.";
  }

  /************************************************************/
  /*   Typedefs for leafrefs to commonly referenced objects   */
  /************************************************************/

  typedef pinned-certificates-ref {
    type leafref {
      path "/ta:trust-anchors/ta:pinned-certificates/ta:name";
      require-instance false;
    }
    description
      "This typedef enables importing modules to easily define a
       leafref to a 'pinned-certificates' object.  The require
       instance attribute is false to enable the referencing of
       pinned certificates that exist only in <operational>.";
    reference
      "RFC 8342: Network Management Datastore Architecture (NMDA)";
  }

  typedef pinned-host-keys-ref {
    type leafref {
      path "/ta:trust-anchors/ta:pinned-host-keys/ta:name";
      require-instance false;
    }
    description
      "This typedef enables importing modules to easily define a
       leafref to a 'pinned-host-keys' object.  The require
       instance attribute is false to enable the referencing of
       pinned host keys that exist only in <operational>.";
    reference
      "RFC 8342: Network Management Datastore Architecture (NMDA)";
  }

  /*********************************/
  /*   Protocol accessible nodes   */
  /*********************************/

  container trust-anchors {
    nacm:default-deny-write;
    description
      "Contains sets of X.509 certificates and SSH host keys.";
    list pinned-certificates {
      if-feature "x509-certificates";
      key "name";
      description
        "A list of pinned certificates.  These certificates can be
         used by a server to authenticate clients, or by a client
         to authenticate servers.  Each list of pinned certificates
         SHOULD be specific to a purpose, as the list as a whole
         may be referenced by other modules.  For instance, a
         RESTCONF server's configuration might use a specific list
         of pinned certificates for when authenticating RESTCONF
         client connections.";
      leaf name {
        type string;
        description
          "An arbitrary name for this list of pinned certificates.";
      }
      leaf description {
        type string;
        description
          "An arbitrary description for this list of pinned
           certificates.";
      }
      list pinned-certificate {
        key "name";
        description
          "A pinned certificate.";
        leaf name {
          type string;
          description
            "An arbitrary name for this pinned certificate. The
             name must be unique across all lists of pinned
             certificates (not just this list) so that leafrefs
             from another module can resolve to unique values.";
        }
        uses ct:trust-anchor-cert-grouping {
          refine "cert" {
            mandatory true;
          }
        }
      }
    }
    list pinned-host-keys {
      if-feature "ssh-host-keys";
      key "name";
      description
        "A list of pinned host keys.  These pinned host-keys can
         be used by clients to authenticate SSH servers.  Each
         list of pinned host keys SHOULD be specific to a purpose,
         so the list as a whole may be referenced by other modules.
         For instance, a NETCONF client's configuration might
         point to a specific list of pinned host keys for when
         authenticating specific SSH servers.";
      leaf name {
        type string;
        description
          "An arbitrary name for this list of pinned SSH
           host keys.";
      }
      leaf description {
        type string;
        description
          "An arbitrary description for this list of pinned SSH
           host keys.";
      }
      list pinned-host-key {
        key "name";
        description
          "A pinned host key.";
        leaf name {
          type string;
          description
            "An arbitrary name for this pinned host-key. Must be
             unique across all lists of pinned host-keys (not just
             this list) so that a leafref to it from another module
             can resolve to unique values.";
        }
        leaf host-key {
          type ct:ssh-host-key;
          mandatory true;
          description
            "The binary public key data for this pinned host key.";
          reference
            "RFC YYYY: Common YANG Data Types for Cryptography";
        }
      }
    }
  }
}
  <CODE ENDS>
  ]]></artwork>
            </figure>
          </t>
        </section>
      </section>

      <section title="Security Considerations">

        <t>The YANG module defined in this document is 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>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. These are the subtrees and data nodes
        and their sensitivity/vulnerability:
          <list style="hanging" hangIndent="6">
            <t hangText="   /:">The entire data tree defined by this module is sensitive to
              write operations.  For instance, the addition or removal of any trust anchor
              may dramatically alter the implemented security policy.  For this reason, the
              NACM extension "default-deny-write" has been set for the entire data tree.</t>
          </list>
        </t>
 
        <t>None of the readable data nodes in this YANG module are considered sensitive
        or vulnerable in network environments.</t>
 
        <t>This module does not define any RPCs, actions, or notifications, and thus the
        security consideration for such is not provided here.</t>
      </section>

      <section title="IANA Considerations">
        <section title="The IETF XML Registry">
          <t>This document registers one URI 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-trust-anchors
   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 one YANG module in the
          YANG Module Names registry <xref target="RFC6020"/>.
          Following the format in <xref target="RFC6020"/>, the
          the following registration is requested:</t>
          <t>
            <figure>
                <artwork><![CDATA[
   name:         ietf-trust-anchors
   namespace:    urn:ietf:params:xml:ns:yang:ietf-trust-anchors
   prefix:       ta
   reference:    RFC XXXX

]]></artwork>
            </figure>
          </t>
        </section>
      </section>


    </middle>

    <back>
      <references title="Normative References">
        <?rfc include="reference.RFC.2119.xml"?>
        <?rfc include="reference.RFC.7950.xml"?>
        <?rfc include="reference.RFC.8174.xml"?>
        <?rfc include="reference.RFC.8341.xml"?>
        <?rfc include="reference.I-D.ietf-netconf-crypto-types"?>
      </references>
      <references title="Informative References">
        <?rfc include="reference.RFC.3688.xml"?>
        <?rfc include="reference.RFC.6020.xml"?>
        <?rfc include="reference.RFC.6241.xml"?>
        <?rfc include="reference.RFC.8040.xml"?>
        <?rfc include="reference.RFC.8340.xml"?>
        <?rfc include="reference.RFC.8342.xml"?>
      </references>

      <section title="Change Log">
        <section title="00 to 01">
          <t>
            <list style="symbols">
              <t>Added features "x509-certificates" and "ssh-host-keys".</t>
              <t>Added nacm:default-deny-write to "trust-anchors" container.</t>
            </list>
          </t>
        </section>
        <section title="01 to 02">
          <t>
            <list style="symbols">
              <t>Switched "list pinned-certificate" to use the 
                 "trust-anchor-cert-grouping" from crypto-types.
                 Effectively the same definition as before.</t>
            </list>
          </t>
        </section>
        <section title="02 to 03">
          <t>
            <list style="symbols">
              <t>Updated copyright date, boilerplate template, affiliation,
                folding algorithm, and reformatted the YANG module.</t>
            </list>
          </t>
        </section>
      </section>

      <section title="Acknowledgements" numbered="no">
        <t>The authors would like to thank for following for
        lively discussions on list and in the halls (ordered
        by last name):
Martin Bjorklund,
Balázs Kovács,
Eric Voit,
and Liang Xia.
        </t>
      </section>

    </back>
</rfc>

