<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc2629 version 1.5.24 -->
<?rfc docmapping="yes"?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-rmacklem-nfsv4-posix-acls-01" category="std" consensus="true" tocInclude="true" sortRefs="true" symRefs="true" obsoletes="" updates="" submissionType="IETF" xml:lang="en" version="3">
  <!-- xml2rfc v2v3 conversion 3.12.0 -->
  <front>
    <title abbrev="POSIX Draft ACL support for NFSv4.2">POSIX Draft ACL support for Network File System Version 4, Minor Version 2</title>
    <seriesInfo name="Internet-Draft" value="draft-rmacklem-nfsv4-posix-acls-01"/>
    <author initials="R." surname="Macklem" fullname="Rick Macklem">
      <organization abbrev="FreeBSD">FreeBSD Project</organization>
      <address>
        <postal>
          <country>Canada</country>
        </postal>
        <email>rmacklem@uoguelph.ca</email>
      </address>
    </author>
    <date year="2024" month="August" day="1"/>
    <area>Transport</area>
    <workgroup>Network File System Version 4</workgroup>
<abstract>
<t>
This document describes the addition of three new attributes that
are used by servers to support POSIX ACLs.
The term POSIX ACLs refers to the ACL component of the
Portable Operating System Interface (POSIX) 1003.1e draft 17
<xref target="IEEE" format="default"/>
document for which sponsorship was
withdrawn in January 1998.
Although the draft POSIX standard that describes these ACLs was
never ratified, several POSIX based operating systems, such as
Linux, Solaris and FreeBSD include support for them.
The NFS Version 4 (NFSv4) ACLs described in
<xref target="RFC8881" format="default"/>
henseforth referred to as NFSv4 ACLs,
use a different model and attempts to map between the ACLs
of these two models has not been completely successful.
As such, this document proposes three new attributes that may
optionally be used by an NFS Version 4, minor version 2 (NFSv4.2) server to support ACLs that
conform the afor mentioned POSIX 1003.1e draft 17.
</t>
</abstract>

    <note>
      <name>Note</name>
      <t>This note is to be removed before publishing as an RFC.</t>
      <t>Discussion of this draft occurs on the <eref target="nfsv4@ietf.org">NFSv4 working group mailing
list</eref>, archived at
<eref target="https://mailarchive.ietf.org/arch/browse/nfsv4/"/>. Working Group
information is available at
<eref target="https://datatracker.ietf.org/wg/nfsv4/about/"/>.</t>
    </note>
</front>

<middle>

<section
 anchor="section_8F035331-8EB8-4FBC-973A-673FBA5FE952"
 numbered="true"
 removeInRFC="false"
 toc="default">
<name>Introduction</name>
<t>
Implementation experience with mapping between NFSv4 and POSIX ACLs
has not been completely successful.
For example, if a NFSv4 ACL is applied to a server file that actually stores POSIX ACLs
on file system objects and is set
via SETATTR and then retrieved via GETATTR/READDIR, the ACL will often not be the
same, since the mapping algorithm cannot do an exact mapping between them.
The expired IETF draft
<xref target="Eriksen" format="default"/>
explains the mapping algorithms.
A server may optionally choose to use these mapping algorithms and/or
support the new attributes proposed by this document to set/get the
POSIX ACLs.
</t>
<t>
As such, this document proposes three new attributes as an extension of NFSv4.2
which can be used by SETATTR and GETATTR/READDIR to handle POSIX ACLs.
If a server chooses to support these attributes, it MUST support all
three of them.
</t>
<t>
For the semantics applied to POSIX ACLs by a server, please read the informational
references
<xref target="IEEE" format="default"/>
and
<xref target="Gr&#252;nbacher" format="default"/>.
However, there is a brief explanation of the aspects of POSIX ACLs
that might affect the on-the-wire ACL or when the ACLs may be set.
</t>

</section>
      <section numbered="true" toc="include" removeInRFC="false">
<name>Requirements Language</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 14 <xref target="RFC2119" format="default"/> <xref target="RFC8174" format="default"/> when, and only when, they
appear in all capitals, as shown here.</t>

