-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NFS/POSIX ACL support #170
Comments
Things are unfortunately a little trickier than it first appears. Internally ZFS fully supports and enforces NFS style ACLs. Unfortunately, under Linux the existing tools only manipulate Posix style ACLs. There has been some work done to the bring NFS ACL model to Linux under the name Rich-ACLs. To integrate with the new Rich-ACL tool chain ZFS needs to provide a virtual system.richacl xattr interface. This xattr would not be stored like other xattrs but would instead integrate with the zfs_getacl() and zfs_setacl(). This xattr hook would be responsible for translating a vsecattr_t to and from a lineal stream of bytes for the xattr. Posix ACLs can be easily supported by adding a few hooks and leveraging the existing Posix ACL support functions. However, it may be best that they not be implemented to avoid coherency issues between Posix and Rich ACLs (NFS/ZFS). |
Thank You for description. I think POSIX ACL can be helpful too if there is some applications that have POSIX ACLs support. As I remember samba have something like that. rsync have ACL support, but I'm not sure that it only POSIX, because man says just "ACL". Do not know about other applications. |
Summary of Required WorkInternally ZFS fully supports and enforces NFS style ACLs. Unfortunately, under Linux the existing tools only manipulate Posix style ACLs. There has been some work done to the bring NFS ACL model to Linux under the name Rich-ACLs (pdf). To integrate with the new Rich-ACL tool chain ZFS needs to provide a virtual system.richacl xattr interface. This xattr would not be stored like other xattrs but would instead integrate with the zfs_getacl() and zfs_setacl(). This xattr hook would be responsible for translating a vsecattr_t to and from a lineal stream of bytes for the xattr. Posix ACLs can be easily supported by adding a few hooks and leveraging the existing Posix ACL support functions. However, it may be best that they not be implemented to avoid coherency issues between Posix and Rich ACLs (NFS/ZFS). |
What about a mount option / file-system property about WHICH security model has to be enforced? (and maybe the other one completely hidden even from management tools, like setfacl/getfacl). |
I, too, would like to see POSIX ACL support integrated into ZFS on Linux. Linux is POSIX, and until RichACLs are more mainstream (or at least in the kernel), I think POSIX integration in ZFS on Linux makes sense. |
I would love to see this included! Was very nearly a showstopper for us, but decided to live without for a few months. |
When ACLs are cleanly handled we should ensure the following patch to resurrent the aclmode property is merged. This change has already been made to the Illumos and FreeBSD implementations. Issue #742: Resurrect the ZFS "aclmode" property |
It is possible to map Posix < - > NFSv4 ACLs. I think that the mapping approach is theoretically the best one, but it is more error-prone than others as 1:1 mapping is not possible. I think that a first step this implementation should able to:
In successive steps, the mapping logic NFSv4 => Posix can be tuned and made much more customizable. Any better ideas? |
This seems like a reasonable starting place to me, just a few comments. While a perfect 1:1 mapping isn't possible things are not actually so bad. As you point out there is a well specified IETF Posix -> NFSv4 mapping which can be used to set the correct ACLs on-disk. Once set on-disk as a SA the existing zfs implementation should start enforcing them independent of generic Linux ACL hooks in the VFS. You'll then of course need to implement some reasonable NFSv4 -> Posix mapping to read the ACLs. However, reasonable implementations of this already do exist. Case in point the Linux nfs kernel server which is forced to store all of its NFSv4 ACLs as Posix ACLs which is a lossy operation. As an aside, in the longer term exposing the raw nfsv4/zfs ACL would be a good thing for the nfs kernel server. You could potentially avoid a pointless NFSv4 -> Posix -> NFSv4 conversion. Finally, we'd want to have a test suite to verify we got this right. This is a security feature after all. Happily it's my understanding that several good test suites already exist. |
There is a work going on the richacls by Aneesh kumar, Andreas Gruenbacher on the previous work done by Greg Banks. Patches were submitted for 3.1 mainline merged., but due to some changes it will take time & will be merge in the next release. Once this gets to mainline, we can make use of them to support nfsv4acls for ZFS. |
And what about POSIX ACLs? Brian said that it is not so hard to implement them usinx xattr. Can this be done too by someone, please. :) |
ZFS supports nfsv4acls, so IMHO we should give support for nfsv4acls first & see whether posix acls are really needed. If yes then we can figure out the way to define a mapping between them. |
I don't see any reason why both can't be done. Maxximino is currently working on supporting the system.posixacl xattr interface via a well documented translation. Adding the system.richacl xattr interface can be supported when its integrated and a real tool chain is available. |
"currently working" as academic- and work-related tasks allow me, but in high priority for "free" time. |
I know solaris just provides two copies of chmod to manage ACLs. Unfortunately, this is very awkward and clunky. I propose that we use a helper program, setzacl, getzacl or similar to provide ACL viewing and modification facilities on zfs on linux. Preferably, the interface should be created to be similar to (or compatible with) solaris chmod, possibly improved, but standardized across both zfs linux implementations, and preferably able to handle future filesystems with "nfs4" acls. (If anyone can explain why they're called nfs4 ACLs, that'd be a big help, too!) |
I would add that Samba users might like to stick with nfs4 ACLs, not least as they come closest to matching Windows NTFS ACLs feature by feature. This matters when you want to use Samba as a server for users home and profile folders in an Active Directory environment where newer versions of Windows check for specific ACLs. Also, Windows interop was one of the design goals for ZFS back in the days of Sun, so it'd be sad to see it go... That said, I fully understand the drive for POSIX compliance. aarcane - See http://wiki.linux-nfs.org/wiki/index.php/ACLs for the history of NFSv4 ACLs. |
I'm experimenting with a Samba 4 DC and ZFS CIFS share at the moment; the base system is ubuntu 12.04. XP Pro SP3 clients can see and administer Active Directory (users and computers) and set NTFS permissions properly on folders shared from EXT4. Folders shared from ZFS become unbrowsable thru CIFS as soon as you alter their permissions via the XP gui (although you can still access them - as expected - from the server's command line). I assume that's a result of the problems outlined in the thread above? Any work-around ideas would be gratefully received. Enabling full NTFS ACL admin through Samba 4 would be a massive bonus for ZFS. |
Can you please post more details about your issue? Exact Samba4 version, which fileserver are you using (smbd or ntvfs) and any relevant settings? (e.g. are you using vfs_acl_xattr or something similar?) About manipulation of real NFSv4 (NTFS-like) ACLs through Samba, this can be done in a clean way only after "Rich ACL" patches are merged in the kernel. |
Thanks Maxximino. "About manipulation of real NFSv4 (NTFS-like) ACLs through Samba, this can be done in a clean way only after "Rich ACL" patches are merged in the kernel." As far as I understand matters, the official richacls patches only support EXT4 - are you saying that if I e.g. use opensuse (with richacls included by default) or patch richacls into ubuntu / debian, zfs+samba4+ntfs acls should "just start working"? |
I've reproduced your issue. No, simply patching a kernel with rich acl patches is not enough. When those patches land on mainline, it's possible to start to integrate rich acl support in zfs. |
I'm just building Samba 4 on Suse; I think I was about to reproduce your reproduction from a different angle. Perhaps a reasonable (short term) workaround would be to serve files from zfs through a stable Samba 3 environment, authenticating against a Samba 4 DC in a different Linux-VServer for instance? In the medium term, the utility of having ZFS-based CIFS shares combined with Samba 4 AD all based on a Linux OS with excellent generic hardware support in the same machine can't be overstressed. The small business / not-for-profit applications are huge. Thanks for all the work so far. |
I stumbled upon the following thread: The summary is that Samba 4 has an acl module called vfs_zfsacl, which is used on Solaris, so that Samba can use the native ZFS acls. Would it be possible to use this module with zfsonlinux? Are the necessary APIs made available to user space on Linux? |
@kisg That's a good question, this is the first I've heard of the vfs_zfsacl module for Samba. Somebodies going to need to do some legwork to determine what interface they are expecting. Depending on what it is we might able able to provide it. Although if no translation is done you'll still have the issue of not being able to manage the ACLs on the Linux box. |
I took a quick look into the source. It simply converts from the internal Samba representation to the native SunOS NFSv4 acl/facl API. This API is implemented also on FreeBSD using a thin user-space wrapper around its own NFSv4 acl implementation. Based on this analysis, we can't reuse this implementation on Linux. Instead, if the richacl integration of zfsonlinux is done, we could use the librichacl library to create a similarly simple (hopefully less than 1000 lines) vfs_richacl module for Samba. From my cursory look at the richacl kernel patches, it seems that the zfsonlinux integration could even be done without actually patching the kernel, just pulling the required portions (data structures and xattr conversion) of the richacl code into the zfs tree for kernel versions which don't support it natively. This is important for us, because we (my company) would like to run a standard Ubuntu LTS kernel and only pull in zfsonlinux as an extra module. However, I am not sure if richacl is still maintained (its repository is not really kept up to date), and on track for inclusion into the vanilla kernel. |
I reached out to the author of the richacl patchset. He pointed me to the following experimental richacl vfs module: v4acls-experimental/samba.git So it looks like that almost all pieces are in place (or at least exist in experimental form) except for the richacl support in zfs itself. |
Maybe porting libsunacl.c to linux could be sufficient from samba side ? http://sourceforge.net/projects/libsunacl/ but as far as i understand "aclmode" will be still missing on zfsonlinux. |
I don't even know why we don't have some form of acl support yet. Why have
|
zfs acl is supported move that file on a zfsonlinux volume with aclinherit=passthrough Wath atm doesn't have a solution is have it done in samba.. none of the acl_xattr or acl_tdb works correctly under such configuration, on bsd they use the vfs_zfsacl trough libsunacl wich look's like a translator from zfs2bsd |
My question maybe dumb, but i want to have clear understanding whether we have acl support or not. I`ve created VBox ubuntu minimal server 12.04 LTS, than installed ubuntu-zfs, created pool w commands History for 'mypool': History for 'tank': tank does support setfacl without problem i want to use zfs with samba and i need to control multiple user access to folders. like that |
I want to implement richacls patch for ZFS, but as I am totally inexperienced with ZFS, it will be nice if one of ZFSonLinux developers can provide some help (mostly some in form of hints and discussions). |
Hello, we use zfsonlinux in a backup appliance and we think that ACLs are important for integration purposes. Some common operations, like changing permissions in a ZFS shared volume from a windows computer are needed. Is ACL still in the roadmap? Thanks. |
@n1mh It is scheduled for version 0.8.0. |
Initial Posix ACL support. This patch build cleanly under Centos 6 which is based on a 2.6.32 kernel. Once the autoconf tests listed below are implemented it should work on more modern kernels. TODO: * Add autoconf HAVE_GET_ACL check * Add autoconf HAVE_POSIX_ACL_RELEASE check * Add autoconf HAVE_INODE_OWNER_OR_CAPABLE check * Update zfs(8) man page to include acltype section * Update zfs(8) man page to indicate aclinherit does nothing * Test, test, test... Test Summary Report ------------------- pjd-fstest-20090130-RC/tests/xacl/00.t (Wstat: 0 Tests: 45 Failed: 1) Failed test: 45 pjd-fstest-20090130-RC/tests/xacl/02.t (Wstat: 0 Tests: 80 Failed: 16) Failed tests: 11, 14, 18, 22, 26, 30, 34, 38, 46, 49 53, 57, 61, 65, 69, 73 pjd-fstest-20090130-RC/tests/xacl/03.t (Wstat: 0 Tests: 57 Failed: 2) Failed tests: 27, 55 Files=7, Tests=330, 4 wallclock secs Result: FAIL The xacl/00.t test 45 failure is also observed on ext[234] so this is most likely a flaw in the test case. However, all the other test failures need to be investigated and resolved. The above results are from CentOS 6. Signed-off-by: Brian Behlendorf <[email protected]> Issue openzfs#170
This change adds support for Posix ACLs by storing them as an xattr which is common practice for many Linux file systems. Since the Posix ACL is stored as an xattr it will not overwrite any existing ZFS/NFSv4 ACLs which may have been set. The Posix ACL will also be non-functional on other platforms although it may be visible as an xattr if that platform understands SA based xattrs. By default Posix ACLs are disabled but they may be enabled with the new 'aclmode=noacl|posixacl' property. Set the property to 'posixacl' to enable them. If ZFS/NFSv4 ACL support is ever added an appropriate acltype will be added. This change passes the POSIX Test Suite cleanly with the exception of xacl/00.t test 45 which is incorrect for Linux (Ext4 fails too). http://www.tuxera.com/community/posix-test-suite/ Signed-off-by: Massimo Maggi <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue openzfs#170
Thanks to @maxximino support for Posix ACLs has been implemented. I've opened pull request #1809 with a close-to-final-version of the patch which is ready for broader testing. It cleanly passes the ACL section of the Posix Test Suite and we're unaware of any outstanding issues. For those who would like this functionality it would be very helpful if you could test the proposed patch with a realistic workload. Please verify it behaves as you would expect it to in your environment. Posix ACLs are disabled by default but may be enabled by setting the acltype property on the dataset.
|
This change adds support for Posix ACLs by storing them as an xattr which is common practice for many Linux file systems. Since the Posix ACL is stored as an xattr it will not overwrite any existing ZFS/NFSv4 ACLs which may have been set. The Posix ACL will also be non-functional on other platforms although it may be visible as an xattr if that platform understands SA based xattrs. By default Posix ACLs are disabled but they may be enabled with the new 'aclmode=noacl|posixacl' property. Set the property to 'posixacl' to enable them. If ZFS/NFSv4 ACL support is ever added an appropriate acltype will be added. This change passes the POSIX Test Suite cleanly with the exception of xacl/00.t test 45 which is incorrect for Linux (Ext4 fails too). http://www.tuxera.com/community/posix-test-suite/ Signed-off-by: Massimo Maggi <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue openzfs#170
Attempting to remove an xattr from a file which does not contain any directory based xattrs would result in the xattr directory being created. This behavior is non-optimal because it results in write operations to the pool in addition to the expected error being returned. To prevent this the CREATE_XATTR_DIR flag is only passed in zpl_xattr_set_dir() when setting a non-NULL xattr value. In addition, zpl_xattr_set() is updated similarly such that it will return immediately if passed an xattr name which doesn't exist and a NULL value. Signed-off-by: Massimo Maggi <[email protected]> Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue openzfs#170
Extend the xattr property section of zfs(8) such that it covers both styles of supported xattr. A short discussion of the benefits and drawbacks of each type is presented to allow users to make an informed choice. Signed-off-by: Massimo Maggi <[email protected]> Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue openzfs#170
This change adds support for Posix ACLs by storing them as an xattr which is common practice for many Linux file systems. Since the Posix ACL is stored as an xattr it will not overwrite any existing ZFS/NFSv4 ACLs which may have been set. The Posix ACL will also be non-functional on other platforms although it may be visible as an xattr if that platform understands SA based xattrs. By default Posix ACLs are disabled but they may be enabled with the new 'aclmode=noacl|posixacl' property. Set the property to 'posixacl' to enable them. If ZFS/NFSv4 ACL support is ever added an appropriate acltype will be added. This change passes the POSIX Test Suite cleanly with the exception of xacl/00.t test 45 which is incorrect for Linux (Ext4 fails too). http://www.tuxera.com/community/posix-test-suite/ Signed-off-by: Massimo Maggi <[email protected]> Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes openzfs#170
Linux style Posix ACLs have been implemented as an xattr and merged in to master. They are stored independently of the native NFS ACLs and will not conflict. The new dataset property acltype has been added to enable this functionality. For the best performance you are strongly encouraged to set both acltype=posixacl and xattr=sa. For further details see the updated man page:
|
Should an item acltype=nfs4 also be recognized and treated the same as
|
Attempting to remove an xattr from a file which does not contain any directory based xattrs would result in the xattr directory being created. This behavior is non-optimal because it results in write operations to the pool in addition to the expected error being returned. To prevent this the CREATE_XATTR_DIR flag is only passed in zpl_xattr_set_dir() when setting a non-NULL xattr value. In addition, zpl_xattr_set() is updated similarly such that it will return immediately if passed an xattr name which doesn't exist and a NULL value. Signed-off-by: Massimo Maggi <[email protected]> Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue openzfs#170
Extend the xattr property section of zfs(8) such that it covers both styles of supported xattr. A short discussion of the benefits and drawbacks of each type is presented to allow users to make an informed choice. Signed-off-by: Massimo Maggi <[email protected]> Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue openzfs#170
This change adds support for Posix ACLs by storing them as an xattr which is common practice for many Linux file systems. Since the Posix ACL is stored as an xattr it will not overwrite any existing ZFS/NFSv4 ACLs which may have been set. The Posix ACL will also be non-functional on other platforms although it may be visible as an xattr if that platform understands SA based xattrs. By default Posix ACLs are disabled but they may be enabled with the new 'aclmode=noacl|posixacl' property. Set the property to 'posixacl' to enable them. If ZFS/NFSv4 ACL support is ever added an appropriate acltype will be added. This change passes the POSIX Test Suite cleanly with the exception of xacl/00.t test 45 which is incorrect for Linux (Ext4 fails too). http://www.tuxera.com/community/posix-test-suite/ Signed-off-by: Massimo Maggi <[email protected]> Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes openzfs#170
Why is this closed? acltype nfs4 is far more important than the nonstandard completely obsolete limited POSIX draft ACLs. NFS ACLs are the default for ZFS on other platforms and are far more flexible. They also allow seamless exporting on both NFSv4 and SMB as the ACL actually maps well to both NFS and NT ACLs. POSIX draft ACLs do neither well. POSIX draft ACLs also don't deal well with inheritence, only giving a default for new files.. NFSv4 ACLs are the only way forward. |
@synnack the major problem with supporting NFS ACLs isn't really on the ZFS side. We've preserved all that functionality and it is used internally. The issue lies with the Linux utilities (getfattr, setfattr, etc) which are built around POSIX rather than NFS ACLs. There have been attempts in the past to bring NFS ACLs to Linux but to my knowledge none of have been widely successful. Unless things have changed recently that's the biggest obstacle. |
Sure, but look at Andreas Gruenbacher and Aneesh Kumar's work at OpenSuSE, they already ship richacl patches.. On the LKML for inclusion now.. |
Except richacls are not NFSv4 ACLs, they are (bit insane) result of merging NFSv4 schema with POSIX ACLs, designed for ext4 and retaining all the worst parts of POSIX ACLs, IIRC. What we need is a proper interface for NFSv4 ACLs, so that filesystems that support them can have them set. Mind you, there's at least one more type of ACLs supported (partially at least) by linux - AFS ACLs. So the possibility of having multiple schemes supported is not insane, though I guess we might need a Solaris-like API to support it best... Of course, if richacls can be wrangled to stop all the parts that go outside NFSv4, and assuming userland doesn't screw you over (hello there, POSIX ACL mask bits!), and assuming that they actually implement all of NFSv4 spec... That's a lot of assumptions, to be honest. I would actually propose adding an IOCTL applicable to files on ZFS at this rate |
Yeah, I'm not sure what the guys are sniffing with the POSIX draft ACL stuff merged inside rich ACLs.. Better to be compatible with solaris and the BSDs than with the crappy POSIX draft ACLs imho.. |
I see distros are using the "nfs4-acl-tools" package for NFS4 acl management. It uses nfs4_getfacl, nfs4_setfacl, and nfs4_editfacl. When I run these against zfs, I currently get "Operation to request attribute not supported." This seems to me the way linux is going to do NFS4. Now we just need a way for the tools and zfs to be aware of each other. |
@ghfields thanks for commenting, I haven't looked in to nfs4 acls for a few years but it looks like they're making really good progress with the user space components. Based on a cursory reading of the nfs4-acl-tools source it looks like the expected user/kernel interface is via an xattr named Getting this working might only require adding xattr handlers for a On the surface getting this working looks very possible. I think it would be great if a developer wanted to tackle this feature. |
Since this issue was closed when the POSIX acls was implemented, should a new issue be created specifically for NFS4 acls? Or should this one be reopened? |
@ghfields can you open a new issue for this. That'll make it easier to track. |
Signed-off-by: Pawan <[email protected]>
[stable/cobia] Sync with Upstream zfs-2.2-release
It will be good to have POSIX ACL support.
As I see zfs already have xattr support and some other filesystems made ACL support over xattr. I'm do not know the internals, but this task may be simple to implement.
The text was updated successfully, but these errors were encountered: