<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 03:35:34 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Whamcloud Community JIRA</title>
    <link>https://jira.whamcloud.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.4.14</version>
        <build-number>940014</build-number>
        <build-date>05-12-2023</build-date>
    </build-info>


<item>
            <title>[LU-17454] nodemap: enable root squash user even if deny_unknown=0</title>
                <link>https://jira.whamcloud.com/browse/LU-17454</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;Root user squashed is denied access if deny_unknown is set:&lt;/p&gt;

&lt;p&gt;The properties&#160;&lt;tt&gt;squash_uid&lt;/tt&gt;,&#160;&lt;tt&gt;squash_gid&lt;/tt&gt;&#160;and&#160;&lt;tt&gt;squash_projid&lt;/tt&gt;&#160;define the default UID, GID and PROJID respectively that users will be squashed to if unmapped, unless the deny_unknown flag is set, in which case access will still be denied.&lt;/p&gt;


&lt;p&gt;It means that root user can&apos;t be used on the client side unless:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;root is not squashed at all (unsecure)&lt;/li&gt;
	&lt;li&gt;or all user are allowed (deny_unknown=0)&lt;/li&gt;
&lt;/ul&gt;
</description>
                <environment></environment>
        <key id="80181">LU-17454</key>
            <summary>nodemap: enable root squash user even if deny_unknown=0</summary>
                <type id="4" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11310&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="4" iconUrl="https://jira.whamcloud.com/images/icons/priorities/minor.svg">Minor</priority>
                        <status id="1" iconUrl="https://jira.whamcloud.com/images/icons/statuses/open.png" description="The issue is open and ready for the assignee to start work on it.">Open</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="sebastien">Sebastien Buisson</assignee>
                                    <reporter username="ldouriez">Louis Douriez</reporter>
                        <labels>
                    </labels>
                <created>Mon, 22 Jan 2024 15:27:15 +0000</created>
                <updated>Wed, 7 Feb 2024 01:07:30 +0000</updated>
                                            <version>Lustre 2.14.0</version>
                                                        <due></due>
                            <votes>0</votes>
                                    <watches>5</watches>
                                                                            <comments>
                            <comment id="400829" author="gerrit" created="Tue, 23 Jan 2024 15:54:19 +0000"  >&lt;p&gt;&lt;del&gt;&quot;Sebastien Buisson &amp;lt;sbuisson@ddn.com&amp;gt;&quot; uploaded a new patch:&lt;/del&gt; &lt;a href=&quot;https://review.whamcloud.com/c/fs/lustre-release/+/53781&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/53781&lt;/a&gt;&lt;br/&gt;
&lt;del&gt;Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-17454&quot; title=&quot;nodemap: enable root squash user even if deny_unknown=0&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-17454&quot;&gt;LU-17454&lt;/a&gt; nodemap: root_squash independent of deny_unknown&lt;/del&gt;&lt;br/&gt;
&lt;del&gt;Project: fs/lustre-release&lt;/del&gt;&lt;br/&gt;
&lt;del&gt;Branch: master&lt;/del&gt;&lt;br/&gt;
&lt;del&gt;Current Patch Set: 1&lt;/del&gt;&lt;br/&gt;
&lt;del&gt;Commit: f38cbe58178ea94c12fea4e7e0296f637e2f9943&lt;/del&gt;&lt;/p&gt;</comment>
                            <comment id="400911" author="adilger" created="Wed, 24 Jan 2024 00:26:55 +0000"  >&lt;p&gt;Does it make sense in this case to add a mapping for root to some other ID rather than always allowing access for root?  Otherwise it now seems that root cannot be blocked from accessing the filesystem.  Or somehow distinguish between a &quot;squashed unknown ID&quot; from &quot;squashed root&quot; and have a separate nodemap flag that indicates whether squashed root should be blocked?&lt;/p&gt;</comment>
                            <comment id="400946" author="sebastien" created="Wed, 24 Jan 2024 08:38:29 +0000"  >&lt;p&gt;Patch &quot;&lt;a href=&quot;https://jira.whamcloud.com/browse/LU-17454&quot; title=&quot;nodemap: enable root squash user even if deny_unknown=0&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-17454&quot;&gt;LU-17454&lt;/a&gt; nodemap: root_squash independent of deny_unknown&quot; makes nodemap behavior consistent with what has been documented from the beginning:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The property admin defines whether root is squashed on the policy group. By default, it is squashed, unless this property is enabled. &lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;So either root remains root (&lt;tt&gt;admin&lt;/tt&gt; property set to 1), or it is squashed to the values &lt;tt&gt;squash_uid/squash_gid&lt;/tt&gt; (&lt;tt&gt;admin&lt;/tt&gt; property set to 0).&lt;/p&gt;

