<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 01:37:36 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-3866] missing permission checks on HSM operations</title>
                <link>https://jira.whamcloud.com/browse/LU-3866</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;We have two kinds of missing permission checks in HSM. I&apos;ll call them &quot;bad&quot; and &quot;less-bad.&quot;&lt;/p&gt;

&lt;p&gt;Here are the bad ones: By guessing its FID an unprivileged user can archive and restore an arbitrary file, even one which is otherwise inaccessible. An unprivileged user can also cancel running HSM actions on an arbitrary file, and send a remove command.&lt;/p&gt;

&lt;p&gt;If write permission for other is set on the file then an unprivileged user can get about 1/2 through HSM release, failing at the call to mo_xattr_set() on the orphan, just before layout_swap.&lt;/p&gt;

&lt;p&gt;The less-bad ones involve the rights to perform various HSM operations on a file owned by the user. In this case there is some disagreement about what should be allowed (some discussion on &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-3811&quot; title=&quot;non-root users cannot archive files, root cannot archive non-root users&amp;#39; files&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-3811&quot;&gt;&lt;del&gt;LU-3811&lt;/del&gt;&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Some questions: Which less-bad operations should be permitted by default? How should additional permissions be granted? (/proc tunable, setuid() binary, policy tool?) Should explicit restore be treated differently from implicit restore?&lt;/p&gt;

&lt;p&gt;I propose that by default all explicit HSM actions require root or CAP_SYS_ADMIN. The next level can be enabled via /proc and allows explicit archive, release, and restore to the file owner.&lt;/p&gt;</description>
                <environment></environment>
        <key id="20731">LU-3866</key>
            <summary>missing permission checks on HSM operations</summary>
                <type id="7" iconUrl="https://jira.whamcloud.com/images/icons/issuetypes/task_agile.png">Technical task</type>
                            <parent id="20020">LU-3647</parent>
                                    <priority id="1" iconUrl="https://jira.whamcloud.com/images/icons/priorities/blocker.svg">Blocker</priority>
                        <status id="5" iconUrl="https://jira.whamcloud.com/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="1">Fixed</resolution>
                                        <assignee username="jhammond">John Hammond</assignee>
                                    <reporter username="jhammond">John Hammond</reporter>
                        <labels>
                            <label>HSM</label>
                    </labels>
                <created>Fri, 30 Aug 2013 17:00:37 +0000</created>
                <updated>Tue, 8 Oct 2013 16:38:03 +0000</updated>
                            <resolved>Tue, 8 Oct 2013 16:38:03 +0000</resolved>
                                    <version>Lustre 2.5.0</version>
                                    <fixVersion>Lustre 2.5.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>12</watches>
                                                                            <comments>
                            <comment id="65460" author="pjones" created="Fri, 30 Aug 2013 17:42:16 +0000"  >&lt;p&gt;Bruno&lt;/p&gt;

&lt;p&gt;Could you please look into this one?&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;

&lt;p&gt;Peter&lt;/p&gt;</comment>
                            <comment id="65463" author="jhammond" created="Fri, 30 Aug 2013 17:48:36 +0000"  >&lt;p&gt;Also the CT ioctls LL_IOC_HSM_CT_START, LL_IOC_HSM_PROGRESS, LL_IOC_HSM_COPY_START, LL_IOC_HSM_COPY_END are completely unrestricted. A non-root user with access to a lustre mount point can register as a copytool. And the same user running on the same node as a CT, with access to any lustre mount point on that node can unregister the CT by crafting a KUC with the CT&apos;s PID and group KUC_GRP_HSM.&lt;/p&gt;</comment>
                            <comment id="65674" author="malkolm" created="Wed, 4 Sep 2013 01:19:04 +0000"  >&lt;p&gt;I would suggest a restrictive set of permissions for all operations except restore. I make an exception for restore, as anyone with read privileges on a file should reasonably expect to be able to access the file, even if it has been released. It&#8217;s implied in the nature of the restore operation (whether invoked explicitly or implicitly).&lt;/p&gt;

&lt;p&gt;Other commands could be left as super-user commands, with sudo or equivalent providing the necessary privilege escalation, at least as a stop-gap. If we documented this adequately, it would provide a reasonable implementation.&lt;/p&gt;

&lt;p&gt;I agree with  you that the copytools must only be managed by the super-user.&lt;/p&gt;

&lt;p&gt;I&#8217;ve included some other notes:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;b&gt;Archive Files&lt;/b&gt;&lt;/em&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Super-user can archive files&lt;/li&gt;
	&lt;li&gt;Owner can archive files&lt;/li&gt;
	&lt;li&gt;? Group members with write access can archive files?&lt;/li&gt;
	&lt;li&gt;Other users cannot archive files&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;&lt;em&gt;&lt;b&gt;Release files&lt;/b&gt;&lt;/em&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Super-user can release files&lt;/li&gt;
	&lt;li&gt;Other users, whether file owners, group members or other, cannot release files&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;&lt;em&gt;&lt;b&gt;Restore Files&lt;/b&gt;&lt;/em&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Any user with read permission can restore a file (implicit restore effectively mandates this behaviour)&lt;/li&gt;
	&lt;li&gt;Restore requests cannot change ownership, permissions or other metadata&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;&lt;em&gt;&lt;b&gt;Remove files&lt;/b&gt;&lt;/em&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Super-user can remove files from the archive&lt;/li&gt;
	&lt;li&gt;Owner can remove files from archive&lt;/li&gt;
	&lt;li&gt;? Group members with write access can remove files from archive?&lt;/li&gt;
	&lt;li&gt;Other users cannot remove files from archive&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;&lt;em&gt;&lt;b&gt;Cancel&lt;/b&gt;&lt;/em&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Super-user can cancel all requests&lt;/li&gt;
	&lt;li&gt;Requester can cancel their own requests&lt;/li&gt;
	&lt;li&gt;Users cannot cancel requests made by other users&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;&lt;em&gt;&lt;b&gt;Questions&lt;/b&gt;&lt;/em&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Apply ACLs to allow alternative uses? For example &quot;group_write_can_archive&quot; &#8211; group members can archive files when the group write bit is set. Could effectively allow privilege escalation based on ACLs for files. So, very restrictive by default, but users can modify permissions to allow further options&lt;/li&gt;
	&lt;li&gt;Create an MDT parameter to assign &quot;super-user&quot; privilege or otherwise delegate operations for HSM command set?
	&lt;ul&gt;
		&lt;li&gt;sudo could cover this, which means we could leave the commands as requiring super-user privileges, then demonstrate how one could use Sudo to delegate privileges to admin users&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;MDT could potentially provide finer-grained access control but would need to weigh cost/benefit against alternatives&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="65714" author="jcl" created="Wed, 4 Sep 2013 11:14:10 +0000"  >&lt;p&gt;I think we must have a simple tunnable (through CDT policy flags =&amp;gt; managed by CDT?) like control on/off. Many sites will not care of who is doing what.&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;&quot;Requester can cancel their own requests&quot;: today we do not memorize the request owner in llog. Do we replace this by file owner or who is able to read file ?&lt;/li&gt;
	&lt;li&gt;&quot;Users cannot cancel requests made by other users&quot;: even on their file ?&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="65742" author="bfaccini" created="Wed, 4 Sep 2013 15:51:59 +0000"  >&lt;p&gt;Malcolm, thanks for the list that we can use as a start point for the &quot;high-level&quot; control for this task. I already see that we need to also add notes about the eXecution right/bit, do we allow for explicit/implicit restore when execution bit is set ?&lt;/p&gt;

&lt;p&gt;John, J-C, what do you think if, we start with implementation of 3 modes, no-control/root-only/enhanced ?&lt;/p&gt;

&lt;p&gt;Also and as very 1st step, for root-only mode, what do you think would be the best/simplest way to implement it, in ll_xx_ioctl() with just a tunable/proc to set the mode ?&lt;/p&gt;</comment>
                            <comment id="65744" author="jhammond" created="Wed, 4 Sep 2013 16:12:32 +0000"  >&lt;p&gt;I started a patch on for this that would do the following.&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;Make LL_IOC_HSM_CT_START require CAP_SYS_ADMIN (the client side handler modifies the KUC table).&lt;/li&gt;
	&lt;li&gt;Add MUTABOR to the handler flags for all MDS_HSM opcodes except MDS_HSM_STATE_GET.&lt;/li&gt;
	&lt;li&gt;Require CAP_SYS_ADMIN for MDS_HSM_PROGRESS, MDS_HSM_CT_REGISTER, and MDS_HSM_CT_UNREGISTER.&lt;/li&gt;
	&lt;li&gt;Require CAP_SYS_ADMIN in mdt_hsm_state_set() for setting flags not in HSM_USER_MASK.&lt;/li&gt;
	&lt;li&gt;Add bit masks &lt;tt&gt;hsm_user_request_mask,hsm_group_request_mask,hsm_other_request_mask&lt;/tt&gt; to control who&lt;br/&gt;
can perform what HSM actions on file. For example, we check&lt;br/&gt;
&lt;tt&gt;hsm_user_request_mask &amp;amp; (1 &amp;lt;&amp;lt; HSMA_RELEASE)&lt;/tt&gt; to see if the file owner&lt;br/&gt;
&lt;tt&gt;(uc-&amp;gt;uc_fsuid == la-&amp;gt;la_uid)&lt;/tt&gt; can release the file.  By default, I set each mask to &lt;tt&gt;1 &amp;lt;&amp;lt; HSMA_RESTORE&lt;/tt&gt;. Having CAP_SYS_ADMIN will override&lt;br/&gt;
these masks of course.&lt;/li&gt;
	&lt;li&gt;Add &lt;tt&gt;/proc/fs/lustre/mdt/*/hsm/hsm_user,group,other_request_mask&lt;/tt&gt; to set and set these bits.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;This patch will not distinguish between implicit restore and explicit restore.&lt;/p&gt;

&lt;p&gt;Begin the flames.&lt;/p&gt;</comment>
                            <comment id="65800" author="leibovici-cea" created="Thu, 5 Sep 2013 06:59:34 +0000"  >&lt;p&gt;Thank you Malcolm for this work of listing all actions and the related permissions.&lt;/p&gt;

&lt;p&gt;However, some of these permissions doesn&apos;t look appropriate for a production system,&lt;br/&gt;
so I think they should be tunable:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;b&gt;Archive&lt;/b&gt;&lt;br/&gt;
    Owner can archive files&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;This should be a tunable, basically if we want to prevent users from archiving their files after each modification&lt;br/&gt;
and let the PolicyEngine schedule the copy to control/leverage the data flow to the archive.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;b&gt;Release&lt;/b&gt;&lt;br/&gt;
    Other users, whether file owners, group members or other, cannot release files&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;This should be a tunable, this can be a way for the user to give an hint to the system&lt;br/&gt;
that he doesn&apos;t plan to read the file in a near future, so we can free space in Lustre for other &apos;hot&apos; data.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;b&gt;Remove files&lt;/b&gt;&lt;br/&gt;
    Owner can remove files from archive&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;This sounds dangerous. I don&apos;t want users to be able to invalidate copies in the backend an uncontrolled way.&lt;/p&gt;

&lt;p&gt;Add the following case:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Only root can hsm_remove fids that no longer exist. The main use case is the garbage collection of orphan entries in the HSM (for removed entries in Lustre).&lt;br/&gt;
BTW, I think this case is not currently tested in sanity-hsm as lfs doesn&apos;t support it (this can only be done by directly calling the llapi).&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;Thomas&lt;/p&gt;</comment>
                            <comment id="65802" author="malkolm" created="Thu, 5 Sep 2013 07:12:18 +0000"  >&lt;p&gt;Hi Thomas,&lt;/p&gt;

&lt;p&gt;I agree with your comments: archive and release should be tuneable and remove should be a privileged operation (users can make mistakes after all). My original thought was just to make sure that these operations should be protected such that the owner of a file does not get any unwelcome surprises. I support your amendments.&lt;/p&gt;</comment>
                            <comment id="65863" author="jhammond" created="Thu, 5 Sep 2013 17:46:24 +0000"  >&lt;p&gt;Please see &lt;a href=&quot;http://review.whamcloud.com/7565&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/7565&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="65986" author="bfaccini" created="Fri, 6 Sep 2013 21:48:14 +0000"  >&lt;p&gt;All,&lt;br/&gt;
Can we get an agreement to limit the scope of this ticket to the critical/minimum permission checks that we want to be integrated in 2.5, and which I strongly feel are already in John&apos;s patch ??&lt;/p&gt;</comment>
                            <comment id="66037" author="adegremont" created="Mon, 9 Sep 2013 07:49:34 +0000"  >&lt;p&gt;I&apos;m OK with John&apos;s proposal. I think Gerrit #7565 will be fine for a first round.&lt;/p&gt;</comment>
                            <comment id="68598" author="pjones" created="Tue, 8 Oct 2013 16:38:03 +0000"  >&lt;p&gt;Landed for 2.5&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="20544">LU-3811</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <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|hzvzqn:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>10032</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                </customfields>
    </item>
</channel>
</rss>