Skip to contentSkip to conversation

FUSE permission modell (Was: fuse review bits)

RFC Bodo Eggert <[email protected]> 7 participants 34 messages Apr 12, 2005 – Apr 20, 2005 20 messages not in the archive VFS

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#11 lore raw
Quoted 9 lines · Jamie Lokier
Quoted 3 lines · Miklos Szeredi

   4) Access should not be further restricted for the owner of the mount, even if permission bits, uid or gid would suggest otherwise


 Why?  Surely you want to prevent writing to files which don't have the writable bit set?  A filesystem may also create append-only files - and all users including the mount owner should be bound by that.

That will depend on the situation. If the user is mounting a tgz owned by himself, FUSE should default to being a convenient hex-editor.

Quoted 12 lines
Quoted 2 lines

   5) As much of the available information should be exported via the filesystem as possible


 This is the root of the conflict.  You are trying to overload the permission bits and uid/gid to mean something different than they normally do.

 While it's convenient to see some "remote" information such as the uid/gid in a tar file, are you sure it's a good idea to break the unix permissions model - which will break some programs?  (For example, try editing a file with the broken semantics in an editor which checks the uid/gid of the file against the current user).

The editor will try to keep the original permissions, and saving will be less effective.

Quoted 7 lines
Quoted 2 lines

   1) Only allow mount over a directory for which the user has write access (and is not sticky)


 Seems good - but why not sticky?  Mounting a user filesystem in /tmp/user-xxx/my-mount-point seems not unreasonable - provided the administrator can delete the directory (which is possible with detachable mount points).

I once mounted a filesystem in ~/tmp after forgetting about it being a symlink to /tmp/$me/tmp, and I had to promise never to do that again. Ng zvqavtug, gur pyrnahc-grzc-fpevcg xvpxrq va.

Quoted 5 lines
Quoted 2 lines

   5) The filesystem daemon is free to fill in all file attributes to any (sane) value, and the kernel won't modify these.


 Dangerous, because an administrative program might actually trust the attributes to mean what they normally mean in the unix permissions model.

The same risk applies to smbmounted file systems.

Sane daemons will do no check besides matching the owner of a file in the user's home against the expected UID and checking the permission mask, since you can't trust users not to mess with files in directories they own. The "best" they can do should be shoothing their own feet.

(If the user doesn't own the directory, FUSE shouldn't mount.) --
Top 100 things you don't want the sysadmin to say:
80. I cleaned up the root partition and now there's LOTS of free space.

Friß, Spammer: [email protected] [email protected] -
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#12 lore raw
Quoted 6 lines · Bodo Eggert
Quoted 5 lines · Jamie Lokier
Quoted 3 lines · Miklos Szeredi

   4) Access should not be further restricted for the owner of the mount, even if permission bits, uid or gid would suggest otherwise

Quoted 7 lines
Quoted 4 lines


 Why?  Surely you want to prevent writing to files which don't have the writable bit set?  A filesystem may also create append-only files - and all users including the mount owner should be bound by that.

That will depend on the situation. If the user is mounting a tgz owned by himself, FUSE should default to being a convenient hex-editor.

If the user wants to edit a read-only file in a tgz owned by himself, why can he not _chmod_ the file and _then_ edit it?

That said, I would _usually_ prefer that when I enter a tgz, that I see all component files having the same uid/gid/permissions as the tgz file itself - the same as I'd see if I entered a zip file.

-- Jamie
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#13 lore raw
Quoted 6 lines

If the user wants to edit a read-only file in a tgz owned by himself, why can he not _chmod_ the file and _then_ edit it?

That said, I would _usually_ prefer that when I enter a tgz, that I see all component files having the same uid/gid/permissions as the tgz file itself - the same as I'd see if I entered a zip file.

I can accept that usually you are not interested in the stored uid/gid. But doubt that you want to lose permission information when you mount a tar file. Zip is a different kettle of fish since that doesn't contain uid/gid/permissions.

