<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 03:21:17 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-15787] clients built without encryption support can corrupt encrypted directories</title>
                <link>https://jira.whamcloud.com/browse/LU-15787</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;Clients build without encryption support can create files in encrypted directories. The names of the created files may collide with the names of existing decrypted files.&lt;/p&gt;

&lt;p&gt;One way to see this is to build a CentOS 7 (3.10.0) based client and then to mount an encryption enabled FS.&lt;/p&gt;

&lt;p&gt;On the old client:&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;# grep ENCRYPT ex/lustre-release/config.h
/* #undef CONFIG_LDISKFS_FS_ENCRYPTION */
/* #undef CONFIG_LL_ENCRYPTION */
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&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;new-server# fscrypt setup /mnt/lustre
Metadata directories created at &quot;/mnt/lustre/.fscrypt&quot;.
new-server# mkdir /mnt/lustre/private
new-server# fscrypt encrypt --user=root /mnt/lustre/private
...
&quot;/mnt/lustre/private&quot; is now encrypted, unlocked, and ready for use.
new-server# echo XXX &amp;gt; /mnt/lustre/private/f0
new-server# ls /mnt/lustre/private/
f0

old-client# mount new-server@tcp:/lustre /mnt/lustre -t lustre
old-client# mount -t lustre
192.168.122.63@tcp:/lustre on /mnt/lustre type lustre (rw,flock,lazystatfs,noencrypt)
old-client# ls /mnt/lustre/private/
j?&quot;n5?&amp;lt;=??7?Jj?&quot;=@????x??]|??lqdX?
old-client# echo YYY &amp;gt; /mnt/lustre/private/f0
old-client# ls /mnt/lustre/private/
f0  j?&quot;n5?&amp;lt;=??7?Jj?&quot;=@????x??]|??lqdX?

new-server# ls /mnt/lustre/private/
ls: reading directory &apos;/mnt/lustre/private/&apos;: Structure needs cleaning
f0
new-server# rm -rf /mnt/lustre/private
rm: traversal failed: /mnt/lustre/private: Structure needs cleaning
new-server# ls /mnt/lustre/private
ls: reading directory &apos;/mnt/lustre/private&apos;: Structure needs cleaning
new-server# rmdir /mnt/lustre/private
rmdir: failed to remove &apos;/mnt/lustre/private&apos;: Directory not empty
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Another thing I notice here is that when the old client tries to read the encrypted file, read()  just returns 0.&lt;/p&gt;

&lt;p&gt;This seems like a serious issue to me. If a site is running a mix of old and new client kernels then it seems relatively easy to wander into this situation unawares.&lt;/p&gt;

&lt;p&gt;As discussed on chat, the MDT should protect against this situation. If the directory is encrypted (has LUSTRE_ENCRYPT_FL set) and the client does not have the encryption connect flag (OBD_CONNECT2_ENCRYPT) then the MDT could disallow creates in the directory. But this needs investigation.&lt;/p&gt;</description>
                <environment></environment>
        <key id="70019">LU-15787</key>
            <summary>clients built without encryption support can corrupt encrypted directories</summary>
                <type id="1" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11303&amp;avatarType=issuetype">Bug</type>
                                            <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="sebastien">Sebastien Buisson</assignee>
                                    <reporter username="jhammond">John Hammond</reporter>
                        <labels>
                    </labels>
                <created>Tue, 26 Apr 2022 16:49:59 +0000</created>
                <updated>Fri, 10 Jun 2022 18:01:54 +0000</updated>
                            <resolved>Thu, 5 May 2022 19:45:33 +0000</resolved>
                                                    <fixVersion>Lustre 2.15.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>9</watches>
                                                                            <comments>
                            <comment id="333155" author="adilger" created="Wed, 27 Apr 2022 15:01:34 +0000"  >&lt;p&gt;Sebastien, beyond blocking old clients from opening encrypted files (with &lt;tt&gt;-ENOKEY&lt;/tt&gt;), it looks like the MDS also needs to base64 encode the encrypted filenames before returning them to the client on readdir(). &lt;/p&gt;