&lt;p&gt;I am not sure the intention was to ever &apos;block&apos; root access. And by doing so, it is just not possible to mount the client.&lt;/p&gt;

&lt;p&gt;Maybe the less confusing could be to add properties to let admins specify dedicated squash uid/gid for root, so that root is squashed to a uid/gid different than the regular users. But I imagine it can be error prone to have two distinct squashings.&lt;/p&gt;

&lt;p&gt;If we look at the on-disk data structure, it is already full (32 bytes):&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;struct nodemap_cluster_rec {
	char			ncr_name[LUSTRE_NODEMAP_NAME_LENGTH + 1];
	enum nm_flag_bits	ncr_flags:8;
	enum nm_flag2_bits	ncr_flags2:8;
	__u8			ncr_padding1;
	__u32			ncr_squash_projid;
	__u32			ncr_squash_uid;
	__u32			ncr_squash_gid;
};
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;We would have to create a new sub-key in order to introduce a new record sub-type, as we did for the role-based-access-control property:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;/* sub-keys for records of type NODEMAP_CLUSTER_IDX */
enum nodemap_cluster_rec_subid {
	NODEMAP_CLUSTER_REC = 0,   /* nodemap_cluster_rec */
	NODEMAP_CLUSTER_ROLES = 1, /* nodemap_cluster_roles_rec */
};
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Or maybe a better way would be to just add a new role, such as &apos;allow_squashed_root&apos; (in this way, as new caps are necessarily ON by default). By default it would be allowed, but if this capability is removed, then we would deny access to root if the &lt;tt&gt;admin&lt;/tt&gt; property is not set, instead of squashing it.&lt;br/&gt;
I think it would have the advantage of being less confusing, and simpler to implement, while still addressing the requirement of being able to &apos;block&apos; root access.&lt;/p&gt;</comment>
                            <comment id="401146" author="mrasobarnett" created="Thu, 25 Jan 2024 12:50:38 +0000"  >&lt;p&gt;If I understand the patch correctly, I like this approach without adding further flags which I thing would be confusing.&lt;/p&gt;

&lt;p&gt;With Patch, the new behaviour with admin=0, deny_unknown=1 would still allow root in a tenant to mount the filesystem, which is the critical problem addressed in this ticket, but root would be squashed to squash_uid and be unable to then access the filesystem. The admin can then optionally create a mapping for the tenant&apos;s root user in that nodemap in the usual way if desired.&lt;/p&gt;

&lt;p&gt;This seems reasonable behaviour to me without requiring additional flags. I&apos;m not sure if I prefer an &apos;allow_squashed_root&apos; vs just creating an idmap rule for the root user.&lt;/p&gt;
</comment>
                            <comment id="401151" author="sebastien" created="Thu, 25 Jan 2024 13:18:14 +0000"  >&lt;p&gt;Thanks for your feedback Matt!&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;This seems reasonable behaviour to me without requiring additional flags. I&apos;m not sure if I prefer an &apos;allow_squashed_root&apos; vs just creating an idmap rule for the root user.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;To me, creating an idmap rule for the root user would be confusing because of the &lt;tt&gt;admin&lt;/tt&gt; property that controls whether root is squashed or not. Today, the definition is:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;The property admin defines whether root is squashed on the policy group.