Miklos

#14 lore raw
Quoted 11 lines · Miklos Szeredi
Quoted 6 lines

If the user wants to edit a read-only file in a tgz owned by himself, why can he not _chmod_ the file and _then_ edit it?

That said, I would _usually_ prefer that when I enter a tgz, that I see all component files having the same uid/gid/permissions as the tgz file itself - the same as I'd see if I entered a zip file.

I can accept that usually you are not interested in the stored uid/gid. But doubt that you want to lose permission information when you mount a tar file. Zip is a different kettle of fish since that doesn't contain uid/gid/permissions.

It's not about being not interested.

It's because I'd want my programs, and other users, to have exactly the same access to the tgz contents through vfs as they have when accessing the tgz file directly. Not some baroque combination of unobvious hard-coded permission rules, that aren't even visible through stat(), and which both increase permissions for the user and decrease it for others at the same time.

I see why you may want to hide certain things from other users sometimes - the sshfs example is a good one. I daresay Al Viro could come up with a per-user or per-keyring mount point for those occasions :)

-- Jamie

#15 lore raw
Quoted 10 lines
Quoted 4 lines

I can accept that usually you are not interested in the stored uid/gid. But doubt that you want to lose permission information when you mount a tar file. Zip is a different kettle of fish since that doesn't contain uid/gid/permissions.

It's not about being not interested.

It's because I'd want my programs, and other users, to have exactly the same access to the tgz contents through vfs as they have when accessing the tgz file directly.

OK, that makes sense, and it should be an option.

Quoted 4 lines

Not some baroque combination of unobvious hard-coded permission rules, that aren't even visible through stat(), and which both increase permissions for the user and decrease it for others at the same time.

I look at it differently. I want the tar filesystem to be analogous to running tar. When I run tar, other users are not notified of the output, it's only for me. If they want to run tar, they can too.

The same can be true for tarfs. I mount it for my purpose, others can mount it for theirs. Since the daemon providing the filesystem asways runs with the same capabilities as the user who did the mount, I and others will always get the permissions that we have on the actual tar file.

The end result in permission rules is the _same_ as with your proposal. There's nothing baroque in it.

Think of the "no permission for others" as "hiding", not as some special permission rule. And if this hiding can be nicely done with namespaces, all the better, I'll happily drop this feature at that instant.

Quoted 3 lines

I see why you may want to hide certain things from other users sometimes - the sshfs example is a good one. I daresay Al Viro could come up with a per-user or per-keyring mount point for those occasions :)

Yeah, maybe that's something worth exploring.

Thanks,
Miklos

#16 lore raw
Quoted 5 lines · Miklos Szeredi

The same can be true for tarfs. I mount it for my purpose, others can mount it for theirs. Since the daemon providing the filesystem asways runs with the same capabilities as the user who did the mount, I and others will always get the permissions that we have on the actual tar file.

Fair enough.

Quoted 4 lines

Think of the "no permission for others" as "hiding", not as some special permission rule. And if this hiding can be nicely done with namespaces, all the better, I'll happily drop this feature at that instant.

Indeed, if it can be done with namespaces _and_ mounting on a file (that file-as-directory concept), _and_ automounting, then you could cd into your tgz files and others could too :)

-- Jamie

#17 lore raw
Quoted 3 lines

Indeed, if it can be done with namespaces _and_ mounting on a file (that file-as-directory concept), _and_ automounting, then you could cd into your tgz files and others could too :)

There's still that little problem of accessing the tgz file both as a file and a directory. But yes. Maybe in 10 years time :)

Miklos

#18 lore raw
Quoted 6 lines · Miklos Szeredi
Quoted 3 lines

Indeed, if it can be done with namespaces _and_ mounting on a file (that file-as-directory concept), _and_ automounting, then you could cd into your tgz files and others could too :)

There's still that little problem of accessing the tgz file both as a file and a directory. But yes. Maybe in 10 years time :)