</section>
      <section numbered="true" toc="include" removeInRFC="false">
<name>Protocol Extension Considerations</name>
<t>
This document presents an extension to minor version 2 of the NFSv4
protocol as described in
<xref target="RFC8178" format="default" sectionFormat="of"/>.
It describes new OPTIONAL
features.
NFSv4.2 servers and clients implemented without knowledge
of this extension will continue to interoperate with clients and
servers that are aware of the extension (whether or not they support
it).
</t>
<t>
Note that
<xref target="RFC7862" format="default" sectionFormat="of"/>
does not define NFSv4.2 as non-extensible, so
<xref target="RFC8178" format="default" sectionFormat="of"/>
treats it as an extensible minor version.
This Standards
Track RFC extends NFSv4.2 but does not update
<xref target="RFC7862" format="default" sectionFormat="of"/>
or
<xref target="RFC8178" format="default" sectionFormat="of"/>.
</t>
</section>


<section
 numbered="true"
 removeInRFC="false"
 toc="default">
<name>XDR definitions for new attributes</name>
<t>
	This section defines the XDR structures needed for the new OPTIONAL ACL
	related attributes.
</t>
          <sourcecode type="xdr">
enum aclmodel4 {
        ACL_MODEL_NFS4          = 1,
        ACL_MODEL_POSIX_DRAFT   = 2
};

enum posixacetag4 {
        POSIXACE4_TAG_USER_OBJ  = 1,
        POSIXACE4_TAG_USER      = 2,
        POSIXACE4_TAG_GROUP_OBJ = 3,
        POSIXACE4_TAG_GROUP     = 4,
        POSIXACE4_TAG_MASK      = 5,
        POSIXACE4_TAG_OTHER     = 6
};

typedef uint32_t        posixaceperm4;

/* Bit definitions for posixaceperm4. */
const POSIXACE4_PERM_EXECUTE    = 0x00000001;
const POSIXACE4_PERM_WRITE      = 0x00000002;
const POSIXACE4_PERM_READ       = 0x00000004;

struct posixace4 {
        posixacetag4    tag;
        posixaceperm4   perm;
        utf8str_mixed   who;
};

</sourcecode>
</section>

      <section numbered="true" toc="include" removeInRFC="false">
        <name>POSIX ACL Considerations</name>
