forked from openzfs/zfs
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement NFSv41 ACLs through xattr (#10)
This implements NFSv41 (RFC 5661) ACLs in a manner compatible with vfs_nfs4acl_xattr in Samba and nfs4xdr-acl-tools. There are three key areas of change in this commit: 1) NFSv4 ACL management through system.nfs4_acl_xdr xattr. Install an xattr handler for "system.nfs4_acl_xdr" that presents an xattr containing full NFSv41 ACL structures generated through rpcgen using specification from the Samba project. This xattr is used by userspace programs to read and set permissions. 2) add an i_op->permissions endpoint: zpl_permissions(). This is used by the VFS in Linux to determine whether to allow / deny an operation. Wherever possible, we try to avoid having to call zfs_access(). If kernel has NFSv4 patch for VFS, then perform more complete check of avaiable access mask. 3) add capability-based overrides to secpolicy_vnode_access2() there are various situations in which ACL may need to be overridden based on capabilities. This logic is almost directly copied from Linux VFS. For instance, root needs to be able to always read / write ACLs (otherwise admin can get locked out from files). This is commit was initially inspired by work from Paul B. Henson to implement NFSv4.0 (RFC3530) ACLs in ZFS on Linux. Key areas of divergence are as follows: - ACL specification, xattr format, xattr name - Addition of handling for NFSv4 masks from Linux VFS - Addition of ACL overrides based on capabilities Signed-off-by: Andrew Walker <[email protected]>
- Loading branch information
Showing
12 changed files
with
622 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
#define _SPL_RPC_XDR_H | ||
|
||
#include <sys/types.h> | ||
#include <sys/sysmacros.h> | ||
|
||
typedef int bool_t; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
const ACE4_ACCESS_ALLOWED_ACE_TYPE = 0x00000000; | ||
const ACE4_ACCESS_DENIED_ACE_TYPE = 0x00000001; | ||
const ACE4_SYSTEM_AUDIT_ACE_TYPE = 0x00000002; | ||
const ACE4_SYSTEM_ALARM_ACE_TYPE = 0x00000003; | ||
|
||
typedef u_int acetype4; | ||
|
||
const ACE4_FILE_INHERIT_ACE = 0x00000001; | ||
const ACE4_DIRECTORY_INHERIT_ACE = 0x00000002; | ||
const ACE4_NO_PROPAGATE_INHERIT_ACE = 0x00000004; | ||
const ACE4_INHERIT_ONLY_ACE = 0x00000008; | ||
const ACE4_SUCCESSFUL_ACCESS_ACE_FLAG = 0x00000010; | ||
const ACE4_FAILED_ACCESS_ACE_FLAG = 0x00000020; | ||
const ACE4_IDENTIFIER_GROUP = 0x00000040; | ||
const ACE4_INHERITED_ACE = 0x00000080; | ||
|
||
typedef u_int aceflag4; | ||
|
||
const ACEI4_SPECIAL_WHO = 0x00000001; | ||
|
||
typedef u_int aceiflag4; | ||
|
||
const ACE4_SPECIAL_OWNER = 1; | ||
const ACE4_SPECIAL_GROUP = 2; | ||
const ACE4_SPECIAL_EVERYONE = 3; | ||
const ACE4_SPECIAL_INTERACTIVE = 4; | ||
const ACE4_SPECIAL_NETWORK = 5; | ||
const ACE4_SPECIAL_DIALUP = 6; | ||
const ACE4_SPECIAL_BATCH = 7; | ||
const ACE4_SPECIAL_ANONYMOUS = 8; | ||
const ACE4_SPECIAL_AUTHENTICATED = 9; | ||
const ACE4_SPECIAL_SERVICE = 10; | ||
|
||
const ACE4_READ_DATA = 0x00000001; | ||
const ACE4_LIST_DIRECTORY = 0x00000001; | ||
const ACE4_WRITE_DATA = 0x00000002; | ||
const ACE4_ADD_FILE = 0x00000002; | ||
const ACE4_APPEND_DATA = 0x00000004; | ||
const ACE4_ADD_SUBDIRECTORY = 0x00000004; | ||
const ACE4_READ_NAMED_ATTRS = 0x00000008; | ||
const ACE4_WRITE_NAMED_ATTRS = 0x00000010; | ||
const ACE4_EXECUTE = 0x00000020; | ||
const ACE4_DELETE_CHILD = 0x00000040; | ||
const ACE4_READ_ATTRIBUTES = 0x00000080; | ||
const ACE4_WRITE_ATTRIBUTES = 0x00000100; | ||
const ACE4_WRITE_RETENTION = 0x00000200; | ||
const ACE4_WRITE_RETENTION_HOLD = 0x00000400; | ||
|
||
const ACE4_DELETE = 0x00010000; | ||
const ACE4_READ_ACL = 0x00020000; | ||
const ACE4_WRITE_ACL = 0x00040000; | ||
const ACE4_WRITE_OWNER = 0x00080000; | ||
const ACE4_SYNCHRONIZE = 0x00100000; | ||
|
||
typedef u_int acemask4; | ||
|
||
struct nfsace4i { | ||
acetype4 type; | ||
aceflag4 flag; | ||
aceiflag4 iflag; | ||
acemask4 access_mask; | ||
u_int who; | ||
}; | ||
|
||
const ACL4_AUTO_INHERIT = 0x00000001; | ||
const ACL4_PROTECTED = 0x00000002; | ||
const ACL4_DEFAULTED = 0x00000004; | ||
|
||
typedef u_int aclflag4; | ||
|
||
struct nfsacl41i { | ||
aclflag4 na41_flag; | ||
nfsace4i na41_aces<>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.