There was a thread a few months ago where file-as-directory was discussed extensively, after Namesys implemented it. That's where the conversation on detachable mount points originated AFAIR. It will probably happen at some point.

A nice implemention of it in FUSE could push it along a bit :)

-- Jamie

#19 lore raw
Quoted 6 lines

There was a thread a few months ago where file-as-directory was discussed extensively, after Namesys implemented it. That's where the conversation on detachable mount points originated AFAIR. It will probably happen at some point.

A nice implemention of it in FUSE could push it along a bit :)

Aren't there some assumptions in VFS that currently make this impossible?

I'll go and find that thread.

Thanks,
Miklos

#20 lore raw
Quoted 9 lines · Miklos Szeredi
Quoted 6 lines

There was a thread a few months ago where file-as-directory was discussed extensively, after Namesys implemented it. That's where the conversation on detachable mount points originated AFAIR. It will probably happen at some point.

A nice implemention of it in FUSE could push it along a bit :)

Aren't there some assumptions in VFS that currently make this impossible?

I believe it's OK with VFS, but applications would be confused to death. Well, there really is one issue -- dentries have exactly one parent, so what do you do when opening a file with hardlinks as a directory? (In fact IIRC that is what lead to all the funny talk about mountpoints, since they don't have this limitation)

-------------------------------------------------------------------------------
Jan 'Bulb' Hudec <[email protected]>

#21 lore raw
Quoted 8 lines
Quoted 2 lines

Aren't there some assumptions in VFS that currently make this impossible?

I believe it's OK with VFS, but applications would be confused to death. Well, there really is one issue -- dentries have exactly one parent, so what do you do when opening a file with hardlinks as a directory? (In fact IIRC that is what lead to all the funny talk about mountpoints, since they don't have this limitation)

OK, that makes sense.

It would be quite interesting to see how applications react. Maybe I'll hack something up :)

Thanks,
Miklos

#22 lore raw
Quoted 9 lines · Miklos Szeredi
Quoted 8 lines
Quoted 2 lines

Aren't there some assumptions in VFS that currently make this impossible?

I believe it's OK with VFS, but applications would be confused to death. Well, there really is one issue -- dentries have exactly one parent, so what do you do when opening a file with hardlinks as a directory? (In fact IIRC that is what lead to all the funny talk about mountpoints, since they don't have this limitation)

Quoted 4 lines

OK, that makes sense.

It would be quite interesting to see how applications react. Maybe I'll hack something up :)

Look up the rather large linux-kernel & linux-fsdevel thread "silent semantic changes with reiser4" and it's followup threads, from last year.

It's already been tried. You will also find sensible ideas on what semantics it should have to do it properly.

-- Jamie

#23 lore raw
Quoted 3 lines

Look up the rather large linux-kernel & linux-fsdevel thread "silent semantic changes with reiser4" and it's followup threads, from last year.

Wow, it's 700+ messages. I got through the first 40, and already feel dizzy :)

Quoted 2 lines

It's already been tried. You will also find sensible ideas on what semantics it should have to do it properly.

OK, I understand the "slash -> directory, no-slash -> regular file" semantics.

How do you envision implementing this for "mount directory over file"?

A new mount flag indicating that it's only to be followed down if there's a slash after the mountpoint?

Thanks,
Miklos

#24 lore raw
Quoted 6 lines · Miklos Szeredi
Quoted 3 lines

Look up the rather large linux-kernel & linux-fsdevel thread "silent semantic changes with reiser4" and it's followup threads, from last year.

Wow, it's 700+ messages. I got through the first 40, and already feel dizzy :)

It's easier if you skip the ones by Hans and their immediate followups :)