<t>
A POSIX ACL always has one ACE for each of POSIXACE4_TAG_USER_OBJ,
POSIXACE4_TAG_GROUP_OBJ and POSIXACE4_TAG_OTHER.
If the ACL consists only of these three ACEs, it is referred to as
a minimal POSIX ACL.
A POSIX ACL may also have one or more POSIXACE4_TAG_USER and/or POSIXACE4_TAG_GROUP
ACE(s). Such a POSIX ACL is referred to as an extended POSIX ACL and must
have one POSIXACE4_TAG_MASK ACE as well.
A POSIX access ACL defines permissions for a file object.
A POSIX default ACL can only be associated with directory objects and
is used for inheritance.
The POSIX default ACL has no effect on access.
</t>
<t>
For POSIX ACLs, the POSIXACE4_TAG_USER and POSIXACE4_TAG_GROUP ACE(s)
are described for uids and gids by the informational references.
For these new attributes, the who value will be in the same format and
have the same semantics as a owner (for uid) or owner_group (for gid)
attribute.
</t>
<t>
For POSIX ACLs, setting of the low order 9 bits of mode can change
the ACL and setting of the POSIX access ACL can change the low order
9 bits of mode.
As such, the ordering of setting the attributes related to mode and
POSIX ACLs is important.
Therefore, a client MUST not set the low order 9 bits of mode via the mode or mode_set_masked attributes
in the same SETATTR operation as one that sets the posix_access_acl and/or posix_default_acl proposed in this document.
This is required because
<xref target="RFC8881" format="default"/>
does not specify an ordering for setting attributes in a SETATTR operation.
</t>
<t>
For POSIX, when a new object is created in a directory that has a
POSIX default ACL on it, the inherited ACL includes the intersection
between the mode specified by the POSIX system call and the
posixaceperm4 fields of the POSIX default ACL.
</t>
<t>
For NFSv4 operations that create new file objects (OPEN/OPEN4_CREATE, CREATE)
the low order 9 bits of the mode SHOULD be specified by either
mode or mode_set_masked in the setable attributes for the operation.
The attributes posix_access_acl and posix_default_acl MUST not be specified
in the setable attributes for the operation, so that the server may use the low order 9 bits of the mode,
along with the POSIX default ACL,
to create the new inherited ACL(s).
If the client needs to set the POSIX access ACL to something different than
what will be generated via inheritance, setting the low order 9 bits of
mode to zero during object creation will avoid any access vulnerability
between the time of object creation
and setting of the POSIX access ACL via a subsequent SETATTR operation.
</t>
</section>
      <section anchor="attr_table" numbered="true" toc="include" removeInRFC="false">
        <name slugifiedName="name-new-attributes-list-an"><bcp14>OPTIONAL</bcp14> New Attributes - List and Definition References</name>
        <t>
     The list of New <bcp14>OPTIONAL</bcp14> attributes appears in <xref target="new_attr_table" format="default" sectionFormat="of" derivedContent="Table 1"/>.
     The meaning of the columns of the table are:
        </t>
        <dl spacing="normal" newline="false">
          <dt>Name:</dt>
          <dd>The name of the attribute.</dd>
          <dt>Id:</dt>
          <dd>The number assigned to the attribute.</dd>
          <dt>Data Type:</dt>
          <dd>The XDR data type of the attribute.</dd>
          <dt>Acc:</dt>
          <dd>Access allowed to the attribute. R means
        read-only. RW means read/write.</dd>
          <dt>Defined in:</dt>
          <dd>The section of this specification that describes the
        attribute.</dd>
        </dl>
        <table anchor="new_attr_table" align="center" pn="table-1">
          <thead>
            <tr>
              <th align="left" colspan="1" rowspan="1">Name</th>
              <th align="left" colspan="1" rowspan="1">Id</th>
              <th align="left" colspan="1" rowspan="1">Data Type</th>
              <th align="left" colspan="1" rowspan="1">Acc</th>
              <th align="left" colspan="1" rowspan="1">Defined in:</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left" colspan="1" rowspan="1">server_acl_model</td>
              <td align="left" colspan="1" rowspan="1">NN</td>
              <td align="left" colspan="1" rowspan="1">aclmodel4</td>
              <td align="left" colspan="1" rowspan="1">R</td>
              <td align="left" colspan="1" rowspan="1">
                <xref target="attrdef_acl_model" format="default" sectionFormat="of"/>
              </td>
            </tr>
            <tr>
              <td align="left" colspan="1" rowspan="1">posix_default_acl</td>
              <td align="left" colspan="1" rowspan="1">NN</td>
              <td align="left" colspan="1" rowspan="1">posixace4&lt;&gt;</td>
              <td align="left" colspan="1" rowspan="1">RW</td>
              <td align="left" colspan="1" rowspan="1">
                <xref target="attrdef_posix_default_acl" format="default" sectionFormat="of"/>
              </td>
            </tr>
            <tr>
              <td align="left" colspan="1" rowspan="1">posix_access_acl</td>
              <td align="left" colspan="1" rowspan="1">NN</td>
              <td align="left" colspan="1" rowspan="1">posixace4&lt;&gt;</td>
              <td align="left" colspan="1" rowspan="1">RW</td>
              <td align="left" colspan="1" rowspan="1">
                <xref target="attrdef_posix_access_acl" format="default" sectionFormat="of"/>
              </td>
            </tr>
          </tbody>
        </table>
	</section>
      <section numbered="true" toc="include" removeInRFC="false">
	<name>Definitions of new recommended attributes</name>
      <section anchor="attrdef_acl_model" numbered="true" toc="include" removeInRFC="false">
            <name slugifiedName="name-attribute-NN-acl-model">Attribute NN: server_acl_model</name>
            <t>
	This attribute is a read-only attribute that describes which
	ACL model (NFSv4 vs POSIX) is used for the ACL stored on the file
	object on the NFSv4.2 server.
            </t>
	<t>
	It is a per-file system attribute.
	</t>
      <section numbered="true" removeInRFC="false">
	<name>Rationale</name>
            <t>
	This attribute allows the client to choose whether to use the
	acl attribute or the posix_access_acl and posix_default_acl
	attributes when doing GETATTR/SETATTR/READDIR.
	Doing so avoids any mapping between NFSv4 and POSIX ACLs being done by the server during
	GETATTR/SETATTR/READDIR operations.
            </t>
	   </section>
          </section>
      <section anchor="attrdef_posix_default_acl" numbered="true" toc="include" removeInRFC="false">
            <name slugifiedName="name-attribute-NN-posix-default-acl">Attribute NN: posix_default_acl</name>
            <t>
	This attribute specifies the POSIX default ACL for a
	directory.
	For the posixacetag4 values of POSIXACE4_TAG_USER_OBJ,
	POSIXACE4_TAG_GROUP_OBJ, POSIXACE4_TAG_MASK and
	POSIXACE4_TAG_OTHER
	the who field MUST be of zero length.
	For the posxiacetag4 values of POSIXACE4_TAG_USER and
	POSIXACE4_TAG_GROUP, the who field must be in the same format
	as would be used for the owner or owner_group attribute, respectively.
	There MUST only be one POSIXACE4_TAG_USER ACE in the ACL for each
	user as represented by the who value.
	Similarily, there MUST be only one POSIXACE4_TAR_GROUP in the ACL
	for each group as represented by the who value.
	Since a POSIX default ACL only applies to directories,
	a SETATTR of the posix_default_acl for a non-directory object
	MUST reply NFS4ERR_INVAL.
	If SETATTR of a POSIX extended ACL does not have a
	POSIXACE4_TAG_MASK ACE, the SETATTR of the ACL MUST reply NFS4ERR_INVAL.
	Doing a SETATTR for a posix_default_acl of zero length deletes
	the POSIX default ACL, if one exists.
	If no POSIX default ACL exists, this is a no-op.
	If a directory does not have a POSIX default ACL, a GETATTR/READDIR
	for the posix_default_acl attribute will reply with an ACL
	of zero length.
            </t>
	<t>
	This attribute is a per-file system object attribute.
	</t>
      <section numbered="true" removeInRFC="false">
	<name>Rationale</name>
            <t>
	Without this option, a file server that natively stores POSIX
	default ACLs must map between the POSIX ACL and a NFSv4 ACL
	to support the acl attribute.
	It also must somehow combine the POSIX default ACL used
	for inheritance with the POSIX access ACL used for access
	control to the directory itself during the mapping, since a directory
	file object can only have, at most, one NFSv4 ACL.
            </t>
	   </section>
          </section>
      <section anchor="attrdef_posix_access_acl" numbered="true" toc="include" removeInRFC="false">
            <name slugifiedName="name-attribute-NN-posix-access-acl">Attribute NN: posix_access_acl</name>
            <t>
	This attribute specifies the POSIX access ACL for a
	file object.
	For a GETATTR/READDIR, if a file object does not have a posix_access_acl stored for it,
	the server MUST generate a minimal one from the file's mode.
	For the posixacetag4 values of POSIXACE4_TAG_USER_OBJ,
	POSIXACE4_TAG_GROUP_OBJ, POSIXACE4_TAG_MASK and
	POSIXACE4_TAG_OTHER
	the who field MUST be of zero length.
	For the posxiacetag4 values of POSIXACE4_TAG_USER and
	POSIXACE4_TAG_GROUP, the who field must be in the same format
	as would be used for the owner or owner_group attribute, respectively.
	There MUST only be one POSIXACE4_TAG_USER ACE in the ACL for each
	user as represented by the who value.
	Similarily, there MUST be only one POSIXACE4_TAR_GROUP in the ACL
	for each group as represented by the who value.
	For a SETATTR, a posix_access_acl of zero length deletes the POSIX
	access ACL, returning it to the minimal access ACL based on mode.
	If SETATTR of a POSIX extended ACL does not have a
	POSIXACE4_TAG_MASK ACE, the SETATTR of the ACL MUST reply NFS4ERR_INVAL.
            </t>
	<t>
	This attribute is a per-file system object attribute.
	</t>
      <section numbered="true" removeInRFC="false">
	<name>Rationale</name>
            <t>
	Without this option, a file server that natively stores POSIX
	access ACLs must map between the POSIX ACL and a NFSv4 ACL
	to support the acl attribute.
            </t>
	   </section>
          </section>