&lt;p&gt;As a quick fix it could return &lt;tt&gt;-ENOKEY&lt;/tt&gt; for readdir as well. That isn&apos;t great because then old clients cannot access these directories at all, but relatively easy to implement and new clients can still access the directory tree.  It wouldn&apos;t preclude implementing the return of base64-encoded names to the client. &lt;/p&gt;</comment>
                            <comment id="333157" author="sebastien" created="Wed, 27 Apr 2022 15:20:45 +0000"  >&lt;p&gt;Hmm, you want the MDS to base64 encode the encrypted filenames before returning them to the client, in all cases, or just to encryption unaware clients?&lt;/p&gt;

&lt;p&gt;For encryption aware clients, this is not necessary, the client code properly handles this.&lt;br/&gt;
For encryption unaware clients, I am not sure it is a good idea. Keeping non printable characters at least has the advantage to show that these files should not be manipulated.&lt;br/&gt;
And in all cases, the MDS already escapes a few critical characters (NULL, LF, CR, /, DEL and =) in encrypted file names before sending them to clients, by calling critical_encode(). So the encrypted names received by an encryption unaware client are not that badly formed to break &lt;tt&gt;ls&lt;/tt&gt; for instance.&lt;/p&gt;</comment>
                            <comment id="333162" author="gerrit" created="Wed, 27 Apr 2022 15:50:06 +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/47156&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/47156&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-15787&quot; title=&quot;clients built without encryption support can corrupt encrypted directories&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-15787&quot;&gt;&lt;del&gt;LU-15787&lt;/del&gt;&lt;/a&gt; sec: block enc unaware clients on enc files&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 2c5d4a99365cea42e6f98be7cafc089fd95283c6&lt;/p&gt;</comment>
                            <comment id="333182" author="adilger" created="Wed, 27 Apr 2022 17:40:14 +0000"  >&lt;blockquote&gt;
&lt;p&gt;Hmm, you want the MDS to base64 encode the encrypted filenames before returning them to the client, in all cases, or just to encryption unaware clients?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Ideally the &lt;b&gt;same&lt;/b&gt; no-key filenames would be visible userspace for clients w/o encryption support, clients w/o the key, as well as fid2path. That allows userspace to work consistently with these filenames. &lt;/p&gt;</comment>
                            <comment id="333188" author="sebastien" created="Wed, 27 Apr 2022 18:21:10 +0000"  >&lt;p&gt;That would require to implement on server side, for the specific encryption unaware client case, a filename processing similar to what is done in &lt;tt&gt;ll_setup_filename()&lt;/tt&gt; and &lt;tt&gt;ll_fname_disk_to_usr&lt;/tt&gt; on client side, in order to handle the digested form. This digested form is imposed by the NAME_MAX limitation (i.e. base64 encoding NAME_MAX long encrypted file names would produce too long names).&lt;/p&gt;</comment>
                            <comment id="333351" author="JIRAUSER17312" created="Thu, 28 Apr 2022 19:46:36 +0000"  >&lt;p&gt;Hm.. why though? If the filenames are encrypted, and the client lacks both key and encryption support, what&apos;s the problem? &lt;/p&gt;

&lt;p&gt;The original issue seems to be addressed by &lt;a href=&quot;https://jira.whamcloud.com/secure/ViewProfile.jspa?name=sebastien&quot; class=&quot;user-hover&quot; rel=&quot;sebastien&quot;&gt;sebastien&lt;/a&gt;&apos;s patch, wouldn&apos;t extending this further be feature enhancements so that older non-supported clients have a &quot;more correct&quot; view of a bunch of files that they can&apos;t access anyways?&lt;/p&gt;</comment>
                            <comment id="333371" author="adilger" created="Thu, 28 Apr 2022 22:20:57 +0000"  >&lt;p&gt;Colin, definitely without Sebastien&apos;s 47156 patch there is a real risk of a user/application without a key or fscrypt inadvertently or maliciously corrupting an encrypted directory.  That is a DOS on the legitimate user of the file.  Even worse, the corruption is in a way that even the user with the key can&apos;t fix the problem anymore == service call where we need to do low-level debugfs hacking to delete the bad files.&lt;/p&gt;