(Nothing personal, it's that Hans is mostly justifying reiser4's behaviour, and the posts you really need to read aren't about reiser4).

Quoted 7 lines
Quoted 2 lines

It's already been tried. You will also find sensible ideas on what semantics it should have to do it properly.

OK, I understand the "slash -> directory, no-slash -> regular file" semantics.

How do you envision implementing this for "mount directory over file"?

Somewhere deep in that thread is a discussion between Al Viro and Linus on it.

Quoted 2 lines

A new mount flag indicating that it's only to be followed down if there's a slash after the mountpoint?

The new flag would indicate more than that: These mounts should be detachable in the sense that deleting the file is possible, and perhaps renamable/linkable too. That's the stuff Al Viro discusses in some detail in the big thread.

Ideally we'd like automounting, a bit like the Hurd's translators. Attached to files (using an xattr or something, and executed with the uid/gid of the file owner), and also per-user "pattern->action" options for matching files with a certain type (e.g. tgz/zip/deb/rpm/xml).

But that can be added much later, as it's an orthogonal feature.

-- Jamie

#25 lore raw
In reply to Jan Hudec
Quoted 10 lines
Quoted 4 lines
Quoted 1 line

A nice implemention of it in FUSE could push it along a bit :)

Aren't there some assumptions in VFS that currently make this impossible?

I believe it's OK with VFS, but applications would be confused to death. Well, there really is one issue -- dentries have exactly one parent, so what do you do when opening a file with hardlinks as a directory? (In fact IIRC that is what lead to all the funny talk about mountpoints, since they don't have this limitation)

Hardlinks aren't a problem when entering a file as if it's a directory, provided the directory does not contain any hard links to a parent in the hierarchy. In other words, as long as it's a directed acyclic graph.

This is trivially always true for virtual directories such as entering an archive file. And detachable/movable mountpoints are a nice and sensible way to implement it. Some work has actually been done on this.

Experiments with the reiserfs file-as-directory extension showed that applications are generally ok with it. It looks like a file, but you can cd into it or follow a path lookup into it.

Linus had some good ideas on the exact semantics to implement when doing path lookup on these objects.

-- Jamie

#26 lore raw
In reply to Jamie Lokier
Quoted 15 lines · Jamie Lokier
Quoted 6 lines · Bodo Eggert
Quoted 5 lines · Jamie Lokier
Quoted 3 lines · Miklos Szeredi

   4) Access should not be further restricted for the owner of the mount, even if permission bits, uid or gid would suggest otherwise

Quoted 7 lines
Quoted 4 lines


 Why?  Surely you want to prevent writing to files which don't have the writable bit set?  A filesystem may also create append-only files - and all users including the mount owner should be bound by that.

That will depend on the situation. If the user is mounting a tgz owned by himself, FUSE should default to being a convenient hex-editor.

Quoted 6 lines

If the user wants to edit a read-only file in a tgz owned by himself, why can he not _chmod_ the file and _then_ edit it?

That said, I would _usually_ prefer that when I enter a tgz, that I see all component files having the same uid/gid/permissions as the tgz file itself - the same as I'd see if I entered a zip file.

As you say _usually_, even you admit that sometimes you would want the real owner/permissions to be shown. And that is the point Miklos is trying to make I believe: it should be configurable not hard set to only one which is what I understand HCH wants.

There are uses for both. For example today I was updating the tar ball which is used to create the var file system for a new chroot. I certainly want to see corretly setup owner/permissions when I look into that tar ball using a FUSE fs...

Best regards,

Anton

Signature · 4 lines
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
#27 lore raw
Quoted 9 lines · Anton Altaparmakov
Quoted 3 lines

That said, I would _usually_ prefer that when I enter a tgz, that I see all component files having the same uid/gid/permissions as the tgz file itself - the same as I'd see if I entered a zip file.

As you say _usually_, even you admit that sometimes you would want the real owner/permissions to be shown. And that is the point Miklos is trying to make I believe: it should be configurable not hard set to only one which is what I understand HCH wants.

Quoted 4 lines