</section>

<section
 anchor="section_88BBA4D6-ED42-4FE6-A208-9D277B68729A"
 numbered="true"
 removeInRFC="true"
 toc="default">
<name>Implementation Status</name>
<t>
This section records the status of known implementations of the
protocol defined by this specification at the time of posting of
this Internet-Draft.
The description of implementations in this section is
intended to assist the IETF in its decision processes in
progressing drafts to RFCs.
</t>
<t>
Please note that the listing of any individual implementation here
does not imply endorsement by the IETF.
Furthermore, no effort has been spent to verify the information
presented here that was supplied by IETF contributors.
This is not intended as, and must not be construed to be, a
catalog of available implementations or their features.
Readers are advised to note that other implementations may exist.
</t>

<section
 anchor="section_86689813-E907-4046-ADF1-58E2BF668546"
 numbered="true"
 removeInRFC="false"
 toc="default">
<name>FreeBSD NFS server and client</name>
<dl newline="false" spacing="normal" indent="11">
<dt>Organization:</dt>
<dd>
FreeBSD Project
</dd>
<dt>URL:</dt>
<dd>
<eref target="https://www.freebsd.org"/>
</dd>
<dt>Maturity:</dt>
<dd>
Experimental software based on the current document.
</dd>
<dt>Coverage:</dt>
<dd>
The posix_default_acl and posix_access_acl attributes described in this document were implemented for the
UFS file system configured to store POSIX ACLs.
</dd>
<dt>Licensing:</dt>
<dd>
BSD
</dd>
<dt>Implementation experience:</dt>
<dd>
The setfacl and getfacl commands appeared to function correctly.
</dd>
</dl>
</section>

