All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Stefan (metze) Metzmacher" <metze-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
To: "Andreas Grünbacher"
	<andreas.gruenbacher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Linux Kernel Mailing List
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Linux FS-devel Mailing List
	<linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Linux NFS Mailing List
	<linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Linux API Mailing List
	<linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	samba-technical
	<samba-technical-w/Ol4Ecudpl8XjKLYN78aQ@public.gmane.org>,
	linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [RFC v4 06/31] richacl: In-memory representation and helper functions
Date: Thu, 25 Jun 2015 23:40:05 +0200	[thread overview]
Message-ID: <558C7535.9050502@samba.org> (raw)
In-Reply-To: <CAHpGcM+AwRubQqX96V3WbwLKXKTfk3YcgFG_eqG6r7cVbCTV-w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2706 bytes --]

Hi Andreas,

>> I'm wondering if the size of an ace should be dynamic,
>> which might make it possible to support other ace types
>> in future. E.g. supporting other identities like 128-bit values
>> to make it easier to map Windows SIDS.
> 
> I'm working on additionally supporting unmapped user@domain and
> group@domain identifier strings; we have to deal with that case in the
> nfs client; that may be useful for Samba as well.

Can this be any string? So would
"S-1-5-21-4052121579-2079768045-1474639452-1001" also work?

How would the current thread/process get a "token" that would match such
an ace?

>> Even without 128-bit ids, it would be very useful to mark an
>> ace so that it applies to a uid or gid at the same time.
>> This would reduce the size of the ace list when Samba uses
>> IDMAP_TYPE_BOTH, which means a SID is mapped to a unix id, which
>> is user (uid) and group (gid) at the same time. This feature is required
>> in order to support SID-Histories on accounts.
>> Currently Samba needs to add two aces (one uid and one gid)
>> in order to represent one Windows ace.
> 
> It's not clear to me if supporting this would be a good idea right now.
> The kernel would have to treat each such entry like two separate entries
> internally. How would we map a combined user-space "uid + gid"
> number to a kernel uid and gid since it could map to two distinct
> numbers there?

No, the numeric value is the same.

I think richacl_permission() is the only place that requires any action.

	richacl_for_each_entry(ace, acl) {
		unsigned int ace_mask = ace->e_mask;

		if (richace_is_inherit_only(ace))
			continue;
		if (richace_is_owner(ace)) {
			if (!uid_eq(current_fsuid(), inode->i_uid))
				continue;
		} else if (richace_is_group(ace)) {
			if (!in_owning_group)
				continue;
+		} else if (richace_is_unix_both(ace)) {
+			kuid_t uid = current_fsuid();
+
+			if (!uid_eq(uid, ace->e_id.xid) && !in_group_p(ace->e_id.xid))
+				continue;
		} else if (richace_is_unix_user(ace)) {
			kuid_t uid = current_fsuid();

			if (!uid_eq(uid, ace->e_id.uid))
				continue;
		} else if (richace_is_unix_group(ace)) {
			if (!in_group_p(ace->e_id.gid))
				continue;
		} else
			goto entry_matches_everyone;

In general shouldn't kuid_t uid = current_fsuid(); be at the top of the
function just once?

>> I haven't looked at the claims based acls on Windows, but it would be
>> good if the new infrastructure is dynamic enough to support something
>> like that in a future version.
> 
> I don't know, I have yet to see a use case that isn't totally crazy.

Ok, I found the a_version in struct richacl_xattr.

metze


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: "Stefan (metze) Metzmacher" <metze@samba.org>
To: "Andreas Grünbacher" <andreas.gruenbacher@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux FS-devel Mailing List <linux-fsdevel@vger.kernel.org>,
	Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
	Linux API Mailing List <linux-api@vger.kernel.org>,
	samba-technical <samba-technical@lists.samba.org>,
	linux-security-module@vger.kernel.org
Subject: Re: [RFC v4 06/31] richacl: In-memory representation and helper functions
Date: Thu, 25 Jun 2015 23:40:05 +0200	[thread overview]
Message-ID: <558C7535.9050502@samba.org> (raw)
In-Reply-To: <CAHpGcM+AwRubQqX96V3WbwLKXKTfk3YcgFG_eqG6r7cVbCTV-w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2706 bytes --]

Hi Andreas,