There are uses for both. For example today I was updating the tar ball which is used to create the var file system for a new chroot. I certainly want to see corretly setup owner/permissions when I look into that tar ball using a FUSE fs...

If I'm updating a var filesystem for a new chroot, I'd need the ability to chmod and chown things in that filesystem. Does that work as an ordinary user?

-- Jamie

#28 lore raw
Quoted 8 lines
Quoted 4 lines

There are uses for both. For example today I was updating the tar ball which is used to create the var file system for a new chroot. I certainly want to see corretly setup owner/permissions when I look into that tar ball using a FUSE fs...

If I'm updating a var filesystem for a new chroot, I'd need the ability to chmod and chown things in that filesystem. Does that work as an ordinary user?

Yes, within UML for example.

I have a little project to imlement a "userloop" filesystem, which works just like "mount -o loop", but you don't need root privs. This is really simple to do with FUSE and UML.

I don't think that it's far feched, that in certain situations the user _does_ have the right (and usefulness) to do otherwise privileged filesystem operations.

Miklos

#29 lore raw
Quoted 10 lines · Miklos Szeredi
Quoted 8 lines
Quoted 4 lines

There are uses for both. For example today I was updating the tar ball which is used to create the var file system for a new chroot. I certainly want to see corretly setup owner/permissions when I look into that tar ball using a FUSE fs...

If I'm updating a var filesystem for a new chroot, I'd need the ability to chmod and chown things in that filesystem. Does that work as an ordinary user?

Yes, within UML for example.

That's a bad example. UML does in fact *NOT* invoke host kernel's chmod, because it has all the filesystem in a file.

But the answer is yes anyway. It's up to the filesystem to check whether it is allowed. FUSE does not block it and if the actual userland driver does not protest either, it is possible.

Quoted 1 line

[...]

-------------------------------------------------------------------------------
Jan 'Bulb' Hudec <[email protected]>

#30 lore raw
In reply to Miklos Szeredi
Quoted 3 lines · Miklos Szeredi

I have a little project to imlement a "userloop" filesystem, which works just like "mount -o loop", but you don't need root privs. This is really simple to do with FUSE and UML.

That would be a nice way to implement those rarely used old filesystems that aren't really needed in the kernel source tree any more, but which it would be nice to have access to as legacy filesystem formats.

In other words, migrating old legacy filesystems out of the kernel tree, into FUSE.

Quoted 3 lines

I don't think that it's far feched, that in certain situations the user _does_ have the right (and usefulness) to do otherwise privileged filesystem operations.

It's really a matter of philosophy, as to whether the results of stat() are just handy information for the user, or are always defined to mean what you can/can't do with a file.

Local-ssh-into-UML makes more sense for this in some ways, because the uids/gids inside your tgz files or foreign loop filesystems are not related to the space of uids/gids of the host system. Yet, the results from stat() don't distinguish the number spaces, and "ls" doesn't map the numbers to names properly in the wrong space.

-- Jamie

#31 lore raw
Quoted 11 lines
Quoted 3 lines

I have a little project to imlement a "userloop" filesystem, which works just like "mount -o loop", but you don't need root privs. This is really simple to do with FUSE and UML.

That would be a nice way to implement those rarely used old filesystems that aren't really needed in the kernel source tree any more, but which it would be nice to have access to as legacy filesystem formats.

In other words, migrating old legacy filesystems out of the kernel tree, into FUSE.

Not much migration would be needed other than deleting from the current kernel. As long as the lagacy filesystem exists in a kernel that has UML support it should just work.

Quoted 7 lines
Quoted 3 lines

I don't think that it's far feched, that in certain situations the user _does_ have the right (and usefulness) to do otherwise privileged filesystem operations.

It's really a matter of philosophy, as to whether the results of stat() are just handy information for the user, or are always defined to mean what you can/can't do with a file.

