<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>

<!-- Copyright (C) The IETF Trust (2014) -->
<!-- Copyright (C) The Internet Society (2014) -->

<!-- XML source for the Requirement Wars internet draft document -->

<!-- To generate text with the xml2rfc tool tclsh8.3 xml2rfc.tcl 
     xml2rfc this_file.xml that_file.txt which puts the formatted 
     text into that_file.txt -->

<!-- processing instructions (for a complete list and description,
     see file http://xml.resource.org/authoring/README.html -->

<!-- try to enforce the ID-nits conventions and DTD validity -->

<?rfc strict="yes" ?>

<!-- items used when reviewing the document -->

<?rfc comments="yes" ?>  <!-- controls display of <cref> elements -->
<?rfc inline="yes" ?>    <!-- when no, put comments at end in comments section,
                                otherwise, put inline -->
<?rfc editing="no" ?>   <!-- when yes, insert editing marks -->

<!-- create table of contents (set it options).  
     Note the table of contents may be omitted
     for very short documents --> 

<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>

<!-- choose the options for the references. Some like
     symbolic tags in the references (and citations)
     and others prefer numbers. --> 

<?rfc symrefs="yes"?>
<?rfc sortrefs="yes" ?>

<!-- these two save paper: start new paragraphs from the same page etc. -->

<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>

<!-- end of list of processing instructions -->

<rfc
    category="info"
    ipr="trust200902"
    docName="draft-ietf-nfsv4-umask-01" >

<!-- Copyright (C) The IETF Trust (2014) -->
<!-- Copyright (C) The Internet Society (2014) -->

<front>
    <title abbrev="NFSv4 umask">
      Allowing inheritable NFSv4 ACLs to override the umask
    </title>

    <author fullname="J. Bruce Fields"
            initials="J. B."
            surname="Fields">
      <organization abbrev="Red Hat">Red Hat, Inc.</organization>
      <address>
        <email>bfields@redhat.com</email>
      </address>
    </author>
    <author fullname="Andreas Gruenbacher"
            initials="A."
	    surname="Gruenbacher">
      <organization abbrev="Red Hat">Red Hat, Inc.</organization>
      <address>
        <email>agruenba@redhat.com</email>
      </address>
    </author>

    <date year="2016" month="September" day="30"/>

    <area>Transport</area>
    <workgroup>NFSv4</workgroup>
    <keyword>NFSv4</keyword>

    <abstract>
      <t>

	In some environments, inheritable NFSv4 ACLs can be rendered
	ineffective by the application of the per-process umask.  This
	is easily worked around by transmitting the umask and create
	mode separately, to allow servers to make more intelligent
	decisions about the new mode of a file.

      </t>
    </abstract>
</front>
<!-- Copyright (C) The IETF Trust (2014) -->
<!-- Copyright (C) The Internet Society (2014) -->
<middle>
<!-- Copyright (C) The IETF Trust (2014) -->
<!-- Copyright (C) The Internet Society (2014) -->

<section anchor="ssc:solution:conv" title="Conventions Used in This Document">
  <t>
    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
    "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
    document are to be interpreted as described in <xref target="RFC2119" />.
  </t>
</section>

<section anchor="sec:intro" title="Problem Statement">
  <t>
    On Unix-like systems, each process is associated with a file mode
    creation mask (umask).  In the absence of inheritable permissions,
    the umask specifies which permissions must be turned off when
    creating new file system objects.  With “POSIX” Access Control Lists
    <xref target="POSIX-1003.1e"/>, in the presence of inheritable
    permissions, the umask must be ignored.  Other Access Control List
    implementations on Unix-like systems may ignore the umask in a
    similar way.
  </t>

  <t>
    The NFSv4 protocol currently does not include the umask concept;
    applying the umask is left to clients.  Unfortunately, clients have
    no way of atomically checking for inheritable permissions and
    applying the umask only when necessary.  Instead, they err on the
    safe side and always apply the umask.  Thus the mode the server
    receives in an OPEN already has the umask applied.
  </t>

  <t>
      When applying the mode, section 6.4.1.1 of <xref
      target='RFC7530'/> recommends that servers SHOULD restrict
      permissions granted to any user or group named in the ACL to be no
      more than the permissions granted by the MODE4_RGRP, MODE4_WGRP,
      and MODE4_XGRP bits.  Servers aiming to provide clients with
      Unix-like chmod behavior may also be motivated by the same
      requirements in <xref target='SUSv4'/>.  (See the discussion of
      additional and alternate access control mechanisms in section
      "4.4 File Permissions".)
  </t>

  <t>
      On many existing installations, all ordinary users by default use
      the same effective group ID.  To prevent granting all users full
      access to each other's files, such installations usually default
      to a umask with very restrictive permissions.  Thus the named users
      and groups in an inherited ACL end up being mostly ignored.
  </t>

  <t>
      This leads to file permissions which are more restrictive than
      they should be in common cases; permission inheritance over NFSv4
      is broken.
  </t>

  <t>
    To address this problem, a new attribute is proposed which
    allows the server to apply the umask only when there are no
    inheritable permissions.
  </t>
</section>

<!-- Copyright (C) The IETF Trust (2014) -->
<!-- Copyright (C) The Internet Society (2014) -->

<section anchor="sec:solution" title="mode_umask Attribute">

  <figure>
    <artwork>
      struct mode_umask4 {
        mode4  mu_mode;
        mode4  mu_umask;
      };
    </artwork>
  </figure>

  <texttable anchor="tbl:rec_attr">
    <ttcol align="left">Name</ttcol>
    <ttcol align="left">Id</ttcol>
    <ttcol align="left">Data Type</ttcol>
    <ttcol align="left">Acc</ttcol>
    <ttcol align="left">Defined in</ttcol>
    <c>mode_umask</c>    <c>81</c> <c>mode_umask4</c>           <c>  W</c> <c><xref target="sec:solution" /></c>
  </texttable>

  <t>
    The NFSv4.2 mode_umask attribute is based on the open mode and
    umask that together determine the mode of a newly created UNIX file.
    Only the nine low-order mode4 bits of mu_umask are defined.  A
    server MUST return NFS4ERR_INVAL if bits other than those nine are
    set.
  </t>

  <t>
    The mode_umask attribute is only meaningful for operations that
    create objects (CREATE and OPEN); the server SHOULD reject it for
    other operations that take fattr4 arguments.
  </t>

  <t>
    The server MUST ignore any mode attribute set in the same operation
    as mode_umask.
  </t>

  <t>
    When the server supports the mode_umask attribute, a client creating
    a file should use mode_umask in place of mode, with mu_mode set to
    the unmodified mode provided by the user, and mu_umask set to the
    umask of the requesting process.
  </t>

  <t>
    The server then uses mode_umask as follows:
    <list style="symbols">
      <t>On a server that supports ACL attributes, if an object inherits
      any ACEs from its parent directory, mu_mode SHOULD be used,
      and mu_umask ignored.</t>
      <t>Otherwise, mu_umask MUST be used to limit the mode: all bits
      in the mode MUST be turned off which are set in the umask; the
      mode to use for creating the object becomes
      (mu_mode &amp; ~mu_umask) instead.  </t>
    </list>
  </t>

</section>
<!-- Copyright (C) The IETF Trust (2014) -->
<!-- Copyright (C) The Internet Society (2014) -->

<section anchor="sec:security" title="Security Considerations">
  <t>
    The mode_umask attribute shifts to the server the decision about
    when to apply the umask.  Because the server MUST apply the umask if
    there are no inheritable permissions, the traditional semantics are
    preserved in the absence of a permission inheritance mechanism.
    The only relaxation of permissions comes in the case servers follow
    the recommendation that they SHOULD ignore the umask in the presence
    of inheritable permissions.
  </t>

  <t>
    The practice of ignoring the umask when there are inheritable permissions
    in the form of a “POSIX” default ACL is common practice; there are no
    known security concerns.  The “POSIX” default ACL mechanism and the
    mechanism of inheriting permissions in NFSv4 is equivalent for this
    purpose.
  </t>
</section>
<!-- Copyright (C) The IETF Trust (2014) -->
<!-- Copyright (C) The Internet Society (2014) -->

</middle>
<!-- Copyright (C) The IETF Trust (2014) -->
<!-- Copyright (C) The Internet Society (2014) -->

<back>
<!-- Copyright (C) The IETF Trust (2014) -->
<!-- Copyright (C) The Internet Society (2014) -->

  <references title="Normative References">

    <reference anchor='RFC2119'>
      <front>
	<title abbrev='RFC Key Words'>Key words for use in RFCs to Indicate Requirement Levels</title>
	<author initials='S.' surname='Bradner' fullname='Scott Bradner'>
	  <organization>Harvard University</organization>
	  <address>
	    <postal>
	      <street>1350 Mass. Ave.</street>
	      <street>Cambridge</street>
	    <street>MA 02138</street></postal>
	    <phone>- +1 617 495 3864</phone>
     	<email>sob@harvard.edu</email></address></author>
     	<date year='1997' month='March' />
      </front>
    </reference>

    <reference anchor='LEGAL'
               target='http://trustee.ietf.org/docs/IETF-Trust-License-Policy.pdf'>
      <front>
      <title abbrev='Legal Provisions'>Legal Provisions Relating to IETF Documents</title>
        <author>
          <organization>IETF Trust</organization>
        </author>
        <date month="November" year="2008"/>
      </front>
      <format type="PDF" octets="44498"
       target="http://trustee.ietf.org/docs/IETF-Trust-License-Policy.pdf"/>
    </reference>

  <reference anchor='RFC4506'>
    <front>
    <title abbrev='XDR'>XDR: External Data Representation Standard</title>
    <author initials='M.' surname='Eisler' fullname='Mike Eisler'>
    <organization>Network Appliance, Inc.</organization>
    </author>
    <date month='May' year='2006'/>
    </front>
    <seriesInfo name='STD' value='67' />
    <seriesInfo name="RFC" value="4506"/>
  </reference>

  <reference anchor='RFC5661'>
    <front>
      <title>Network File System (NFS) Version 4 Minor Version 1 Protocol</title>
      <author initials="S." surname="Shepler" fullname="Spencer Shepler" role="editor">
        <organization abbrev="Sun">Sun Microsystems, Inc.</organization>
      </author>
      <author initials="M." surname="Eisler" fullname="Mike Eisler" role="editor">
        <organization abbrev="Netapp">Network Appliance, Inc.</organization>
      </author>
      <author initials="D." surname="Noveck" fullname="David Noveck" role="editor">
        <organization abbrev="Netapp">Network Appliance, Inc.</organization>
      </author>
      <date month="January" year="2010"/>
    </front>
    <seriesInfo name="RFC" value="5661"/>
  </reference>

  <reference anchor='RFC5662'>
    <front>
      <title>Network File System (NFS) Version 4 Minor Version 1 External Data Representation Standard (XDR) Description</title>
      <author initials="S." surname="Shepler" fullname="Spencer Shepler" role="editor">
        <organization abbrev="Sun">Sun Microsystems, Inc.</organization>
      </author>
      <author initials="M." surname="Eisler" fullname="Mike Eisler" role="editor">
        <organization abbrev="Netapp">Network Appliance, Inc.</organization>
      </author>
      <author initials="D." surname="Noveck" fullname="David Noveck" role="editor">
        <organization abbrev="Netapp">Network Appliance, Inc.</organization>
      </author>
      <date month="January" year="2010"/>
    </front>
    <seriesInfo name="RFC" value="5662"/>
  </reference>

  <reference anchor='RFC7530'>
    <front>
      <title>Network File System (NFS) version 4 Protocol</title>
      <author initials="T." surname="Haynes" fullname="T. Haynes">
        <organization>Dell</organization>
      </author>
      <author initials="D." surname="Noveck" fullname="D. Noveck">
        <organization>Dell</organization>
      </author>
      <date year="2015" month="March"/>
    </front>
    <seriesInfo name="RFC" value="7530"/>
  </reference>

  <reference anchor='SUSv4'>
    <front>
      <title>Single UNIX Specification Version 4</title>
      <author>
        <organization>The Open Group</organization>
      </author>
      <date year="2013"/>
    </front>
  </reference>
  
  <reference anchor="POSIX-1003.1e">
    <front>
      <title>POSIX 1003.1e Withdrawn Draft 17</title>
      <author>
	<organization>Portable Applications Standards Committee of the IEEE Compute Society</organization>
      </author>
      <date month="October" year="1997"/>
    </front>
  </reference>
</references>
<!-- Copyright (C) The IETF Trust (2014) -->
<!-- Copyright (C) The Internet Society (2014) -->

<section title="Acknowledgments">
<t>
Thanks to Dave Noveck and Trond Myklebust for review.
</t>
</section>
<!-- Copyright (C) The IETF Trust (2014) -->
<!-- Copyright (C) The Internet Society (2014) -->

</back>
<!-- Copyright (C) The IETF Trust (2014) -->
<!-- Copyright (C) The Internet Society (2014) -->

</rfc>
