<?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-ssh-client-server-03" >
    <front>
        <title>SSH Client and Server Models</title>
        <author initials="K.W." surname="Watsen" fullname="Kent Watsen">
            <organization>Juniper Networks</organization>
            <address>
                <email>kwatsen@juniper.net</email>
            </address>
        </author>
        <author initials="G.W." surname="Wu" fullname="Gary Wu">
            <organization>Cisco Systems</organization>
            <address>
                <email>garywu@cisco.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 SSH client, the second defines groupings
            for a generic SSH 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 SSH 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-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-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">2017-06-13</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 <xref target="RFC7950"/>
            modules: the first defines a grouping for a generic SSH client, the
            second defines a grouping for a generic SSH server, and the third
            defines identities and groupings common to both the client and the
            server (SSH is defined in <xref target="RFC4252"/>, <xref
            target="RFC4253"/>, and <xref target="RFC4254"/>).  It is intended
            that these groupings will be used by applications using the SSH
            protocol.  For instance, these groupings could be used to help
            define the data model for an OpenSSH <xref target="OPENSSH"/>
            server or a NETCONF over SSH <xref target="RFC6242"/> based
            server.</t>

            <t>The client and server YANG modules in this document each define one grouping,
            which is focused on just SSH-specific configuration, and specifically
            avoids any transport-level configuration, such as what ports to
            listen-on or connect-to.  This enables 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 grouping for the SSH parts it
            provides, while adding data nodes for the TCP-level call-home
            configuration.</t>

            <section title="Terminology">
              <t>The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL",
              "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY",
              and "OPTIONAL" in this document are to be interpreted as
              described in RFC 2119 <xref target="RFC2119"/>.</t>
            </section>

            <section title="Tree Diagrams" anchor="tree-diagrams">
            <t>A simplified graphical representation of the data models
            is used in this document.  The meaning of the symbols in
            these diagrams is as follows:
              <list style="symbols">
                <t>Brackets "[" and "]" enclose list keys.</t>
                <t>Braces "{" and "}" enclose feature names, and indicate
                that the named feature must be present for the subtree
                to be present.</t>
                <t>Abbreviations before data node names: "rw" means
                configuration (read-write) and "ro" state data 
                (read-only).</t>
                <t>Symbols after data node names: "?" means an optional
                node, "!" means a presence container, and "*" denotes a
                list and leaf-list.</t>
                <t>Parentheses enclose choice and case nodes, and case
                nodes are also marked with a colon (":").</t>
                <t>Ellipsis ("...") stands for contents of subtrees that
                are not shown.</t>
              </list>
            </t>
            </section>
        </section>

      <section title="The SSH Client Model" anchor="ssh-client-model">

        <t>The SSH client model presented in this section contains one
        YANG grouping, to just configure the SSH client omitting, for
        instance, any configuration for which IP address or port the
        client should connect to.</t>

        <t>This grouping references data nodes defined by the
        keystore model <xref target="I-D.ietf-netconf-keystore"/>.  For
        instance, a reference to the keystore model is made to indicate
        which trusted CA certificate a client should use to authenticate
        X.509v3 certificate based host keys <xref target="RFC6187"/>.</t>

        <section title="Tree Diagram">
          <t>The following tree diagram presents the data model for
          the grouping defined in the ietf-ssh-client module.  Please
          see <xref target="tree-diagrams"/> for tree diagram notation.</t>
          <t>
            <figure>
              <artwork><![CDATA[
module: ietf-ssh-client
  groupings:
  ssh-client-grouping
      +---- server-auth
      |  +---- trusted-ssh-host-keys?
      |  |       -> /ks:keystore/trusted-host-keys/name
      |  +---- trusted-ca-certs?
      |  |       -> /ks:keystore/trusted-certificates/name
      |  |       {sshcom:ssh-x509-certs}?
      |  +---- trusted-server-certs?
      |          -> /ks:keystore/trusted-certificates/name
      |          {sshcom:ssh-x509-certs}?
      +---- client-auth
      |  +---- username?      string
      |  +---- (auth-type)?
      |     +--:(certificate)
      |     |  +---- certificate?   leafref {sshcom:ssh-x509-certs}?
      |     +--:(public-key)
      |     |  +---- public-key?    -> /ks:keystore/keys/key/name
      |     +--:(password)
      |        +---- password?      string
      +---- transport-params {ssh-client-transport-params-config}?
         +---- host-key
         |  +---- host-key-alg*   identityref
         +---- key-exchange
         |  +---- key-exchange-alg*   identityref
         +---- encryption
         |  +---- encryption-alg*   identityref
         +---- mac
         |  +---- mac-alg*   identityref
         +---- compression
            +---- compression-alg*   identityref

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

        <section title="Example Usage">
          <t>This section shows how it would appear if the 
          ssh-client-grouping were populated with some data.
          This example is consistent with the examples presented in
          Section 2.2 of <xref target="I-D.ietf-netconf-keystore"/>.</t>
          <t>
            <figure>
              <artwork><![CDATA[
<!-- hypothetical example, as groupings don't have instance data -->
<ssh-client xmlns="urn:ietf:params:xml:ns:yang:ietf-ssh-client">

  <!-- which host-keys will this client trust -->
  <server-auth>
    <trusted-ssh-host-keys>explicitly-trusted-ssh-host-keys</trusted-ssh-host-keys>
  </server-auth>

  <!-- how this client will authenticate itself to the server -->
  <client-auth>
    <username>foobar</username>
    <public-key>ex-rsa-key</public-key>
  </client-auth>

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

        <section title="YANG Model" anchor="ssh-client-yang-module">
          <t>This YANG module has a normative references to <xref target="RFC6991"/>
          and <xref target="I-D.ietf-netconf-keystore"/>.</t>
          <t>
            <figure>
              <artwork><![CDATA[

<CODE BEGINS> file "ietf-ssh-client@2017-06-13.yang"

module ietf-ssh-client {
  yang-version 1.1;

  namespace "urn:ietf:params:xml:ns:yang:ietf-ssh-client";
  prefix "sshc";

  import ietf-ssh-common {
    prefix sshcom;
    revision-date 2017-06-13; // stable grouping definitions
    reference
      "RFC XXXX: SSH Client and Server Models";
  }

  import ietf-netconf-acm {
    prefix nacm;
    reference
      "RFC 6536: Network Configuration Protocol (NETCONF) Access
       Control Model";
  }

  import ietf-keystore {
    prefix ks;
    reference
      "RFC YYYY: Keystore Model";
  }

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

  contact
   "WG Web:   <http://tools.ietf.org/wg/netconf/>
    WG List:  <mailto:netconf@ietf.org>

    Author:   Kent Watsen
              <mailto:kwatsen@juniper.net>

    Author:   Gary Wu
              <mailto:garywu@cisco.com>";


  description
   "This module defines a reusable grouping for a SSH client that
    can be used as a basis for specific SSH client instances.

    Copyright (c) 2014 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 "2017-06-13" {
    description
     "Initial version";
    reference
     "RFC XXXX: SSH Client and Server Models";
  }

  feature ssh-client-transport-params-config {
    description
      "SSH transport layer parameters are configurable on an SSH
       client.";
  }

  grouping ssh-client-grouping {
    description
      "A reusable grouping for configuring a SSH client without
       any consideration for how an underlying TCP session is 
       established.";

    container server-auth {
      must 'trusted-ssh-host-keys or trusted-ca-certs or trusted-server-certs';
      description
        "Trusted server identities.";
      leaf trusted-ssh-host-keys {
        type leafref {
          path "/ks:keystore/ks:trusted-host-keys/ks:name";
        }
        description
          "A reference to a list of SSH host keys used by the
           SSH client to authenticate SSH server host keys.
           A server host key is authenticate if it is an exact
           match to a configured trusted SSH host key.";
      }

      leaf trusted-ca-certs {
        if-feature sshcom:ssh-x509-certs;
        type leafref {
          path "/ks:keystore/ks:trusted-certificates/ks:name";
        }
        description
          "A reference to a list of certificate authority (CA)
           certificates used by the SSH client to authenticate
           SSH server certificates.  A server certificate is
           authenticated if it has a valid chain of trust to
           a configured trusted CA certificate.";
      }

      leaf trusted-server-certs {
        if-feature sshcom:ssh-x509-certs;
        type leafref {
          path "/ks:keystore/ks:trusted-certificates/ks:name";
        }
        description
          "A reference to a list of server certificates used by
           the SSH client to authenticate SSH server certificates.
           A server certificate is authenticated if it is an
           exact match to a configured trusted server certificate.";
      }
    }

    container client-auth {
      description
        "The credentials used by the client to authenticate to
         the SSH server.";

      leaf username {
        type string;
        description
          "The username of this user.  This will be the username
           used, for instance, to log into an SSH server.";
      }

      choice auth-type {
        description
          "The authentication type.";
        leaf certificate {
          if-feature sshcom:ssh-x509-certs;
          type leafref {
            path "/ks:keystore/ks:keys/ks:key/ks:certificates/"
                 + "ks:certificate/ks:name";
          }
          description
            "A certificates to be used for user authentication.";
        }
        leaf public-key {
          type leafref {
            path "/ks:keystore/ks:keys/ks:key/ks:name";
          }
          description
            "A public keys to be used for user authentication.";
        }
        leaf password {
          nacm:default-deny-all;
          type string;
          description
            "A password to be used for user authentication.";
        }
      }
    } // end client-auth

    container transport-params {
      if-feature ssh-client-transport-params-config;
      uses sshcom:transport-params-grouping;
      description
        "Configurable parameters for the SSH transport layer.";
    }

  } // ssh-client-grouping

}



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


      <section title="The SSH Server Model" anchor="ssh-server-model">

        <t>The SSH server model presented in this section contains one
        YANG grouping, for just the SSH-level configuration omitting,
        for instance, configuration for which ports to open to listen
        for connections on.</t>

        <t>This grouping references data nodes defined by the
        keystore model <xref target="I-D.ietf-netconf-keystore"/>.
        For instance, a reference to the keystore model is made to indicate
        which host key a server should present.</t>

        <section title="Tree Diagram">
          <t>The following tree diagram presents the data model for
          the grouping defined in the ietf-ssh-server module. Please
          see <xref target="tree-diagrams"/> for tree diagram notation.</t>
          <t>
            <figure>
              <artwork><![CDATA[
module: ietf-ssh-server
  groupings:
  ssh-server-grouping
      +---- host-keys
      |  +---- host-key* [name]
      |     +---- name?          string
      |     +---- (host-key-type)
      |        +--:(public-key)
      |        |  +---- public-key?    -> /ks:keystore/keys/key/name
      |        +--:(certificate)
      |           +---- certificate?   leafref {sshcom:ssh-x509-certs}?
      +---- client-cert-auth {sshcom:ssh-x509-certs}?
      |  +---- trusted-ca-certs?
      |  |       -> /ks:keystore/trusted-certificates/name
      |  +---- trusted-client-certs?
      |          -> /ks:keystore/trusted-certificates/name
      +---- transport-params {ssh-server-transport-params-config}?
         +---- host-key
         |  +---- host-key-alg*   identityref
         +---- key-exchange
         |  +---- key-exchange-alg*   identityref
         +---- encryption
         |  +---- encryption-alg*   identityref
         +---- mac
         |  +---- mac-alg*   identityref
         +---- compression
            +---- compression-alg*   identityref

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

        <section title="Example Usage">
          <t>This section shows how it would appear if the 
          ssh-server-grouping were populated with some data.
          This example is consistent with the examples presented in
          Section 2.2 of <xref target="I-D.ietf-netconf-keystore"/>.</t>
          <t>
            <figure>
              <artwork><![CDATA[
<!-- hypothetical example, as groupings don't have instance data -->
<ssh-server xmlns="urn:ietf:params:xml:ns:yang:ietf-ssh-server">

  <!-- which host-keys will this SSH server present -->
  <host-keys>
    <host-key>
      <name>deployment-specific-certificate</name>
      <certificate>ex-rsa-cert</certificate>
    </host-key>
  </host-keys>

  <!-- NOTE: password/public-key auth is NOT configured here, -->
  <!-- as it is configured in the ietf-system (RFC 7317)      -->
  <!-- module instead.                                        -->

  <!-- which client-certs will this SSH server trust -->
  <client-cert-auth>
    <trusted-ca-certs>deployment-specific-ca-certs</trusted-ca-certs>
    <trusted-client-certs>explicitly-trusted-client-certs</trusted-client-certs>
  </client-cert-auth>

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

        <section title="YANG Model" anchor="ssh-server-yang-module">
          <t>This YANG module has a normative references to <xref target="RFC4253"/>,
          <xref target="RFC6991"/>, and <xref target="I-D.ietf-netconf-keystore"/>.</t>
          <t>
            <figure>
              <artwork><![CDATA[

<CODE BEGINS> file "ietf-ssh-server@2017-06-13.yang"

module ietf-ssh-server {
  yang-version 1.1;

  namespace "urn:ietf:params:xml:ns:yang:ietf-ssh-server";
  prefix "sshs";

  import ietf-ssh-common {
    prefix sshcom;
    revision-date 2017-06-13; // stable grouping definitions
    reference
      "RFC XXXX: SSH Client and Server Models";
  }

  import ietf-keystore {
    prefix ks;
    reference
      "RFC YYYY: Keystore Model";
  }

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

  contact
   "WG Web:   <http://tools.ietf.org/wg/netconf/>
    WG List:  <mailto:netconf@ietf.org>

    Author:   Kent Watsen
              <mailto:kwatsen@juniper.net>";


  description
   "This module defines a reusable grouping for a SSH server that
    can be used as a basis for specific SSH server instances.

    Copyright (c) 2014 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 "2017-06-13" {
    description
     "Initial version";
    reference
     "RFC XXXX: SSH Client and Server Models";
  }

  // features
  feature ssh-server-transport-params-config {
    description
      "SSH transport layer parameters are configurable on an SSH
       server.";
  }

  // grouping
  grouping ssh-server-grouping {
    description
      "A reusable grouping for configuring a SSH server without
       any consideration for how underlying TCP sessions are 
       established.";
    container host-keys {
      description
        "The list of host-keys the SSH server will present when
         establishing a SSH connection.";
      list host-key {
        key name;
        min-elements 1;
        ordered-by user;
        description
          "An ordered list of host keys the SSH server will use to
           construct its ordered list of algorithms, when sending
           its SSH_MSG_KEXINIT message, as defined in Section 7.1
           of RFC 4253.";
        reference
          "RFC 4253: The Secure Shell (SSH) Transport Layer Protocol";
        leaf name {
          type string;
          description
            "An arbitrary name for this host-key";
        }
        choice host-key-type {
          mandatory true;
          description
            "The type of host key being specified";
          leaf public-key {
            type leafref {
              path "/ks:keystore/ks:keys/ks:key/ks:name";
            }
            description
              "The public key is actually identified by the name of
               its cooresponding private-key in the keystore.";
          }
          leaf certificate {
            if-feature sshcom:ssh-x509-certs;
            type leafref {
              path "/ks:keystore/ks:keys/ks:key/ks:certificates/"
                   + "ks:certificate/ks:name";
            }
            description
              "The name of a certificate in the keystore.";
          }
        }
      }
    }

    container client-cert-auth {
      if-feature sshcom:ssh-x509-certs;
      description
        "A reference to a list of trusted certificate authority (CA)
         certificates and a reference to a list of trusted client
         certificates.";
      leaf trusted-ca-certs {
        type leafref {
          path "/ks:keystore/ks:trusted-certificates/ks:name";
        }
        description
          "A reference to a list of certificate authority (CA) 
           certificates used by the SSH server to authenticate
           SSH client certificates.";
      }
      leaf trusted-client-certs {
        type leafref {
          path "/ks:keystore/ks:trusted-certificates/ks:name";
        }
        description
          "A reference to a list of client certificates used by 
           the SSH server to authenticate SSH client certificates.
           A clients certificate is authenticated if it is an
           exact match to a configured trusted client certificate.";
      }
    }

    container transport-params {
      if-feature ssh-server-transport-params-config;
      uses sshcom:transport-params-grouping;
      description
        "Configurable parameters for the SSH transport layer.";
    }

  } // ssh-server-grouping

}



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

      <section title="The SSH Common Model" anchor="ssh-common-model">

        <t>The SSH common model presented in this section contains identities
        and groupings common to both SSH clients and SSH servers.  The
        transport-params-grouping can be used to configure the list of SSH
        transport algorithms permitted by the SSH client or SSH 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 SSH transport
        layer connection.  The ability to restrict the the algorithms allowed
        is provided in this grouping for SSH clients and SSH servers that are
        capable of doing so and may serve to make SSH clients and SSH servers
        compliant with security policies.</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.  As well, some algorithms that are
        REQUIRED by <xref target="RFC4253"/> are missing, notably "ssh-dss" and
        "diffie-hellman-group1-sha1" due to their weak security and there being
        alternatives that are widely supported.</t>

        <section title="Tree Diagram">
          <t>The following tree diagram presents the data model for
          the grouping defined in the ietf-ssh-common module.  Please
          see <xref target="tree-diagrams"/> for tree diagram notation.</t>
          <t>
            <figure>
              <artwork><![CDATA[
module: ietf-ssh-common
  groupings:
  transport-params-grouping
      +---- host-key
      |  +---- host-key-alg*   identityref
      +---- key-exchange
      |  +---- key-exchange-alg*   identityref
      +---- encryption
      |  +---- encryption-alg*   identityref
      +---- mac
      |  +---- mac-alg*   identityref
      +---- compression
         +---- compression-alg*   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[
<!-- hypothetical example, as groupings don't have instance data -->
<transport-params xmlns="urn:ietf:params:xml:ns:yang:ietf-ssh-common">

  <host-key>
    <host-key-alg>x509v3-rsa2048-sha256</host-key-alg>
    <host-key-alg>ssh-rsa</host-key-alg>
  </host-key>
  <key-exchange>
    <key-exchange-alg>
      diffie-hellman-group-exchange-sha256
    </key-exchange-alg>
  </key-exchange>
  <encryption>
    <encryption-alg>aes256-ctr</encryption-alg>
    <encryption-alg>aes192-ctr</encryption-alg>
    <encryption-alg>aes128-ctr</encryption-alg>
    <encryption-alg>aes256-cbc</encryption-alg>
    <encryption-alg>aes192-cbc</encryption-alg>
    <encryption-alg>aes128-cbc</encryption-alg>
  </encryption>
  <mac>
    <mac-alg>hmac-sha2-256</mac-alg>
    <mac-alg>hmac-sha2-512</mac-alg>
  </mac>
  <compression>
    <compression-alg>none</compression-alg>
  </compression>

</transport-params>
]]></artwork>
            </figure>
          </t>
        </section>

        <section title="YANG Model" anchor="ssh-common-yang-module">
          <t>This YANG module has a normative references to <xref target="RFC4344"/>,
          <xref target="RFC4419"/>, and <xref target="RFC5656"/>.</t>
          <t>
            <figure>
              <artwork><![CDATA[

<CODE BEGINS> file "ietf-ssh-common@2017-06-13.yang"

module ietf-ssh-common {
  yang-version 1.1;

  namespace "urn:ietf:params:xml:ns:yang:ietf-ssh-common";
  prefix "sshcom";

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

  contact
   "WG Web:   <http://tools.ietf.org/wg/netconf/>
    WG List:  <mailto:netconf@ietf.org>

    Author:   Kent Watsen
              <mailto:kwatsen@juniper.net>

    Author:   Gary Wu
              <mailto:garywu@cisco.com>";


  description
   "This module defines a common features, identities, and groupings
    for Secure Shell (SSH).

    Copyright (c) 2017 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 "2017-06-13" {
    description
     "Initial version";
    reference
     "RFC XXXX: SSH Client and Server Models";
  }

  // features
  feature ssh-ecc {
    description
      "Elliptic Curve Cryptography is supported for SSH.";
    reference
      "RFC 5656: Elliptic Curve Algorithm Integration in the
                 Secure Shell Transport Layer";
  }

  feature ssh-x509-certs {
    description
      "X.509v3 certificates are supported for SSH as per RFC 6187.";
    reference
      "RFC 6187: X.509v3 Certificates for Secure Shell
                 Authentication";
  }

  feature ssh-dh-group-exchange {
    description
      "Diffie-Hellman Group Exchange is supported for SSH.";
    reference
      "RFC 4419: Diffie-Hellman Group Exchange for the
                 Secure Shell (SSH) Transport Layer Protocol";
  }

  feature ssh-ctr {
    description
      "SDCTR encryption mode is supported for SSH.";
    reference
      "RFC 4344: The Secure Shell (SSH) Transport Layer
                 Encryption Modes";
  }

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

  feature ssh-zlib {
    description
      "ZLIB (LZ77) compression is supported for SSH.";
    reference
      "RFC 4253: The Secure Shell (SSH) Transport Layer Protocol";
  }

  // identities
  identity public-key-alg-base {
    description
      "Base identity used to identify public key algorithms.";
  }

  identity ssh-dss {
    base public-key-alg-base;
    description
      "Digital Signature Algorithm using SHA-1 as the hashing
       algorithm.";
    reference
      "RFC 4253: The Secure Shell (SSH) Transport Layer Protocol";
  }

  identity ssh-rsa {
    base public-key-alg-base;
    description
      "RSASSA-PKCS1-v1_5 signature scheme using SHA-1 as the hashing
       algorithm.";
    reference
      "RFC 4253: The Secure Shell (SSH) Transport Layer Protocol";
  }

  identity ecdsa-sha2-nistp256 {
    base public-key-alg-base;
    if-feature "ssh-ecc and ssh-sha2";
    description
      "Elliptic Curve Digital Signature Algorithm (ECDSA) using the
       nistp256 curve and the SHA2 family of hashing algorithms.";
    reference
      "RFC 5656: Elliptic Curve Algorithm Integration in the
                 Secure Shell Transport Layer";
  }

  identity ecdsa-sha2-nistp384 {
    base public-key-alg-base;
    if-feature "ssh-ecc and ssh-sha2";
    description
      "Elliptic Curve Digital Signature Algorithm (ECDSA) using the
       nistp384 curve and the SHA2 family of hashing algorithms.";
    reference
      "RFC 5656: Elliptic Curve Algorithm Integration in the
                 Secure Shell Transport Layer";
  }

  identity ecdsa-sha2-nistp521 {
    base public-key-alg-base;
    if-feature "ssh-ecc and ssh-sha2";
    description
      "Elliptic Curve Digital Signature Algorithm (ECDSA) using the
       nistp521 curve and the SHA2 family of hashing algorithms.";
    reference
      "RFC 5656: Elliptic Curve Algorithm Integration in the
                 Secure Shell Transport Layer";
  }

  identity x509v3-ssh-rsa {
    base public-key-alg-base;
    if-feature ssh-x509-certs;
    description
      "RSASSA-PKCS1-v1_5 signature scheme using a public key stored in
       an X.509v3 certificate and using SHA-1 as the hashing
       algorithm.";
    reference
      "RFC 6187: X.509v3 Certificates for Secure Shell
                 Authentication";
  }

  identity x509v3-rsa2048-sha256 {
    base public-key-alg-base;
    if-feature "ssh-x509-certs and ssh-sha2";
    description
      "RSASSA-PKCS1-v1_5 signature scheme using a public key stored in
       an X.509v3 certificate and using SHA-256 as the hashing
       algorithm.  RSA keys conveyed using this format MUST have a
       modulus of at least 2048 bits.";
    reference
      "RFC 6187: X.509v3 Certificates for Secure Shell
       Authentication";
  }

  identity x509v3-ecdsa-sha2-nistp256 {
    base public-key-alg-base;
    if-feature "ssh-ecc and ssh-x509-certs and ssh-sha2";
    description
      "Elliptic Curve Digital Signature Algorithm (ECDSA) using the
       nistp256 curve with a public key stored in an X.509v3
       certificate and using the SHA2 family of hashing algorithms.";
    reference
      "RFC 6187: X.509v3 Certificates for Secure Shell
       Authentication";
  }

  identity x509v3-ecdsa-sha2-nistp384 {
    base public-key-alg-base;
    if-feature "ssh-ecc and ssh-x509-certs and ssh-sha2";
    description
      "Elliptic Curve Digital Signature Algorithm (ECDSA) using the
       nistp384 curve with a public key stored in an X.509v3
       certificate and using the SHA2 family of hashing algorithms.";
    reference
      "RFC 6187: X.509v3 Certificates for Secure Shell
       Authentication";
  }

  identity x509v3-ecdsa-sha2-nistp521 {
    base public-key-alg-base;
    if-feature "ssh-ecc and ssh-x509-certs and ssh-sha2";
    description
      "Elliptic Curve Digital Signature Algorithm (ECDSA) using the
       nistp521 curve with a public key stored in an X.509v3
       certificate and using the SHA2 family of hashing algorithms.";
    reference
      "RFC 6187: X.509v3 Certificates for Secure Shell
       Authentication";
  }

  identity key-exchange-alg-base {
    description
      "Base identity used to identify key exchange algorithms.";
  }

  identity diffie-hellman-group14-sha1 {
    base key-exchange-alg-base;
    description
      "Diffie-Hellman key exchange with SHA-1 as HASH and
       Oakley Group 14 (2048-bit MODP Group).";
    reference
      "RFC 4253: The Secure Shell (SSH) Transport Layer Protocol";
  }

  identity diffie-hellman-group-exchange-sha1 {
    base key-exchange-alg-base;
    if-feature ssh-dh-group-exchange;
    description
      "Diffie-Hellman Group and Key Exchange with SHA-1 as HASH.";
    reference
      "RFC 4419: Diffie-Hellman Group Exchange for the
                 Secure Shell (SSH) Transport Layer Protocol";
  }

  identity diffie-hellman-group-exchange-sha256 {
    base key-exchange-alg-base;
    if-feature "ssh-dh-group-exchange and ssh-sha2";
    description
      "Diffie-Hellman Group and Key Exchange with SHA-256 as HASH.";
    reference
      "RFC 4419: Diffie-Hellman Group Exchange for the
                 Secure Shell (SSH) Transport Layer Protocol";
  }

  identity ecdh-sha2-nistp256 {
    base key-exchange-alg-base;
    if-feature "ssh-ecc and ssh-sha2";
    description
      "Elliptic Curve Diffie-Hellman (ECDH) key exchange using the
       nistp256 curve and the SHA2 family of hashing algorithms.";
    reference
      "RFC 5656: Elliptic Curve Algorithm Integration in the
                 Secure Shell Transport Layer";
  }

  identity ecdh-sha2-nistp384 {
    base key-exchange-alg-base;
    if-feature "ssh-ecc and ssh-sha2";
    description
      "Elliptic Curve Diffie-Hellman (ECDH) key exchange using the
       nistp384 curve and the SHA2 family of hashing algorithms.";
    reference
      "RFC 5656: Elliptic Curve Algorithm Integration in the
                 Secure Shell Transport Layer";
  }

  identity ecdh-sha2-nistp521 {
    base key-exchange-alg-base;
    if-feature "ssh-ecc and ssh-sha2";
    description
      "Elliptic Curve Diffie-Hellman (ECDH) key exchange using the
       nistp521 curve and the SHA2 family of hashing algorithms.";
    reference
      "RFC 5656: Elliptic Curve Algorithm Integration in the
                 Secure Shell Transport Layer";
  }

  identity encryption-alg-base {
    description
      "Base identity used to identify encryption algorithms.";
  }

  identity triple-des-cbc {
    base encryption-alg-base;
    description
      "Three-key 3DES in CBC mode.";
    reference
      "RFC 4253: The Secure Shell (SSH) Transport Layer Protocol";
  }

  identity aes128-cbc {
    base encryption-alg-base;
    description
     "AES in CBC mode, with a 128-bit key.";
    reference
     "RFC 4253: The Secure Shell (SSH) Transport Layer Protocol";
  }

  identity aes192-cbc {
    base encryption-alg-base;
    description
      "AES in CBC mode, with a 192-bit key.";
    reference
      "RFC 4253: The Secure Shell (SSH) Transport Layer Protocol";
  }

  identity aes256-cbc {
    base encryption-alg-base;
    description
      "AES in CBC mode, with a 256-bit key.";
    reference
      "RFC 4253: The Secure Shell (SSH) Transport Layer Protocol";
  }

  identity aes128-ctr {
    base encryption-alg-base;
    if-feature ssh-ctr;
    description
      "AES in SDCTR mode, with 128-bit key.";
    reference
      "RFC 4344: The Secure Shell (SSH) Transport Layer Encryption
         Modes";
  }

  identity aes192-ctr {
    base encryption-alg-base;
    if-feature ssh-ctr;
    description
      "AES in SDCTR mode, with 192-bit key.";
    reference
      "RFC 4344: The Secure Shell (SSH) Transport Layer Encryption
         Modes";
  }

  identity aes256-ctr {
    base encryption-alg-base;
    if-feature ssh-ctr;
    description
      "AES in SDCTR mode, with 256-bit key.";
    reference
      "RFC 4344: The Secure Shell (SSH) Transport Layer Encryption
         Modes";
  }

  identity mac-alg-base {
    description
      "Base identity used to identify message authentication
       code (MAC) algorithms.";
  }

  identity hmac-sha1 {
    base mac-alg-base;
    description
      "HMAC-SHA1";
    reference
      "RFC 4253: The Secure Shell (SSH) Transport Layer Protocol";
  }

  identity hmac-sha2-256 {
    base mac-alg-base;
    if-feature "ssh-sha2";
    description
      "HMAC-SHA2-256";
    reference
      "RFC 6668: SHA-2 Data Integrity Verification for the
                 Secure Shell (SSH) Transport Layer Protocol";
  }

  identity hmac-sha2-512 {
    base mac-alg-base;
    if-feature "ssh-sha2";
    description
      "HMAC-SHA2-512";
    reference
      "RFC 6668: SHA-2 Data Integrity Verification for the
                 Secure Shell (SSH) Transport Layer Protocol";
  }

  identity compression-alg-base {
    description
      "Base identity used to identify compression algorithms.";
  }

  identity none {
    base compression-alg-base;
    description
      "No compression.";
    reference
      "RFC 4253: The Secure Shell (SSH) Transport Layer Protocol";
  }

  identity zlib {
    base compression-alg-base;
    if-feature ssh-zlib;
    description
      "ZLIB (LZ77) compression.";
    reference
      "RFC 4253: The Secure Shell (SSH) Transport Layer Protocol";
  }

  // groupings
  grouping transport-params-grouping {
    description
      "A reusable grouping for SSH transport parameters.
       For configurable parameters, a zero-element leaf-list of
       algorithms indicates the system default configuration for that
       parameter.";
    reference
      "RFC 4253: The Secure Shell (SSH) Transport Layer Protocol";
    container host-key {
      description
        "Parameters regarding host key.";
      leaf-list host-key-alg {
        type identityref {
          base public-key-alg-base;
        }
        ordered-by user;
        description
          "Host key algorithms in order of descending preference.";
      }
    }
    container key-exchange {
      description
        "Parameters regarding key exchange.";
      leaf-list key-exchange-alg {
        type identityref {
          base key-exchange-alg-base;
        }
        ordered-by user;
        description
          "Key exchange algorithms in order of descending
           preference.";
      }
    }
    container encryption {
      description
        "Parameters regarding encryption.";
      leaf-list encryption-alg {
        type identityref {
          base encryption-alg-base;
        }
        ordered-by user;
        description
          "Encryption algorithms in order of descending preference.";
      }
    }
    container mac {
      description
        "Parameters regarding message authentication code (MAC).";
      leaf-list mac-alg {
        type identityref {
          base mac-alg-base;
        }
        ordered-by user;
        description
          "MAC algorithms in order of descending preference.";
      }
    }
    container compression {
      description
        "Parameters regarding compression.";
      leaf-list compression-alg {
        type identityref {
          base compression-alg-base;
        }
        ordered-by user;
        description
          "Compression algorithms in order of descending preference.";
      }
    }
  }
}

<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="RFC6536"/> 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 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>
          </list>
        </t>

        <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. These are
        the subtrees and data nodes and their sensitivity/vulnerability:
          <list style="hanging" hangIndent="6">
            <t hangText="   /client-auth/password:">This node is additionally
              sensitive to read operations such that, in normal use cases, it should never
              be returned to a client.  The best reason for returning this node is to support
              backup/restore type workflows.  This being the case, this node is marked
              with the NACM value 'default-deny-all'.</t>
          </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 style="hanging" hangIndent="6">
            <t hangText="   NONE"></t>
          </list>
        </t>
      </section>

      <section title="IANA Considerations">
        <section title="The IETF XML Registry">
          <t>This document registers three URIs in the IETF XML 
          registry <xref target="RFC3688"/>.  Following the format in 
          <xref target="RFC3688"/>, the following registrations are
          requested:</t>
          <t>
            <figure>
                <artwork><![CDATA[
   URI: urn:ietf:params:xml:ns:yang:ietf-ssh-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-ssh-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-ssh-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="RFC7950"/>.
          Following the format in <xref target="RFC7950"/>, the
          the following registrations are requested:</t>
          <t>
            <figure>
                <artwork><![CDATA[
   name:         ietf-ssh-client
   namespace:    urn:ietf:params:xml:ns:yang:ietf-ssh-client
   prefix:       sshc
   reference:    RFC XXXX

   name:         ietf-ssh-server
   namespace:    urn:ietf:params:xml:ns:yang:ietf-ssh-server
   prefix:       sshs
   reference:    RFC XXXX

   name:         ietf-ssh-common
   namespace:    urn:ietf:params:xml:ns:yang:ietf-ssh-common
   prefix:       sshcom
   reference:    RFC XXXX
]]></artwork>
            </figure>
          </t>
        </section>
      </section>

      <section 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, Michal Vaško, and Bert Wijnen.</t>
     </section>

    </middle>

    <back>
      <references title="Normative References">
        <?rfc include="reference.RFC.2119.xml"?>
        <?rfc include="reference.RFC.4344.xml"?>
        <?rfc include="reference.RFC.4419.xml"?>
        <?rfc include="reference.RFC.5656.xml"?>
        <?rfc include="reference.RFC.6187.xml"?>
        <?rfc include="reference.RFC.6536.xml"?>
        <?rfc include="reference.RFC.6668.xml"?>
        <?rfc include="reference.RFC.6991.xml"?>
        <?rfc include="reference.RFC.7950.xml"?>
        <?rfc include="reference.I-D.ietf-netconf-keystore"?>
      </references>

      <references title="Informative References">

        <!--<reference anchor='FIPS180-4' target="http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf">
          <front>
            <title>Secure Hash Standard (SHS)</title>
            <author fullname='National Institute of Standards and Technology'/>
            <date year='2012' month='March'/>
          </front>
          <seriesInfo name="FIPS PUB" value="180-4"/>
        </reference>-->

        <?rfc include="reference.RFC.3688.xml"?>
        <?rfc include="reference.RFC.4252.xml"?>
        <?rfc include="reference.RFC.4253.xml"?>
        <?rfc include="reference.RFC.4254.xml"?>
        <?rfc include="reference.RFC.6241.xml"?>
        <?rfc include="reference.RFC.6242.xml"?>
        <?rfc include="reference.RFC.8040.xml"?>
        <?rfc include="reference.RFC.8071.xml"?>

        <reference anchor='OPENSSH' target="http://www.openssh.com">
          <front>
            <title>OpenSSH</title>
            <author fullname='The OpenBSD Project'/>
            <date year='2016'/>
          </front>
        </reference>

      </references>

      <section title="Change Log">
        <section title="server-model-09 to 00">
          <t>
            <list style="symbols">
              <t>This draft was split out from draft-ietf-netconf-server-model-09.</t>
              <t>Added in previously missing ietf-ssh-client module.</t>
              <t>Noted that '0.0.0.0' and '::' might have special meanings.</t>
            </list>
          </t>
        </section>
        <section title="00 to 01">
          <t>
            <list style="symbols">
              <t>Renamed "keychain" to "keystore".</t>
            </list>
          </t>
        </section>
        <section title="01 to 02">
          <t>
            <list style="symbols">
              <t>Removed the groupings 'listening-ssh-client-grouping' and
              'listening-ssh-server-grouping'.  Now modules only contain the
              transport-independent groupings.</t>
              <t>Simplified the "client-auth" part in the ietf-ssh-client
              module.  It now inlines what it used to point to keystore for.</t>
              <t>Added cipher suites for various algorithms into new 
              'ietf-ssh-common' module.</t>
            </list>
          </t>
        </section>
        <section title="02 to 03">
          <t>
            <list style="symbols">
              <t>Removed 'RESTRICTED' enum from 'password' leaf type.</t>
              <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>
    </back>
</rfc>