Yes, this is the very heart of the conflict between my and your (Christoph's, etc) view.

I argue for more flexibilty, i.e. less policy in kernel, which is a good thing generally.

As long as it's secure, what is the problem with it? If users are confused, then they will chose the strict mode. If somebody would like to see more information in the filesystem, they use the relaxed mode.

The key here is security IMO. So if you find a security problem with the relaxed mode (together with "hiding") then I bow my head.

Otherwise who cares if it confuses applications (haven't met any) or users. It doensn't matter. If it confuses anything or anyone, the filesystem writer can fix it.

Quoted 3 lines

Local-ssh-into-UML makes more sense for this in some ways, because the uids/gids inside your tgz files or foreign loop filesystems are not related to the space of uids/gids of the host system.

Ssh into UML is awkward, because you don't necessary have all the tools installed, have networking, etc. And in UML the uid/gid won't make any more sense either.

Quoted 3 lines

Yet, the results from stat() don't distinguish the number spaces, and "ls" doesn't map the numbers to names properly in the wrong space.

Well you can use "ls -n". It's up to the tools to present the information you want in the way you want it. If a tool can't do that, tough, but you are not worse off than if the information is not available _at_all_.

Thanks,
Miklos

#32 lore raw
Quoted 8 lines · Miklos Szeredi
Quoted 3 lines

Yet, the results from stat() don't distinguish the number spaces, and "ls" doesn't map the numbers to names properly in the wrong space.

Well you can use "ls -n". It's up to the tools to present the information you want in the way you want it. If a tool can't do that, tough, but you are not worse off than if the information is not available _at_all_.

Well, how do you currently provide access to the information that's not presentable through stat()?

-- Jamie

#33 lore raw
Quoted 11 lines
Quoted 8 lines
Quoted 3 lines

Yet, the results from stat() don't distinguish the number spaces, and "ls" doesn't map the numbers to names properly in the wrong space.

Well you can use "ls -n". It's up to the tools to present the information you want in the way you want it. If a tool can't do that, tough, but you are not worse off than if the information is not available _at_all_.

Well, how do you currently provide access to the information that's not presentable through stat()?

Obviously I don't. However that's hardly an argument for providing even less information.

And stat() btw pretty much covers what information there is to present for network filesystems and archives, since there _is_ a real filesystem where the information originated from (though sometimes it's not a UNIX type of filesystem, in which case there has to be some mapping of the info).

Miklos

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#42 lore raw
Quoted 6 lines · Bodo Eggert
Quoted 6 lines
Quoted 5 lines

That is exactly the intended effect. If I'm at my work machine (where I'm not an admin unfortunately) and I mount my home machine with sshfs (because FUSE is installed fortunately :), then I bloody well don't want the sysadmin or some automated script of his to go mucking under the mountpoint.

Quoted 7 lines
Quoted 4 lines

I think that would be _much_ nicer implemented as a mount which is invisible to other users, rather than one which causes the admin's scripts to spew error messages. Is the namespace mechanism at all suitable for that?

This will require shared subtrees plus a way for new logins from the same user to join an existing (previous login) namespace.

Or "per-user namespaces".

It's part of a more general problem of how you limit access to private data such as crypto keys, either per user, or more finely than that.

Isn't that what all the keyring stuff is for?

-- Jamie

#43 lore raw
Quoted 11 lines · Jamie Lokier
Quoted 7 lines · Bodo Eggert
Quoted 4 lines

I think that would be _much_ nicer implemented as a mount which is invisible to other users, rather than one which causes the admin's scripts to spew error messages. Is the namespace mechanism at all suitable for that?

This will require shared subtrees plus a way for new logins from the same user to join an existing (previous login) namespace.

Or "per-user namespaces".

A general way to enter child namespaces would be much more flexible. The mechanism could be reused by projects like linux-vserver.

Signature · 2 lines
Our last fight was my fault: My wife asked me "What's on the TV?"
I said, "Dust!"

A message that is not in the archive (sent off-list or not yet received): [email protected]

#45 lore raw
Quoted 7 lines · Eric Van Hensbergen
Quoted 5 lines · Miklos Szeredi

1) Only allow mount over a directory for which the user has write access (and is not sticky)

2) Use nosuid,nodev mount options

