From: Jeff Layton Subject: Re: [PATCH] cifs: Add mount option named backup Date: Sun, 18 Sep 2011 08:00:34 -0400 Message-ID: <20110918080034.12f277c3@tlielax.poochiereds.net> References: <1313166821-9172-1-git-send-email-shirishpargonkar@gmail.com> <20110823091510.2d8b8027@corrin.poochiereds.net> <20110829202910.0038ca06@corrin.poochiereds.net> <20110830105201.1aff3900@tlielax.poochiereds.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Steve French , linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Shirish Pargaonkar Return-path: In-Reply-To: Sender: linux-cifs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: On Sat, 17 Sep 2011 14:04:56 -0500 Shirish Pargaonkar wrote: > On Tue, Aug 30, 2011 at 12:54 PM, Steve French w= rote: > > On Tue, Aug 30, 2011 at 12:32 PM, Shirish Pargaonkar > > wrote: > >> On Tue, Aug 30, 2011 at 12:09 PM, Steve French wrote: > >>> On Tue, Aug 30, 2011 at 9:52 AM, Jeff Layton = wrote: > >>>> On Tue, 30 Aug 2011 09:03:05 -0500 > >>>> Shirish Pargaonkar wrote: > >>>> > >>>>> On Mon, Aug 29, 2011 at 7:29 PM, Jeff Layton wrote: > >>>>> > On Mon, 29 Aug 2011 16:24:33 -0500 > >>>>> > Shirish Pargaonkar wrote: > >>>>> > > >>>>> >> On Tue, Aug 23, 2011 at 8:15 AM, Jeff Layton wrote: > >>>>> >> > On Mon, 22 Aug 2011 08:33:49 -0500 > >>>>> >> > Shirish Pargaonkar wrote: > >>>>> >> > > >>>>> >> >> On Fri, Aug 12, 2011 at 11:33 AM, =C2=A0 wrote: > >>>>> >> >> > From: Shirish Pargaonkar > >>>>> >> >> > > >>>>> >> >> > > >>>>> >> >> > Add mount option backup. > >>>>> >> >> > > >>>>> >> >> > It allows an authenticated user to access files with th= e intent to back them > >>>>> >> >> > up including their ACLs, who may not have access permis= sion but has > >>>>> >> >> > "Backup files and directories user right" on them (by v= irtue of being part > >>>>> >> >> > of the built-in group Backup Operators. > >>>>> >> >> > > >>>>> >> >> > If an authenticated user is not part of the built-in gr= oup Backup Operators > >>>>> >> >> > at the server, access to such files is denied. > >>>>> >> >> > > >>>>> >> >> > > >>>>> >> >> > Signed-off-by: Shirish Pargaonkar > >>>>> >> >> > --- > >>>>> >> >> > >>>>> >> >> > >>>>> >> >> Jeff, =C2=A0Steve, > >>>>> >> >> > >>>>> >> >> Any comments on this patch (and manpage patch in cifs-uti= ls)? > >>>>> >> >> > >>>>> >> > > >>>>> >> > This seems like a really nasty kludge. It doesn't seem lik= e the > >>>>> >> > implications of this have been carefully considered. > >>>>> >> > > >>>>> >> > What happens I mount with the "backup" flag and do not hav= e the > >>>>> >> > necessary permissions on the server to use the flag in an = open? Will > >>>>> >> > this new flag be mutually exclusive with "multiuser"? > >>>>> >> > > >>>>> >> > One idea that might be better is to come up with way to ma= rk certain > >>>>> >> > (unix) users with the appropriate flag. If all the backup = users were in > >>>>> >> > a certan group, for instance, then you could use that info= to decide > >>>>> >> > whether to set the flag in the open calls. > >>>>> >> > > >>>>> >> > -- > >>>>> >> > Jeff Layton > >>>>> >> > > >>>>> >> > >>>>> >> Jeff, one comment, it is not the (unix) user that matters, i= t is the > >>>>> >> user on the server (authenticated) user at the server becaus= e the > >>>>> >> user right to access a file in backup mode can be granted on= ly > >>>>> >> to a user at the server. > >>>>> >> > >>>>> > > >>>>> > Right, I realize that. > >>>>> > > >>>>> >> I think care should be taken to make sure that backup and > >>>>> >> multiuser are mutually exclusive mount options in mount.cifs= =2E > >>>>> >> > >>>>> > > >>>>> > My objection here is more fundamental... > >>>>> > > >>>>> > This patchset lends itself to a single, specific use. You can= create a > >>>>> > mount that you want to use for backups. Typically, when runni= ng backups > >>>>> > like this you also intend for this mount to be used by only o= ne (unix) > >>>>> > user. > >>>>> > > >>>>> > Adding a "backup" option is tantamount to adding extra privil= eges to > >>>>> > this mount for anyone who accesses it. However, it's not clea= r to me > >>>>> > how these extra privileges will be secured from other users t= hat don't > >>>>> > necessarily need them. > >>>>> > > >>>>> > It seems to me that it would be far more useful to find a way= to only > >>>>> > add these extra "backup" permissions for certain unix users t= hat are > >>>>> > accessing the mount. > >>>>> > > >>>>> > Does that make sense? > >>>>> > > >>>>> > -- > >>>>> > Jeff Layton > >>>>> > > >>>>> > >>>>> Jeff, definitely. Thanks. =C2=A0I think one way might be to spe= cify an > >>>>> user or uid and restrict the usage of that mount to that user i= d? > >>>>> So you can specify mount option as =C2=A0either backup=3Duserxy= z > >>>>> or backup=3D1001 perhaps? > >>>>> > >>>> > >>>> Sure, that might be reasonable. > >>>> > >>>> Since backup privileges are tied to a group on the server, we co= uld > >>>> also mirror that semantic on the client. Have a backup=3D a= nd turn > >>>> on the backup flag for any unix user who is in that group. That = would > >>>> seem to allow for better integration with things like nss_winbin= d. > >>> > >>> That seems like a good idea - although I prefer that it allow > >>> uid and/or gid to be specified for easier usability > >>> > >>> > >>> > >>> -- > >>> Thanks, > >>> > >>> Steve > >>> > >> > >> Steve, how would we be able to distinguish between uids and gids? > >> The same id e.g 1001, could be either an uid or a gid! > >> The same applies to a name, it could be a group as well as > >> an user name. > > One option - allow them to distinguished via different mount option= : > > > > presumably "backupuid=3D" =C2=A0 =C2=A0and "backupgid=3D" =C2=A0 =C2= =A0If we choose to retain > > "backup" as a mount option as well - then when neither backupuid no= r > > backupgid is specified then the uid of the process mounting would b= e > > used as "backupuid" with no backupgid implied by default. > > > > > > > > -- > > Thanks, > > > > Steve > > >=20 > Not sure if there is a way to check in kernel whether a user/uid is > part of a certain group/gid! > If not, I think the options are to do so by perhaps making a upcall > or verify whether the specified group/gid is the primary group of > the user/uid accessing the file (in the backup intent mode) on > the server. > My preference is for the second option and we can clarify this in the > man page stanza of this mount option (backupgid). >=20 There most certainly is a way to check this in the kernel. It has to do this all the time to check permissions. See in_group_p(). You don't want to check whether the current uid is in a particular group, but rather whether the current task credential is. Otherwise that code won't work if someone runs this under newgrp and the group is password protected. =20 --=20 Jeff Layton