</section>

</middle>

<back>

<references>
<name>References</name>

<references>
<name>Normative References</name>

<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
 href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
 href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7862.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
 href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
 href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8178.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
 href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8881.xml"/>
</references>

<references>
<name>Informational References</name>
        <reference anchor="Eriksen">
          <front>
            <title>Mapping Between NFSv4 and Posix Draft ACLs</title>
            <author fullname="M. Eriksen" initials="M." surname="Eriksen">
	    </author>
            <author fullname="J. Fields" initials="J." surname="Fields">
            </author>
            <date month="August" year="2006"/>
            <abstract>
		<t>
		This is an expired IETF draft that describes the mapping
		algorithms used when mapping between NFSv4 and POSIX draft
		ACLs</t>
            </abstract>
          </front>
        </reference>
        <reference anchor="Gr&#252;nbacher">
          <front>
            <title>POSIX Access Control Lists on Linux</title>
            <author fullname="A. Gr&#252;nbacher" initials="A." surname="Gr&#252;nbacher">
              <organization/>
            </author>
            <date month="June" year="2003"/>
          </front>
	  <refcontent>USENIX 2003 Annual Technical Conference Proceedings</refcontent>
        </reference>
        <reference anchor="IEEE">
          <front>
	    <title>
IEEE 1003.1e and 1003.2c: Draft Standard for Information Technology--Portable Operating System Interface (POSIX)--Part 1: System Application Program Interface (API) and Part 2: Shell and Utilities, draft 17
	    </title>
		<author>
		<organization>
		Institute of Electrical and Electronics Engineers
		</organization>
            </author>
            <date month="October" year="1997"/>
          </front>
        </reference>
</references>
</references>
    <section numbered="false" anchor="acknowledgments" toc="default">
      <name>Acknowledgments</name>
	<t>
	XXX
	</t>
     </section>

</back>

</rfc>
