<?xml version='1.0' encoding='utf-8'?>
<!-- This template is for creating an Internet Draft using xml2rfc,               
    which is available here: http://xml.resource.org. -->
<!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent">
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc toc="yes" ?>
<?rfc tocompact="yes"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes" ?>
<?rfc sortrefs="yes"?>
<?rfc iprnotified="no" ?>
<?rfc strict="yes" ?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" category="std" docName="draft-ietf-netmod-factory-default-15" ipr="trust200902" obsoletes="" updates="" submissionType="IETF" xml:lang="en" tocInclude="true" symRefs="true" sortRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 2.44.0 -->
  <front>
    <title abbrev="Factory Default Setting">A YANG Data Model for Factory
    Default Settings</title>
    <seriesInfo name="Internet-Draft" value="draft-ietf-netmod-factory-default-15"/>
    <author fullname="Qin Wu" initials="Q." surname="Wu">
      <organization>Huawei</organization>
      <address>
        <postal>
          <street>101 Software Avenue, Yuhua District</street>
          <city>Nanjing</city>
          <region>Jiangsu</region>
          <code>210012</code>
          <country>China</country>
        </postal>
        <email>bill.wu@huawei.com</email>
      </address>
    </author>
    <author fullname="Balazs Lengyel" initials="B." surname="Lengyel">
      <organization abbrev="Ericsson Hungary">Ericsson Hungary</organization>
      <address>
        <postal>
          <street>Magyar Tudosok korutja 11</street>
          <city>1117 Budapest</city>
          <country>Hungary</country>
        </postal>
        <phone>+36-70-330-7909</phone>
        <email>balazs.lengyel@ericsson.com</email>
      </address>
    </author>
    <author fullname="Ye Niu" initials="Y." surname="Niu">
      <organization>Huawei</organization>
      <address>
        <email>niuye@huawei.com</email>
      </address>
    </author>
    <date year="2020"/>
    <area>OPS Area</area>
    <workgroup>NETMOD Working Group</workgroup>
    <abstract>
      <t>This document defines a YANG data model with the "factory-reset" RPC
      to allow clients to reset a server back to its factory default
      condition. It also defines an optional "factory-default" datastore to
      allow clients to read the factory default configuration for the
      device.</t>
      <t>The YANG data model in this document conforms to the Network
      Management Datastore Architecture (NMDA) defined in RFC 8342.</t>
    </abstract>
  </front>
  <middle>
    <section anchor="intro" numbered="true" toc="default">
      <name>Introduction</name>
      <t>This document defines a YANG data model and associated mechanism to
      reset a server to its factory default content. This mechanism may be
      used, e.g., when the existing configuration has major errors so
      re-starting the configuration process from scratch is the best
      option.</t>
      <t>A "factory-reset" RPC is defined within the YANG data model. When
      resetting a device, all previous configuration settings will be lost and
      replaced by the factory default content.</t>
      <t>In addition, an optional "factory-default" read-only datastore is
      defined within the YANG data model, that contains the data to replace
      the contents of implemented read-write conventional configuration
      datastores at reset. This datastore can also be used in the
      &lt;get-data&gt; operation.</t>
      <t>The YANG data model in this document conforms to the Network
      Management Datastore Architecture defined in [RFC8342].</t>
      <section numbered="true" toc="default">
        <name>Terminology</name>
        <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 [RFC2119] [RFC8174] when, and only when, they appear in all
        capitals, as shown here.</t>
        <t>The following terms are defined in [RFC8342] [RFC7950] and are not
        redefined here:</t>
        <ul spacing="normal">
          <li>server</li>
          <li>startup configuration datastore</li>
          <li>candidate configuration datastore</li>
          <li>running configuration datastore</li>
          <li>intended configuration datastore</li>
          <li>operational state datastore</li>
          <li>conventional configuration datastore</li>
          <li>datastore schema</li>
          <li>RPC operation</li>
        </ul>
        <t>The following terms are defined in this document as follows:</t>
        <ul spacing="normal">
          <li>factory-default datastore: A read-only configuration datastore
            holding a pre-set initial configuration that is used to initialize
            the configuration of a server. This datastore is referred to as
            "&lt;factory-default&gt;".</li>
        </ul>
      </section>
    </section>
    <!-- intro -->

    <section numbered="true" toc="default">
      <name>Factory-Reset RPC</name>
      <t>A new "factory-reset" remote procedure call (RPC) is introduced. Upon
      receiving the RPC: </t>
      <ul spacing="normal">
        <li>All supported conventional read-write configuration datastores
          (i.e. &lt;running&gt;, &lt;startup&gt;, and &lt;candidate&gt;) are
          reset to the contents of &lt;factory-default&gt;.</li>
        <li>Read-only datastores receive their content from other datastores
          (e.g., &lt;intended&gt; gets its content from &lt;running&gt;).</li>
        <li>All data in any dynamic configuration datastores MUST be
          discarded.</li>
        <li>The contents of the &lt;operational&gt; datastore MUST reflect
          the operational state of the device after applying the factory
          default configuration.</li>
      </ul>
      <t>In addition, the "factory-reset" RPC MUST restore non-volatile
      storage to factory condition. Depending on the system, this may entail
      deleting dynamically generated files, such as those containing keys
      (e.g., /etc/ssl/private), certificates (e.g., /etc/ssl), logs (e.g.,
      /var/log), and temporary files (e.g., /tmp/*). Any other cryptographic
      keys that are part of the factory-installed image will be retained (such
      as an IDevID certificate) [I-D.ietf-anima-bootstrapping-keyinfra]. When
      this process includes security-sensitive data such as cryptographic keys
      or passwords, it is RECOMMENDED to perform the deletion in a manner as
      thorough as possible (e.g., overwriting the physical storage medium with
      zeros and/or random bits for repurpose or end of life (EoL) disposal) to
      reduce the risk of the sensitive material being recoverable. The
      "factory-reset" RPC MAY also be used to trigger some other resetting
      tasks such as restarting the node or some of the software processes.</t>
      <t>Note that operators should be aware that since all read-write
      datastores are immediately reset to factory default, the device may
      become unreachable as a host on the network. It is important to
      understand how a given vendor's device will behave after the RPC is
      executed. Implementors SHOULD reboot the device and get it properly
      configured or otherwise restart processes needed to bootstrap it.</t>
    </section>
    <section anchor="datastore" numbered="true" toc="default">
      <name>Factory-Default Datastore</name>
      <t>Following the guidelines for defining Datastores in the appendix A of
      [RFC8342], this document introduces a new optional datastore resource
      named "factory-default" that represents a pre-set initial configuration
      that can be used to initialize the configuration of a server. A device
      MAY implement the "factory-reset" RPC without implementing the
      "factory-default" datastore, which would only eliminate the ability to
      programmatically determine the factory default configuration. </t>
      <ul spacing="normal">
        <li>Name: "factory-default"</li>
        <li>YANG modules: The factory default datastore schema MUST either be
          the same as the conventional configuration datastores, or a subset
          of the datastore schema for the conventional configuration
          datastores.</li>
        <li>YANG nodes: all "config true" data nodes</li>
        <li>Management operations: The content of the datastore is set by the
          server in an implementation dependent manner. The content can not be
          changed by management operations via NETCONF, RESTCONF, the CLI etc.
          unless specialized, dedicated operations are provided. The datastore
          can be read using the standard NETCONF/RESTCONF protocol operations.
          The "factory-reset" operation copies the factory default content to
          &lt;running&gt; and, if present, &lt;startup&gt; and/or
          &lt;candidate&gt; and then the content of these datastores is
          propagated automatically to any other read only datastores, e.g.,
          &lt;intended&gt; and &lt;operational&gt;.</li>
        <li>Origin: This document does not define a new origin identity as it
          does not interact with the &lt;operational&gt; datastore.</li>
        <li>Protocols: RESTCONF, NETCONF and other management protocol.</li>
        <li>Defining YANG module: "ietf-factory-default".</li>
      </ul>
      <t>The contents of &lt;factory-default&gt; are defined by the
      device vendor and MUST persist across device restarts. If supported, the
      factory-default datastore MUST be included in the list of datastores in
      YANG library [RFC 8525].</t>
    </section>
    <section numbered="true" toc="default">
      <name>YANG Module</name>
      <t>This module uses the "datastore" identity [RFC8342], and the
      "default-deny-all" extension statement from [RFC8341].</t>
      <sourcecode name="ietf-factory-default@2019-11-27.yang" type="" markers="true"><![CDATA[
   module ietf-factory-default {
     yang-version 1.1;
     namespace "urn:ietf:params:xml:ns:yang:ietf-factory-default";
     prefix fd;

     import ietf-datastores {
       prefix ds;
       reference
         "RFC 8342: Network Management Datastore Architecture (NMDA)";
     }
     import ietf-netconf-acm {
       prefix nacm;
       reference
        "RFC8341: Network Configuration Access Control Model";
     }

     organization
       "IETF NETMOD (Network Modeling) Working Group";
     contact
       "WG Web:   <https://tools.ietf.org/wg/netconf/>
        WG List:  <mailto:netconf@ietf.org>

        Editor:   Qin Wu
                  <mailto:bill.wu@huawei.com>
        Editor:   Balazs Lengyel
                  <mailto:balazs.lengyel@ericsson.com>
        Editor:   Ye Niu
                  <mailto:niuye@huawei.com>";
     description
       "This module provides functionality to reset a server to its 
        factory default configuration and, when supported, to discover 
        the factory default configuration contents independent of 
        resetting the server.

        Copyright (c) 2020 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.";
     // RFC Ed.: update the date below with the date of RFC publication
     // and remove this note.
     // RFC Ed.: replace XXXX with actual RFC number and remove this
     // note.
     revision 2019-11-27 {
       description
         "Initial revision.";
       reference
         "RFC XXXX: Factory default Setting";
     }

     feature factory-default-datastore {
       description
         "Indicates that the factory default configuration is
          available as a datastore.";
     }

     rpc factory-reset {
       nacm:default-deny-all;
       description
         "The server resets all datastores to their factory 
         default content and any non-volatile storage back to 
         factory condition, deleting all dynamically generated 
         files, including those containing keys, certificates, 
         logs, and other temporary files.

         Depending on the factory default configuration, after 
         being reset, the device may become unreachable on the 
         network.";
     }

     identity factory-default {
       if-feature "factory-default-datastore";
       base ds:datastore;
       description
         "This read-only datastore contains the factory default 
         configuration for the device that will be used to replace 
         the contents of the read-write conventional configuration 
         datastores during a 'factory-reset' RPC operation.";
     }
   }
]]></sourcecode>
    </section>
    <section numbered="true" toc="default">
      <name>IANA Considerations</name>
      <t>This document registers one URI in the IETF XML Registry [RFC3688].
      The following registration has been made:</t>
      <artwork name="" type="" align="left" alt=""><![CDATA[  URI: urn:ietf:params:xml:ns:yang:ietf-factory-default
  Registrant Contact: The IESG.
  XML: N/A, the requested URI is an XML namespace.]]></artwork>
      <t>This document registers one YANG module in the YANG Module Names
      Registry [RFC6020]. The following registration has been made:</t>
      <artwork name="" type="" align="left" alt=""><![CDATA[  name: ietf-factory-default
  namespace: urn:ietf:params:xml:ns:yang:ietf-factory-default
  prefix: fd
  RFC: xxxx]]></artwork>
    </section>
    <section anchor="security" numbered="true" toc="default">
      <name>Security Considerations</name>
      <t>The YANG module defined in this document extends the base operations
      for NETCONF [RFC6241] and RESTCONF [RFC8040]. The lowest NETCONF layer
      is the secure transport layer, and the mandatory-to-implement secure
      transport is Secure Shell (SSH) [RFC6242]. The lowest RESTCONF layer is
      HTTPS, and the mandatory-to-implement secure transport is TLS
      [RFC8446].</t>
      <t>Access to the "factory-reset" RPC operation and factory default
      values of all configuration data nodes within "factory-default"
      datastore is considered sensitive and therefore has been restricted
      using the "default-deny-all" access control defined in <xref target="RFC8341" format="default"/>.</t>
      <t>The "factory-reset" RPC can prevent any further management of the
      device when the server is reset back to its factory default
      condition,e.g., the session and client config are included in the
      factory default contents or treated as dynamic files on the nonvoliatile
      storage and overwritten by the the "factory-reset" RPC.</t>
      <t>The operational disruption caused by setting the config to factory
      default contents or lacking appropriate security control on factory
      default configuration varies greatly depending on the implementation and
      current config.</t>
      <t>The non-volatile storage is expected to be wiped clean and reset back
      to the factory default state, but there is no guarantee that the data is
      wiped according to any particular data cleansing standard, and the owner
      of the device MUST NOT rely on any sensitive data (e.g., private keys)
      being forensically unrecoverable from the device's non-volatile storage
      after a factory-reset RPC has been invoked.</t>
    </section>
    <section numbered="true" toc="default">
      <name>Acknowledgements</name>
      <t>Thanks to Juergen Schoenwaelder, Ladislav Lhotka, Alex Campbell, Joe
      Clarke, Robert Wilton, Kent Watsen, Joel Jaeggli, Lou Berger, Andy
      Bierman, Susan Hares, Benjamin Kaduk, Stephen Kent, Stewart Bryant,
      Eric Vyncke, Murray Kucherawy, Roman Danyliw, Tony Przygienda,
      John Heasley for reviewing this draft and providing important input to
      this document.</t>
    </section>
    <section numbered="true" toc="default">
      <name>Contributors</name>
      <artwork name="" type="" align="left" alt=""><![CDATA[   Rohit R Ranade
   Huawei 
   Email: rohitrranade@huawei.com]]></artwork>
    </section>
    <!---->
  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7950.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8342.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8341.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.3688.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6020.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8525.xml"/>
      </references>
      <references>
        <name>Informative References</name>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6241.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6242.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8040.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8446.xml"/>
        <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.draft-ietf-anima-bootstrapping-keyinfra-41.xml"/>
      </references>
    </references>
    <section numbered="true" toc="default">
      <name>Changes between revisions</name>
      <t>Editorial Note (To be removed by RFC Editor)</t>
      <t>v14 -15</t>
      <ul spacing="normal">
        <li>Address comments raised in IESG review.</li>
      </ul>
      <t>v13 - 14</t>
      <ul spacing="normal">
        <li>Address additional issues raised during AD review.</li>
      </ul>
      <t>v12 - 13</t>
      <ul spacing="normal">
        <li>Address issues raised during AD review.</li>
      </ul>
      <t>v11 - 12</t>
      <ul spacing="normal">
        <li>Fix IDnits and reference issues from Shepherd review.</li>
      </ul>
      <t>v10 - 11</t>
      <ul spacing="normal">
        <li>Incorporate additional Shepherd review's comments.</li>
      </ul>
      <t>v09 - 10</t>
      <ul spacing="normal">
        <li>Incorporate Shepherd review's comments.</li>
      </ul>
      <t>v08 - 09</t>
      <ul spacing="normal">
        <li>Provide some guideline for operators and implementor who
          implement factory defaut method.</li>
      </ul>
      <t>v07 - 08</t>
      <ul spacing="normal">
        <li>Provide clarification and recommendation on the relationship
          between factory-reset RPC and reboot.</li>
        <li>Nits fixed based on YANG Doctor Review.</li>
      </ul>
      <t>v06 - 07</t>
      <ul spacing="normal">
        <li>Remove Factory default content specification;</li>
        <li>Remove reference to YANG instance data file format and zero touch
          provision [RFC8573];</li>
        <li>Remove copy-config operation extension on factory-default
          datastore</li>
      </ul>
      <t>v05 - 06</t>
      <ul spacing="normal">
        <li>Additional text to enhance security section.</li>
        <li>Add nacm:default-deny-all on "factory-reset" RPC.</li>
        <li>A few clarification on Factory default content specification.</li>
      </ul>
      <t>v03 - 04</t>
      <ul spacing="normal">
        <li>Additional text to clarify factory-reset RPC usage.</li>
      </ul>
      <t>v02 - 03</t>
      <ul spacing="normal">
        <li>Update security consideration section.</li>
      </ul>
      <t>v01 - v02</t>
      <ul spacing="normal">
        <li>Address security issue in the security consideration section.</li>
        <li>Remove an extension to the NETCONF &lt;copy-config&gt; operation
          which allows it to operate on the factory-default datastore.</li>
        <li>Add an extension to the NETCONF &lt;get-config&gt; operation
          which allows it to operate on the factory-default datastore.</li>
      </ul>
      <t>v00 - v01</t>
      <ul spacing="normal">
        <li>Change YANG server into server defined in NMDA architecture based
          on discussion.</li>
        <li>Allow reset the content of all read-write configuraton datastores
          to its factory default content except &lt;candidate&gt;.</li>
        <li>Add clarification text on factory-reset protocol operation
          behavior.</li>
      </ul>
      <t>v03 - v00</t>
      <ul spacing="normal">
        <li>Change draft name from draft-wu to
          draft-ietf-netmod-factory-default-00 without content changes.</li>
      </ul>
      <t>v02 - v03</t>
      <ul spacing="normal">
        <li>Change reset-datastore RPC into factory-reset RPC to allow reset
          the whole device with factory default content.</li>
        <li>Remove target datastore parameter from factory-reset RPC.</li>
        <li>Other editorial changes.</li>
      </ul>
      <t>v01 - v02</t>
      <ul spacing="normal">
        <li>Add copy-config based on Rob's comment.</li>
        <li>Reference Update.</li>
      </ul>
      <t>v03 - v00 - v01</t>
      <ul spacing="normal">
        <li>Changed name from draft-wu-netconf-restconf-factory-restore to
          draft-wu-netmod-factory-default</li>
        <li>Removed copy-config ; reset-datastore is enough</li>
      </ul>
      <t>v02 - v03 </t>
      <ul spacing="normal">
        <li>Restructured</li>
        <li>Made new datastore optional</li>
        <li>Removed Netconf capability</li>
        <li>Listed Open issues</li>
      </ul>
      <t>v01 - v02 </t>
      <ul spacing="normal">
        <li>-</li>
      </ul>
      <t>v00 - v01 </t>
      <ul spacing="normal">
        <li>-</li>
      </ul>
    </section>
  </back>
</rfc>
