[LU-5560] SELinux support on the client side Created: 29/Aug/14 Updated: 08/Dec/16 Resolved: 27/Jul/16 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Lustre 2.8.0, Lustre 2.9.0 |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Sebastien Buisson (Inactive) | Assignee: | Oleg Drokin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | patch | ||
| Attachments: |
|
||||||||||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||||||||||
| Rank (Obsolete): | 15510 | ||||||||||||||||||||||||||||||||
| Description |
|
The aim is to be able to enforce SELinux security policies on Lustre from SELinux-enabled clients. It requires to properly initiate file security context on client side, and store it on server side via extended attribute. |
| Comments |
| Comment by Sebastien Buisson (Inactive) [ 29/Aug/14 ] |
|
As a first implementation, I added a call to a new function ll_init_security() after the calls to d_instantiate() in ll_create_it() and ll_new_node(). This new function retrieves security context via security_inode_init_security(), and stores it in extended attribute in MDT with ll_setxattr(). To ensure security context coherency between clients, this basic implementation does not cache inodes at all. This is why I created a new function ll_drop_inode(), and also modified ll_ddelete() to always return 1 when SELinux is enabled. Of course this first, basic implementation severely hurts metadata performance because of the inode cache drop. I uploaded the patch here: |
| Comment by Sebastien Buisson (Inactive) [ 29/Aug/14 ] |
|
Ideally, to ensure security context coherency between clients, a new lock (let's call it MDS_INODELOCK_SECURITY) should be used to synchronize updates:
My problem is the Lustre code is too complicated, I am not able to do what I described here. Could you help with the part taking the new MDS_INODELOCK_SECURITY lock at setxattr time? |
| Comment by Bruno Faccini (Inactive) [ 01/Sep/14 ] |
|
Hello Seb, this looks like a non-trivial task! |
| Comment by Sebastien Buisson (Inactive) [ 02/Sep/14 ] |
|
Hi Bruno, What do you think of the suggestion from Andrew Perepechko in http://review.whamcloud.com/11648 to modify MDS behavior so that we cancel lookup lock in case of change on 'security.selinux" xattr? Can we exchange by IRC on #lustre for instance (sorry, no Skype available for me). Cheers, |
| Comment by Peter Jones [ 02/Sep/14 ] |
|
Oleg is looking into this |
| Comment by Andreas Dilger [ 02/Sep/14 ] |
|
Sebastien, do we need a separate lock bit for SELinux? We already have client-side xattr cache introduced in 2.5 that should result in the client-side xattr cache being cleaned if the selinux xattr is changed. |
| Comment by Sebastien Buisson (Inactive) [ 03/Sep/14 ] |
|
The xattr cache is only filled in case of getxattr, not setxattr. So the MDS_INODELOCK_XATTR lock is not hold by a client creating a file with SELinux attributes. Then if another client modifies the SELinux attributes, it will not lead to any action on the client that initially created the file. Moreover, security context is stored in (struct inode*)->i_security besides its representation as an xattr in the Lustre/ldiskfs case. So in case of SELinux attributes modification by another client, the action required on the client that initially created the file would be to call delete_inode(), in order to force a new lookup of the inode. This could be overkill, maybe there is another mechanism already available in Lustre to force lookup without having to delete the inode. |
| Comment by Sebastien Buisson (Inactive) [ 03/Oct/14 ] |
|
Hi, In order to make things easier, and because the coherency need comes from a very special use case, I have decided to tackle it separately. Sebastien. |
| Comment by Wang Shilong (Inactive) [ 18/Nov/14 ] |
|
Hello Sebastien Buisson, Could you please tell me how do you mount lustre client under enforcing mode with this patch? Best Regards, |
| Comment by Sebastien Buisson (Inactive) [ 18/Nov/14 ] |
|
Hi, There is no mount option required. As soon as SELinux is enforced on the client node, it will be taken into account at the Lustre level. Cheers, |
| Comment by Gerrit Updater [ 29/Jun/15 ] |
|
Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/11648/ |
| Comment by Sebastien Buisson (Inactive) [ 24/Jul/15 ] |
|
Hi, Please find attached the proposed Test Plan for SELinux support on the client side. Sebastien. |
| Comment by Gerrit Updater [ 31/Jul/15 ] |
|
Sebastien Buisson (sebastien.buisson@bull.net) uploaded a new patch: http://review.whamcloud.com/15818 |
| Comment by Sebastien Buisson (Inactive) [ 31/Jul/15 ] |
|
Hi, Here is an updated Test Plan for SELinux support on the client side, including functional tests. Sebastien. |
| Comment by Sebastien Buisson (Inactive) [ 07/Aug/15 ] |
|
Hi, Here is an updated Test Plan for SELinux support on the client side, including remarks from Andrew Perepechko. Sebastien. |
| Comment by Sarah Liu [ 05/Oct/15 ] |
|
Hello, For the upgrade/downgrade testing of this feature, how would you like the test be implemented? Is there any specific requirement? Thanks, |
| Comment by Joseph Gmitter (Inactive) [ 16/Mar/16 ] |
|
This work has landed for the 2.8.0 release in patch http://review.whamcloud.com/#/c/11648/ |
| Comment by James Nunez (Inactive) [ 24/Mar/16 ] |
|
Reopening ticket because the patch containing the SELinux test suite never landed; http://review.whamcloud.com/#/c/15818. |
| Comment by Gerrit Updater [ 14/Jun/16 ] |
|
Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/19970/ |
| Comment by Gerrit Updater [ 14/Jul/16 ] |
|
Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/15818/ |
| Comment by Peter Jones [ 27/Jul/16 ] |
|
Reclosing as the test script landed. Sebastien, you should open a new ticket to track the atomic context transfer during create patch also still in flight - http://review.whamcloud.com/#/c/19971/ |
| Comment by Gerrit Updater [ 11/Aug/16 ] |
|
Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/19971/ |