>> I'm wondering if the size of an ace should be dynamic,
>> which might make it possible to support other ace types
>> in future. E.g. supporting other identities like 128-bit values
>> to make it easier to map Windows SIDS.
> 
> I'm working on additionally supporting unmapped user@domain and
> group@domain identifier strings; we have to deal with that case in the
> nfs client; that may be useful for Samba as well.

Can this be any string? So would
"S-1-5-21-4052121579-2079768045-1474639452-1001" also work?

How would the current thread/process get a "token" that would match such
an ace?

>> Even without 128-bit ids, it would be very useful to mark an
>> ace so that it applies to a uid or gid at the same time.
>> This would reduce the size of the ace list when Samba uses
>> IDMAP_TYPE_BOTH, which means a SID is mapped to a unix id, which
>> is user (uid) and group (gid) at the same time. This feature is required
>> in order to support SID-Histories on accounts.
>> Currently Samba needs to add two aces (one uid and one gid)
>> in order to represent one Windows ace.
> 
> It's not clear to me if supporting this would be a good idea right now.
> The kernel would have to treat each such entry like two separate entries
> internally. How would we map a combined user-space "uid + gid"
> number to a kernel uid and gid since it could map to two distinct
> numbers there?

No, the numeric value is the same.

I think richacl_permission() is the only place that requires any action.

	richacl_for_each_entry(ace, acl) {
		unsigned int ace_mask = ace->e_mask;

		if (richace_is_inherit_only(ace))
			continue;
		if (richace_is_owner(ace)) {
			if (!uid_eq(current_fsuid(), inode->i_uid))
				continue;
		} else if (richace_is_group(ace)) {
			if (!in_owning_group)
				continue;
+		} else if (richace_is_unix_both(ace)) {
+			kuid_t uid = current_fsuid();
+
+			if (!uid_eq(uid, ace->e_id.xid) && !in_group_p(ace->e_id.xid))
+				continue;
		} else if (richace_is_unix_user(ace)) {
			kuid_t uid = current_fsuid();

			if (!uid_eq(uid, ace->e_id.uid))
				continue;
		} else if (richace_is_unix_group(ace)) {
			if (!in_group_p(ace->e_id.gid))
				continue;
		} else
			goto entry_matches_everyone;

In general shouldn't kuid_t uid = current_fsuid(); be at the top of the
function just once?

>> I haven't looked at the claims based acls on Windows, but it would be
>> good if the new infrastructure is dynamic enough to support something
>> like that in a future version.
> 
> I don't know, I have yet to see a use case that isn't totally crazy.

Ok, I found the a_version in struct richacl_xattr.

metze


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  parent reply	other threads:[~2015-06-25 21:40 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24 21:56 [RFC v4 00/31] Richacls Andreas Gruenbacher
2015-06-24 21:56 ` Andreas Gruenbacher
2015-06-24 21:56 ` [RFC v4 01/31] vfs: Add IS_ACL() and IS_RICHACL() tests Andreas Gruenbacher
2015-06-24 21:56 ` [RFC v4 04/31] vfs: Make the inode passed to inode_change_ok non-const Andreas Gruenbacher
2015-06-24 21:56 ` [RFC v4 05/31] vfs: Add permission flags for setting file attributes Andreas Gruenbacher
2015-06-24 21:56 ` [RFC v4 06/31] richacl: In-memory representation and helper functions Andreas Gruenbacher
2015-06-25 19:58   ` Stefan (metze) Metzmacher
2015-06-25 21:06     ` Andreas Grünbacher
     [not found]       ` <CAHpGcM+AwRubQqX96V3WbwLKXKTfk3YcgFG_eqG6r7cVbCTV-w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-25 21:40         ` Stefan (metze) Metzmacher [this message]
2015-06-25 21:40           ` Stefan (metze) Metzmacher
     [not found]           ` <558C7535.9050502-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
2015-06-26  7:55             ` Andreas Grünbacher
2015-06-26  7:55               ` Andreas Grünbacher
2015-06-24 21:56 ` [RFC v4 07/31] richacl: Permission mapping functions Andreas Gruenbacher
2015-06-24 21:56 ` [RFC v4 08/31] richacl: Compute maximum file masks from an acl Andreas Gruenbacher
2015-06-24 21:57 ` [RFC v4 11/31] vfs: Cache base_acl objects in inodes Andreas Gruenbacher
2015-06-24 21:57 ` [RFC v4 14/31] richacl: Create-time inheritance Andreas Gruenbacher
2015-06-24 21:57 ` [RFC v4 15/31] richacl: Automatic Inheritance Andreas Gruenbacher
2015-06-24 21:57 ` [RFC v4 17/31] vfs: Add richacl permission checking Andreas Gruenbacher
2015-06-24 21:57 ` [RFC v4 19/31] ext4: Add richacl feature flag Andreas Gruenbacher
2015-06-24 21:57 ` [RFC v4 20/31] richacl: acl editing helper functions Andreas Gruenbacher
2015-06-24 21:57 ` [RFC v4 23/31] richacl: Set the owner permissions to the owner mask Andreas Gruenbacher
2015-06-24 21:57 ` [RFC v4 25/31] richacl: Isolate the owner and group classes Andreas Gruenbacher
     [not found] ` <1435183040-22726-1-git-send-email-agruenba-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-24 21:56   ` [RFC v4 02/31] vfs: Add MAY_CREATE_FILE and MAY_CREATE_DIR permission flags Andreas Gruenbacher
2015-06-24 21:56     ` Andreas Gruenbacher
2015-06-24 21:56   ` [RFC v4 03/31] vfs: Add MAY_DELETE_SELF and MAY_DELETE_CHILD " Andreas Gruenbacher
2015-06-24 21:56     ` Andreas Gruenbacher
2015-06-24 21:56   ` [RFC v4 09/31] richacl: Update the file masks in chmod() Andreas Gruenbacher
2015-06-24 21:56     ` Andreas Gruenbacher
2015-06-24 21:56   ` [RFC v4 10/31] richacl: Permission check algorithm Andreas Gruenbacher
2015-06-24 21:56     ` Andreas Gruenbacher
2015-06-24 21:57   ` [RFC v4 12/31] vfs: Cache richacl in struct inode Andreas Gruenbacher
2015-06-24 21:57     ` Andreas Gruenbacher
2015-06-24 21:57   ` [RFC v4 13/31] richacl: Check if an acl is equivalent to a file mode Andreas Gruenbacher
2015-06-24 21:57     ` Andreas Gruenbacher
2015-06-24 21:57   ` [RFC v4 16/31] richacl: xattr mapping functions Andreas Gruenbacher
2015-06-24 21:57     ` Andreas Gruenbacher
2015-06-24 21:57   ` [RFC v4 18/31] ext4: Add richacl support Andreas Gruenbacher
2015-06-24 21:57     ` Andreas Gruenbacher
2015-06-24 21:57   ` [RFC v4 21/31] richacl: Move everyone@ aces down the acl Andreas Gruenbacher
2015-06-24 21:57     ` Andreas Gruenbacher
2015-06-24 21:57   ` [RFC v4 22/31] richacl: Propagate everyone@ permissions to other aces Andreas Gruenbacher
2015-06-24 21:57     ` Andreas Gruenbacher
2015-06-24 21:57   ` [RFC v4 24/31] richacl: Set the other permissions to the other mask Andreas Gruenbacher
2015-06-24 21:57     ` Andreas Gruenbacher
2015-06-24 21:57   ` [RFC v4 26/31] richacl: Apply the file masks to a richacl Andreas Gruenbacher
2015-06-24 21:57     ` Andreas Gruenbacher
2015-06-24 21:57   ` [RFC v4 27/31] richacl: Create richacl from mode values Andreas Gruenbacher
2015-06-24 21:57     ` Andreas Gruenbacher
2015-06-24 21:57   ` [RFC v4 28/31] nfsd: Keep list of acls to dispose of in compoundargs Andreas Gruenbacher
2015-06-24 21:57     ` Andreas Gruenbacher
2015-06-24 21:57   ` [RFC v4 31/31] nfsd: Add support for the v4.1 dacl attribute Andreas Gruenbacher
2015-06-24 21:57     ` Andreas Gruenbacher
2015-06-24 21:57 ` [RFC v4 29/31] nfsd: Use richacls as internal acl representation Andreas Gruenbacher
2015-06-24 21:57 ` [RFC v4 30/31] nfsd: Add richacl support Andreas Gruenbacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=558C7535.9050502@samba.org \
    --to=metze-eunubhrolfbytjvyw6ydsg@public.gmane.org \
    --cc=andreas.gruenbacher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=samba-technical-w/Ol4Ecudpl8XjKLYN78aQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.