By default, it is squashed, unless this property is enabled.
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;If we also accept an idmap rule for the root user, that would become something like this:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;The property admin defines whether root is mapped/squashed on the policy group.
If this property is enabled, root on the client remains root on the file system on server side.
If this property is disabled, then root is mapped if an idmap rule for the root user is defined.
Otherwise root is squashed to squash_uid/gid.
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;That would makes things much more complicated IMO, while still not giving the ability to block root access.&lt;/p&gt;</comment>
                            <comment id="401377" author="adilger" created="Fri, 26 Jan 2024 09:01:47 +0000"  >&lt;p&gt;OK, I&apos;m happy to keep it simpler if that works for everyone.&lt;/p&gt;</comment>
                            <comment id="401783" author="mrasobarnett" created="Tue, 30 Jan 2024 10:14:12 +0000"  >&lt;p&gt;Hi Sebastien, sorry for the delay in responding to your comment.&lt;/p&gt;

&lt;p&gt;I actually still prefer the second formulation that you outlined above, the description given for the effect of admin + idmap rule reads to me quite logically, but that&apos;s just my perspective on this.&lt;/p&gt;

&lt;p&gt;My opinion is:&lt;br/&gt;
1) We separate the ability to mount the filesystem from root-squash as your patch is doing. So we always allow the ability of local root to mount the filesystem, if the nodemap policy permits it for this client.&lt;/p&gt;

&lt;p&gt;2) Then for what access the local root user has, the &apos;admin&apos; property always controls whether root is squashed. There must be no way around that, so if an idmap rule is permitted for the local root user, it must not be able to override this (eg: --idmap 0:0). &lt;/p&gt;

&lt;p&gt;So then the behaviour is: if no idmap rule is specified for local root user, then it will be squashed to the the squash_uid/gid value as currently. &lt;/p&gt;

&lt;p&gt;If &apos;deny_unknown&apos; is 1, then the local root user will be blocked from accessing the mount. If the admin wants to allow local root access, while still preventing other local user UIDs from accessing the mount, then the admin can create an idmap rule for the local root user, and control their access with file permissions as with any other mapped user.&lt;/p&gt;</comment>
                            <comment id="401850" author="sebastien" created="Tue, 30 Jan 2024 16:54:05 +0000"  >&lt;p&gt;Thinking further about the requirements, I think there are two different ideas, which are not completely compatible:&lt;br/&gt;
1. give the ability to block root. For this, I think the solution that would be both easier to understand for admins, and efficient to implement, would be to rely on a new rbac role such as &apos;allow_squashed_root&apos;.&lt;br/&gt;
2. map root to a specific uid/gid, different from the ones applied for regular users. In this case, it would be better to allow an idmap for &apos;0&apos;. But as you say, the &lt;tt&gt;admin&lt;/tt&gt; property would always have precedence over this mapping: if a mapping for &apos;0&apos; is defined, but &lt;tt&gt;admin&lt;/tt&gt; is 1, then this mapping is ignored. And a mapping for &apos;0&apos; would always have precedence over the squash uid/gid.&lt;/p&gt;

&lt;p&gt;To implement the second point, we would ideally want to have this behavior for root, that mimics what we have for regular users:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;if &lt;tt&gt;admin&lt;/tt&gt; is set, root remains root.&lt;/li&gt;
	&lt;li&gt;if &lt;tt&gt;admin&lt;/tt&gt; is not set, an idmap for &apos;0&apos; is taken into account.&lt;/li&gt;
	&lt;li&gt;if &lt;tt&gt;admin&lt;/tt&gt; is not set and there is not idmap for &apos;0&apos; and &lt;tt&gt;deny_unknown&lt;/tt&gt; is not set, root is squashed to the squash uid/gid.&lt;/li&gt;
	&lt;li&gt;if &lt;tt&gt;admin&lt;/tt&gt; is not set and there is not idmap for &apos;0&apos; and &lt;tt&gt;deny_unknown&lt;/tt&gt; is set, root is blocked.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;I am trying to find potential issues with existing nodemap configurations at customer sites. But after all it seems that implementing this would not break existing sites, in a sense that it would not change nodemap&apos;s behavior after code update, because today idmaps for &apos;0&apos; are not possible.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.whamcloud.com/secure/ViewProfile.jspa?name=mrasobarnett&quot; class=&quot;user-hover&quot; rel=&quot;mrasobarnett&quot;&gt;mrasobarnett&lt;/a&gt; does this sound good to you?&lt;br/&gt;
