<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent">

<rfc xmlns:xi="http://www.w3.org/2001/XInclude"
     docName="draft-ietf-netmod-factory-default-15" number="8808"
     ipr="trust200902" obsoletes="" updates="" submissionType="IETF"
     category="std" consensus="true" xml:lang="en" tocInclude="true"
     symRefs="true" sortRefs="true" version="3">

<!-- xml2rfc v2v3 conversion 2.44.0 -->
  <front>
    <title abbrev="Factory Default Settings">A YANG Data Model
    for Factory Default Settings</title>

    <seriesInfo name="RFC" value="8808"/>
    <author fullname="Qin Wu" initials="Q." surname="Wu">
      <organization>Huawei</organization>
      <address>
        <postal>
          <street>101 Software Avenue</street>
          <extaddr>Yuhua District</extaddr>
          <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>Budapest</city><code>1117</code>
          <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" month="August" />
    
    <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 contents. This mechanism may be
      used, for example, when the existing configuration has major errors and so
      restarting the configuration process from scratch is the best
      option.</t>
      <t>A "factory-reset" remote procedure call (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 contents.</t>
      <t>In addition, an optional "factory-default" read-only datastore is
      defined within the YANG data model. This datastore contains the data to replace
      the contents of implemented read-write conventional configuration
      datastores at reset and can also be used in the
      &lt;get&nbhy;data&gt; operation.</t>
      <t>The YANG data model in this document conforms to the Network
      Management Datastore Architecture defined in <xref target="RFC8342" format="default"/>.</t>
      <section numbered="true" toc="default">
        <name>Terminology</name>
        <t>The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>",
        "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>",
        "<bcp14>SHALL NOT</bcp14>", "<bcp14>SHOULD</bcp14>",
        "<bcp14>SHOULD NOT</bcp14>",
        "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
        "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document
        are to be interpreted as described in BCP&nbsp;14
        <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only
        when, they appear in all capitals, as shown here.</t>
        <t>The following terms are defined in <xref target="RFC8342"
        format="default"/> and <xref target="RFC7950" format="default"/> 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>This document defines the following term:</t>
        <dl newline="false">
         <dt>"factory-default" datastore: </dt>
          <dd>A read-only configuration datastore
            holding a preset initial configuration that is used to initialize
            the configuration of a server. This datastore is referred to as
            "&lt;factory-default&gt;".</dd>
        </dl>
      </section>
    </section>

    <section numbered="true" toc="default">
      <name>&quot;Factory-Reset&quot; RPC</name>
      <t>This document introduces a new "factory-reset" RPC. 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 contents from other datastores
          (e.g., &lt;intended&gt; gets its contents from &lt;running&gt;).</li>
        <li>All data in any dynamic configuration datastores <bcp14>MUST</bcp14> be
          discarded.</li>
        <li>The contents of the &lt;operational&gt; datastore <bcp14>MUST</bcp14> reflect
          the operational state of the device after applying the factory
          default configuration.</li>
      </ul>

   <t>In addition, the "factory-reset" RPC <bcp14>MUST</bcp14> restore nonvolatile
      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 Initial Device Identifier (IDevID) certificate <xref target="I-D.ietf-anima-bootstrapping-keyinfra" format="default"/>). When
      this process includes security-sensitive data such as cryptographic keys
      or passwords, it is <bcp14>RECOMMENDED</bcp14> to perform the deletion
      in as thorough a manner as possible (e.g., overwriting the physical storage medium with
      zeros and/or random bits for repurposing or end-of-life (EOL) disposal) to
      reduce the risk of the sensitive material being recoverable. The
      "factory-reset" RPC <bcp14>MAY</bcp14> 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 <bcp14>SHOULD</bcp14> 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>&quot;Factory-Default&quot; Datastore</name>
      <t>Following the guidelines for defining datastores in