[...]

Quoted 4 lines

Do these solve all the security concerns with unprivileged mounts, or are there other barriers/concerns? Should there be ulimit (or rlimit) style restrictions on how many mounts/binds a user is allowed to have to prevent users from abusing mount privs?

Definitively. Mountpoints use kernel space, the users could DoS the machine. The per-Machine-limit isn't fine-grained enough, since the users may DoS each other.

You'll have to avoid users capturing system daemons in D state or in slowed-down artificial directory-forests, too. I think namespaces will do most the trick.

Quoted 5 lines

I was thinking about this a while back and thought having a user-mount permissions file might be the right way to address lots of these issues. Essentially it would contain information about what users/groups were allowed to mount what sources to what destinations and with what mandatory options.

Users being able to mount random fs containing suid or device nodes are root whenever they want to. If you want to mount with dev or suid, use sudo and restrict the mount to a limited set of images/devices/whatever.

Signature · 3 lines
Anger, fear, aggression. The Dark Side of the Force are they.
Once you start down the Dark Path, forever will it dominate your destiny.
        -- Jedi Master Yoda
#46 lore raw
Quoted 11 lines · On 4/17/05, Bodo Eggert <[email protected]>…
Quoted 6 lines

I was thinking about this a while back and thought having a user-mount permissions file might be the right way to address lots of these issues. Essentially it would contain information about what users/groups were allowed to mount what sources to what destinations and with what mandatory options.

Users being able to mount random fs containing suid or device nodes are root whenever they want to. If you want to mount with dev or suid, use sudo and restrict the mount to a limited set of images/devices/whatever.

Well, that would kinda be the intent behind the permissions file -- it can specify what restricted set of images/devices/whatever the user can mount, I suppose the sensible thing would be to always enforce nosuid and nsgid, but I'd rather keep these as the default version of options (allowing admins to shoot themselves in the foot perhaps, but in the single-user workstation case, is seems like there's less reason to be so paranoid).

-eric

#47 lore raw
Quoted 12 lines · Eric Van Hensbergen

On 4/17/05, Bodo Eggert <[email protected]>

Quoted 9 lines
Quoted 5 lines

I was thinking about this a while back and thought having a user-mount permissions file might be the right way to address lots of these issues. Essentially it would contain information about what users/groups were allowed to mount what sources to what destinations and with what mandatory options.

Users being able to mount random fs containing suid or device nodes are root whenever they want to. If you want to mount with dev or suid, use sudo and restrict the mount to a limited set of images/devices/whatever.

Quoted 7 lines

Well, that would kinda be the intent behind the permissions file -- it can specify what restricted set of images/devices/whatever the user can mount, I suppose the sensible thing would be to always enforce nosuid and nsgid, but I'd rather keep these as the default version of options (allowing admins to shoot themselves in the foot perhaps, but in the single-user workstation case, is seems like there's less reason to be so paranoid).

I think you shouldn't help the admins by creating shoes with target marks.

Allowing user mounts with no* should be allways ok (no config needed besides the ulimit), and mounting specified files to defined locations is allready supported by fstab.

Signature · 2 lines
Top 100 things you don't want the sysadmin to say:
6. We prefer not to change the root password, it's an nice easy one
#48 lore raw
Quoted 6 lines

I think you shouldn't help the admins by creating shoes with target marks.

Allowing user mounts with no* should be allways ok (no config needed besides the ulimit), and mounting specified files to defined locations is allready supported by fstab.

I tend to agree. It should be obvious which sort of mounts are safe and which are not. The exceptions can go into fstab.

In a private namespace environment bind mounts (nodev,nosuid) should be OK. Network filesystems (with limitations to the ports used) are also. Disk filesystems are usually not safe to mount for users, because they are not tested and verified against untrusted source.