&lt;p&gt;As for why we would want to add MDS support for base64 encoding filenames for no-key/no-fscrypt clients, that is mainly for manageability and consistency.  It is bad to return &quot;nasty&quot; filenames to old clients that they can&apos;t do anything with (or may choke on), acceptable would be to block them outright from accessing these files/directories on the assumption that they must have &lt;b&gt;some&lt;/b&gt; newer client with fscrypt support that could at least access the directory and delete the files, even if they don&apos;t have the key.&lt;/p&gt;

&lt;p&gt;Preferably, the no-key filenames should be consistent for all clients (no-key or without fscrypt support) so that tools that monitor space usage, migrate, etc. can still handle them.  I&apos;m sure users would love a mechanism to lock out admins from their directory trees to prevent purge from cleaning up their old files.  This needs to work for basic directory operations (e.g. &quot;&lt;tt&gt;ls -l&lt;/tt&gt;&quot;, &quot;&lt;tt&gt;rm -r&lt;/tt&gt;&quot;, etc.) and potentially also Lustre-specific interfaces like &quot;&lt;tt&gt;lfs fid2path&lt;/tt&gt;&quot;, &quot;&lt;tt&gt;lfs path2fid&lt;/tt&gt;&quot;.  This will need some support on the MDS side to encode the filenames in a consistent way with no-key fscrypt-capable clients.&lt;/p&gt;

&lt;p&gt;Separately, it is currently &lt;b&gt;not&lt;/b&gt; possible to do backup/restore for fscrypt files (neither at the Lustre level nor the MDT with &lt;tt&gt;tar&lt;/tt&gt;, but &lt;tt&gt;dd&lt;/tt&gt; or &lt;tt&gt;e2image&lt;/tt&gt; would still work).  This is a limitation present in the upstream fscrypt implementation that we&apos;ve partly worked around for Lustre to allow mirror/migrate for OST management, but it is something that needs to be addressed in the future in order for admins to manage filesystems that have fscrypted directory trees in them.&lt;/p&gt;</comment>
                            <comment id="333533" author="gerrit" created="Mon, 2 May 2022 13:42:06 +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/47182&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/47182&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-15787&quot; title=&quot;clients built without encryption support can corrupt encrypted directories&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-15787&quot;&gt;&lt;del&gt;LU-15787&lt;/del&gt;&lt;/a&gt; sec: document enc-unaware clients on enc files&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: cabd3955c47543d2193f237918a8204d5532d1f6&lt;/p&gt;</comment>
                            <comment id="333937" author="gerrit" created="Thu, 5 May 2022 18:47:28 +0000"  >&lt;p&gt;&quot;Oleg Drokin &amp;lt;green@whamcloud.com&amp;gt;&quot; merged in patch &lt;a href=&quot;https://review.whamcloud.com/47156/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/47156/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-15787&quot; title=&quot;clients built without encryption support can corrupt encrypted directories&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-15787&quot;&gt;&lt;del&gt;LU-15787&lt;/del&gt;&lt;/a&gt; sec: block enc unaware clients on enc files&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: a31db2ec062ccc995527d37f0330edbca9d486a9&lt;/p&gt;</comment>
                            <comment id="333955" author="gerrit" created="Thu, 5 May 2022 19:27:49 +0000"  >&lt;p&gt;&quot;Oleg Drokin &amp;lt;green@whamcloud.com&amp;gt;&quot; merged in patch &lt;a href=&quot;https://review.whamcloud.com/47182/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/47182/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-15787&quot; title=&quot;clients built without encryption support can corrupt encrypted directories&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-15787&quot;&gt;&lt;del&gt;LU-15787&lt;/del&gt;&lt;/a&gt; sec: document enc-unaware clients on enc files&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 751a8114ef3afe9abe7692b3974b070db6a705a2&lt;/p&gt;</comment>
                            <comment id="333957" author="pjones" created="Thu, 5 May 2022 19:45:33 +0000"  >&lt;p&gt;Landed for 2.15&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                                        </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="69824">LU-15767</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="59726">LU-13717</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|i02o7z:</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>