<xref target="RFC8342" format="default" section="A" sectionFormat="of" 
derivedLink="https://rfc-editor.org/rfc/rfc8342#appendix-A"
 derivedContent="RFC8342"/>, this document introduces a new optional datastore resource
      named "factory-default" that represents a preset initial configuration
      that can be used to initialize the configuration of a server. A device
      <bcp14>MAY</bcp14> 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>
      <dl>
        <dt>Name:</dt> <dd>"factory-default".</dd>
        <dt>YANG modules:</dt><dd>The "factory-default" datastore schema
	<bcp14>MUST</bcp14> be either
          (1)&nbsp;the same as the conventional configuration datastores or
          (2)&nbsp;a&nbsp;subset of the datastore schema for the conventional configuration datastores.</dd>
        <dt>YANG nodes:</dt> <dd>All "config true" data nodes.</dd>
        <dt>Management operations:</dt> <dd>The contents of the datastore is set by the
          server in an implementation-dependent manner. The contents cannot be
          changed by management operations via the Network Configuration
	  Protocol (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 contents to
          &lt;running&gt; and, if present, &lt;startup&gt; and/or
          &lt;candidate&gt;. The contents of these datastores is then
          propagated automatically to any other read-only datastores, e.g.,
          &lt;intended&gt; and &lt;operational&gt;.</dd>
        <dt>Origin:</dt><dd>This document does not define a new origin
	identity, as it does not interact with the &lt;operational&gt; datastore.</dd>
        <dt>Protocols:</dt><dd>RESTCONF, NETCONF, and other management protocols.</dd>
        <dt>Defining YANG module:</dt><dd>"ietf-factory-default".</dd>
      </dl>
      <t>The contents of &lt;factory-default&gt; are defined by the
      device vendor and <bcp14>MUST</bcp14> persist across device restarts. If supported, the
      "factory-default" datastore <bcp14>MUST</bcp14> be included in the list of
      datastores in the 
      YANG library <xref target="RFC8525" format="default"/>.</t>
    </section>
    <section numbered="true" toc="default">
      <name>YANG Module</name>
      <t>This module uses the "datastore" identity <xref target="RFC8342" format="default"/> and the
      "default&nbhy;deny-all" extension statement from <xref target="RFC8341"/>.</t>
      <sourcecode name="ietf-factory-default@2020-08-31.yang" type="yang" 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
         "RFC 8341: Network Configuration Access Control Model";
     }

     organization
       "IETF Network Modeling (netmod) Working Group";
     contact
       "WG Web:   <https://datatracker.ietf.org/wg/netmod/>
        WG List:  <mailto:netmod@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
        independently 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
        (https://trustee.ietf.org/license-info).

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

     revision 2020-08-31 {
       description
         "Initial revision.";
       reference
         "RFC 8808: A YANG Data Model for Factory Default Settings";
     }

     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 contents and any nonvolatile 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> IANA has registered the following URI in the "ns" subregistry within
      the "IETF XML Registry" <xref target="RFC3688" format="default"/>:</t>
<dl newline="false" spacing="compact">
 <dt>URI:</dt>
  <dd>urn:ietf:params:xml:ns:yang:ietf-factory-default </dd>
 <dt>Registrant Contact:</dt>
  <dd>The IESG.</dd>
 <dt>XML:</dt>
  <dd>N/A; the requested URI is an XML namespace.</dd>
</dl>
      <t>IANA has registered the following YANG module in the "YANG Module
   Names" subregistry <xref target="RFC6020" format="default"/> within the
      "YANG Parameters" registry:</t>
   <dl newline="false" spacing="compact">
    <dt>Name:</dt>
      <dd>ietf-factory-default</dd>
    <dt>Namespace:</dt>
      <dd>urn:ietf:params:xml:ns:yang:ietf-factory-default</dd>
    <dt>Prefix:</dt>
      <dd>fd</dd>
    <dt>Reference:</dt>
      <dd>8808</dd>
   </dl>
       </section>
       <section anchor="security" numbered="true" toc="default">
      <name>Security Considerations</name>
<t>The YANG module specified in this document defines a schema for data
that is designed to be accessed via network management protocols such
as NETCONF <xref target="RFC6241"/> or RESTCONF <xref target="RFC8040"/>.
The lowest NETCONF layer is the secure transport layer, and the
mandatory-to-implement secure transport is Secure Shell (SSH)
<xref target="RFC6242"/>. The lowest RESTCONF layer is HTTPS, and the
mandatory-to-implement secure transport is TLS <xref target="RFC8446"/>.</t>
<t>
The Network Configuration Access Control Model (NACM) <xref target="RFC8341"/>
provides the means to restrict access for particular NETCONF or RESTCONF users
to a preconfigured subset of all available NETCONF or RESTCONF protocol
operations and content. 
</t>
      <t>Access to the "factory-reset" RPC operation and factory default
      values of all configuration data nodes within the "factory-default"
      datastore is considered sensitive and therefore has been restricted by
      using the "default-deny-all" access control statement 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 configurations are included in the
      factory default contents or treated as dynamic files in nonvolatile
      storage and overwritten by the "factory-reset" RPC.</t>
      <t>The operational disruption caused by setting the configuration to factory
      default contents or the lack of appropriate security control on the factory
      default configuration varies greatly, depending on the implementation and
      current configuration.</t>
      <t>The nonvolatile 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 clean according to any particular data-cleansing standard, and the owner
      of the device <bcp14>MUST NOT</bcp14> rely on any sensitive data (e.g., private keys)
      being forensically unrecoverable from the device's nonvolatile storage
      after a "factory-reset" RPC has been invoked.</t>
    </section>
  </middle>
  <back>

<!-- draft-ietf-anima-bootstrapping-keyinfra (MISSREF) -->
<displayreference target="I-D.ietf-anima-bootstrapping-keyinfra" to="BRSKI"/>

    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7950.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8342.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8341.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3688.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6020.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8525.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6241.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6242.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8040.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8446.xml"/>
      </references>
      <references>
        <name>Informative References</name>
        <xi:include href="https://datatracker.ietf.org/doc/bibxml3/draft-ietf-anima-bootstrapping-keyinfra.xml"/>
      </references>
    </references>
    <section numbered="false" toc="default">
      <name>Acknowledgements</name>
     <t> Thanks to <contact fullname="Juergen Schoenwaelder"/>,
     <contact fullname="Ladislav Lhotka"/>, <contact fullname="Alex
     Campbell"/>, <contact fullname="Joe Clarke"/>, <contact
     fullname="Robert Wilton"/>, <contact fullname="Kent Watsen"/>,
     <contact fullname="Joel Jaeggli"/>, <contact fullname="Lou
     Berger"/>, <contact fullname="Andy Bierman"/>, <contact
     fullname="Susan Hares"/>, <contact fullname="Benjamin Kaduk"/>,
     <contact fullname="Stephen Kent"/>, <contact fullname="Stewart
     Bryant"/>, <contact fullname="Éric Vyncke"/>, <contact
     fullname="Murray Kucherawy"/>, <contact fullname="Roman
     Danyliw"/>, <contact fullname="Tony Przygienda"/>, and <contact
     fullname="John Heasley"/> for reviewing, and providing
     important input to, this document.</t>
     </section>
    <section numbered="false" toc="default">
      <name>Contributors</name>
<contact fullname="Rohit R Ranade" >
        <organization>Huawei</organization>
        <address>
         <email>rohitrranade@huawei.com</email>
        </address>
      </contact>
    </section>
  </back>
</rfc>