Miklos

#49 lore raw
In reply to Bodo Eggert
Quoted 11 lines · Bodo Eggert
Quoted 8 lines

Well, that would kinda be the intent behind the permissions file -- it can specify what restricted set of images/devices/whatever the user can mount, I suppose the sensible thing would be to always enforce nosuid and nsgid, but I'd rather keep these as the default version of options (allowing admins to shoot themselves in the foot perhaps, but in the single-user workstation case, is seems like there's less reason to be so paranoid).

I think you shouldn't help the admins by creating shoes with target marks.

Fair enough. Since I don't really have any cases I can think of that require this sort of behavior, I'll back off on allowing user mounts with suid or sgid enabled.

Quoted 5 lines

Allowing user mounts with no* should be allways ok (no config needed besides the ulimit), and mounting specified files to defined locations is allready supported by fstab.

Do folks think that the limits should be per-user or per-process for user-mounts, what about separate limits for # of private namespaces and # of mounts?

The fstab support doesn't seem to provide enough flexibility for certain situations, say I want to support mounting any remote file
system, as long as its in the user's private hierarchy? What if I
want user's to be able to mount FUSE, v9fs, etc. user-space file systems, but only in a private namespace and only in their private hierarchy? Or are these situations which you think should "always be okay" as long as nosuid and nogid (and newns?) are implicit?

-eric

#50 lore raw
Quoted 10 lines · Eric Van Hensbergen
Quoted 4 lines · Bodo Eggert

Allowing user mounts with no* should be allways ok (no config needed besides the ulimit), and mounting specified files to defined locations is allready supported by fstab.

Do folks think that the limits should be per-user or per-process for user-mounts, what about separate limits for # of private namespaces and # of mounts?

Per-user.

Quoted 3 lines

The fstab support doesn't seem to provide enough flexibility for certain situations, say I want to support mounting any remote file system, as long as its in the user's private hierarchy?

[...]

The dir is owned by the user, therefore it's allowed with no*.

Signature · 2 lines
Top 100 things you don't want the sysadmin to say:
11. Can you get VMS for this Sparc thingy?
#51 lore raw

Somewhat related question for Viro/the group:

Why is CLONE_NEWNS considered a priveledged operation? Would placing limits on the number of private namespaces a user can own solve any resource concerns or is there something more nefarious I'm missing?

#52 lore raw
Quoted 10 lines · Eric Van Hensbergen

Somewhat related question for Viro/the group:

Why is CLONE_NEWNS considered a priveledged operation? Would placing limits on the number of private namespaces a user can own solve any resource concerns or is there something more nefarious I'm missing? -
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Likely because its a chroot vulnerability.

It allows a process to obtain a reference to the root vfsmount that doesn't have chroot checks performed on it.

Consider the following pseudo example:

main():
chdir("/");
fd = open(".", O_RDONLY);
clone(cloned_func, cloned_stack, CLONE_NEWNS, NULL);

cloned_func:
fchdir(fd);
chdir("..");

if main is run within a chroot where it's "/" is on the same vfsmount as
it's "..", then the application can step out of the chroot using clone(2).

Note: using chdir in a vfsmount outside of your namespace works, however you won't be able to walk off that vfsmount (to its parent or children).

Mike Waychison

#53 lore raw
Quoted 7 lines

Likely because its a chroot vulnerability.

It allows a process to obtain a reference to the root vfsmount that doesn't have chroot checks performed on it.

Consider the following pseudo example:

[...]

Quoted 6 lines

if main is run within a chroot where it's "/" is on the same vfsmount as
it's "..", then the application can step out of the chroot using clone(2).

Note: using chdir in a vfsmount outside of your namespace works, however you won't be able to walk off that vfsmount (to its parent or children).

How about fixing fchdir, so it checks whether you gone outside the tree under current->fs->rootmnt? Should be fairly easy to do.

Miklos