&lt;a href=&quot;https://jira.whamcloud.com/secure/ViewProfile.jspa?name=adilger&quot; class=&quot;user-hover&quot; rel=&quot;adilger&quot;&gt;adilger&lt;/a&gt; do you see any pitfalls?&lt;/p&gt;</comment>
                            <comment id="401958" author="adilger" created="Wed, 31 Jan 2024 08:24:53 +0000"  >&lt;p&gt;Sebastien, I think this proposal is better than changing the current behavior. Allowing a mapping for root totally makes sense - I thought this was always possible, TBH. &lt;/p&gt;</comment>
                            <comment id="401979" author="mrasobarnett" created="Wed, 31 Jan 2024 12:01:08 +0000"  >&lt;p&gt;This proposal looks good to me Sebastien, thanks.&lt;/p&gt;</comment>
                            <comment id="401995" author="gerrit" created="Wed, 31 Jan 2024 14:50:56 +0000"  >&lt;p&gt;&quot;Sebastien Buisson &amp;lt;sbuisson@ddn.com&amp;gt;&quot; uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/c/fs/lustre-release/+/53870&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/53870&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-17454&quot; title=&quot;nodemap: enable root squash user even if deny_unknown=0&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-17454&quot;&gt;LU-17454&lt;/a&gt; nodemap: allow mapping for root&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: c7de298dd4bad97d43a3e542eda66c61ecfe324d&lt;/p&gt;</comment>
                            <comment id="402000" author="sebastien" created="Wed, 31 Jan 2024 15:16:50 +0000"  >&lt;p&gt;Actually it seems mapping for root has never been taken into account, according to this code comment in the header of &lt;tt&gt;nodemap_map_id&lt;/tt&gt;, from the initial git push of the feature:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt; * if the id to be looked up is 0, check that root access is allowed and if it
 * is, return 0. Otherwise, return the squash uid or gid.
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I submitted patch &quot;&lt;a href=&quot;https://jira.whamcloud.com/browse/LU-17454&quot; title=&quot;nodemap: enable root squash user even if deny_unknown=0&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-17454&quot;&gt;LU-17454&lt;/a&gt; nodemap: allow mapping for root&quot; &lt;a href=&quot;https://review.whamcloud.com/53870&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/53870&lt;/a&gt; to allow mapping for root, according to the description in comment &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-17454?focusedId=401850&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-401850&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.whamcloud.com/browse/LU-17454?focusedId=401850&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-401850&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Note that &lt;tt&gt;map_mode&lt;/tt&gt; remains ignored for root, as it does not really make sense. Also, capabilities are not dropped for root when mapped, just like it is done for regular users. If admins want to drop root capabilities, root must be squashed.&lt;/p&gt;

&lt;p&gt;So I am going to abandon patch &quot;&lt;a href=&quot;https://jira.whamcloud.com/browse/LU-17454&quot; title=&quot;nodemap: enable root squash user even if deny_unknown=0&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-17454&quot;&gt;LU-17454&lt;/a&gt; nodemap: root_squash independent of deny_unknown&quot; &lt;a href=&quot;https://review.whamcloud.com/53781&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/53781&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="402946" author="adilger" created="Wed, 7 Feb 2024 01:07:30 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.whamcloud.com/secure/ViewProfile.jspa?name=mrasobarnett&quot; class=&quot;user-hover&quot; rel=&quot;mrasobarnett&quot;&gt;mrasobarnett&lt;/a&gt; I don&apos;t see that you have an account in Gerrit to add as a reviewer to patch &lt;a href=&quot;https://review.whamcloud.com/53870&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/53870&lt;/a&gt; &quot;&lt;tt&gt;&lt;a href=&quot;https://jira.whamcloud.com/browse/LU-17454&quot; title=&quot;nodemap: enable root squash user even if deny_unknown=0&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-17454&quot;&gt;LU-17454&lt;/a&gt; nodemap: allow mapping for root&lt;/tt&gt;&quot;.  It would be useful for you to review, if possible.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                            <customfield id="customfield_10890" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10390" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i048hb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10060" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Severity</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10022"><![CDATA[3]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>