Skip to contentSkip to conversation

viewprinting: what format should views be stored in?

DISCUSSION David Dabbs 7 participants 18 messages Aug 19, 2004 – Oct 27, 2004 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Motivation
----------------------------------------------------------------------
See Hans's original post. In and of itself, viewprinting will not be more secure than chroot. Viewprinting should be less work than chroot. By virtue of its being easier to deploy and administer, the net effect should be increased security, assuming more admins deploy viewprinting.

Later Phase Considerations
----------------------------------------------------------------------
- Explicit exclusion in masks.
- Notions of mask inheritance

Definitions
---------------------------------------------------------------------
Process-Oriented
Specifications of filesystem object visibility are applied to processes regardless of the effective user rights with which the process runs.

Mask (or viewprint)
A specification as to which files are visible to process[es] "running under" the mask. The [file] security underlying the mask remains a user/object/permission mapping applied by the underlying filesystem. If a mask a) does not include a file or b) explicitly filters out acess, the file operation ceases and an error is returned. If the file upon which the process wants to operate is not filtered by the mask, then the operation request is passed on to the underlying filesystem. There, the requested file a) might not exist, b) might exist but not be visible/readable by the user running the process, etc.

Fall-Through Point
The point during some file operation at which it is determined that the file is not filtered by the mask. The request [for operation X on the file] is passed on to the VFS/underlying filesystem.

Features & Constraints
----------------------------------------------------------------------
Masks
- must support dirname/*
- do not [yet] need to support dirname/foo.*
- should not allow symbolic link traversal unless the file pointed to is within the mask.

Masked Processes
- May not create hard links.
- Child processes [of a masked process] must inherit the parent's "mask bit" and mask definition.

Filesystem Support
- Reiser4 fs code will be required to implement viewprinting.
- Only Reiser4 filesystems may be "masked."

Questions
----------------------------------------------------------------------

Quoted 5 lines

All file types and access methods will be supported, yes? (mmap, AIO, DIRECT, pipes, hard/sym links, etc.)

Hans: Yes.
...except that they cannot create hard links (above)

Is this restriction unequivocal (yes)?
Any other forbidden Unix fs objects or fs operations?

Quoted 10 lines

Early on in the conversation, there was discussion about "permissible functionality." At a minimum, a mask, true to its name, will effect filesystem object _visibility_. It was not completely clear whether the mask will be proscriptive viz operations. IOW, will the mask say that fooprocess "is not permitted to [attempt to] RWX object bar?" I believe this is not something masks will do, but I wanted clarification.

I don't know why I don't understand your question, but I don't.....;-)

Let me try again. At a mininmum, a mask specifies what objects are visible to a process, correct? If objext X is included in or not explicitly excluded from the mask, then fooprocess is allowed to _attempt_to_ operate on object X. I say "attempt to" because, at that point (fall-through), the mask is finished wrt the operation, yes? Permission to actually carry out an operation on object X is determined by the user/object/permission mapping in the underlying filesystem.

What was not clear to me was whether masks specified, proscribed, or in any way controlled filesystem operations (permissions) for objects that are visible when running under the mask. If so, what can be specified and is it an "allow" a "deny" or either?

Quoted 5 lines

Hans, in your preferred approach you referred to "a format that is as if it is a subdirectory of the masked executable." Did you have in mind checking for something like /usr/bin/fooprocess/metas/mask when exec() loads the exe,

Quoted 7 lines

yes

and if this exists then the files rooted in this directory would be set as the process's root filesystem?

Your statement is imprecise. The mask will be checked first, and then iff it falls through we do a normal filesystem traversal.

It was imprecise because perhaps I had a different vprint concept and implementation in mind. Using the creation tool, JAdmin creates a mask for fooprocess. The mask would be a directory structure rooted at /bin/fooprocess/metas/mask. All files (not dirs) in this tree would be hard links to the "real" files specified in the mask. Only dirs & files included in the spec are visible. When an instance of fooprocess is started, /bin/fooprocess/metas/mask is automagically mounted as the process's root filesystem. The mask would be the filesystem. Other than the use of the metas reiserism (and mask maintenance wizardry) this is not any different than chroot. Since the end result here is to be no more secure than chroot, but very much easier to deploy and maintain, is there a reason why this cannot be the case?

Quoted 12 lines

If you are limited to the semantic layer, then there's no stat node with which to play tricks.

I wonder if it would be feasible if masks only specified exclusions? If, for instance, the mask wanted to exclude /foo/*, then the directory foo would exist (in the mask semantic tree). To exclude /etc/passwd, passwd would exist in the directory /etc. Since you're already going to need to preempt dcache searches (aren't you?)

Sigh, yes, or we need to use dcache for the mask.

Quoted 7 lines

you can insert a search of the mask tree. If the
search fails, then it is not excluded and the request falls through to normal VFS handling. In the /etc/passwd case above, it would find /etc/passwd and so the file is excluded. Processing would stop there, returning some error. How does this sound?

I don't quite understand this paragraph above.

Probably because I'm not on the same page as you and George. Imagine a filesystem with two trees: one, the real
root filesystem and two, the anti-root tree (exclusions). This fs would be the root fs for the process. Let's say fooprocess has the following exclusions:

/etc/passwd
/etc/shadow
/var

Above, when I said "insert a search of the mask tree" what I meant was "first search the exception [semantic] tree (anti-tree) associated with this process. If you find the object there, then report it as NOT FOUND. Otherwise, proceed with a normal fs tree search (fall-through). Basically, a dynamic, per-process (er, per mask) hidden attribute. The modified VFS code to store the dentry of the root of the mask base dir, then use normal namei(), etc. path resolution interfaces to see if the file exists in the exception list? IOW, when fooprocess attempts to open /etc/passwd when fooprocess is under the above mask, the following happens: VFS identifies process as being undermask and so knows dentry of the base dir of the exception list (fooprocess/metas/mask). Before doing 'normal' handling, VFS treats this as a request to operate on fooprocess/metas/mask/etc/passwd. If VFS finds the filename, then NOT FOUND is returned. Otherwise, file processing proceeds normally.

Quoted 10 lines

George:
To give a couple of examples:
1) A given process (say a restricted shell) can not exec() an executable with the set-uid bit on.
- directly
- indirectly (e.g., via bash)
2) Apache can only create/write files in /var/web/incoming.
- files created or modified can not have any execute bit set
and executing chmod is excluded.

Quoted 8 lines

Hans:
this protection happens while traversing the mask or at the fall through point. Hmmm, we need to accumulate a set of permissions that apply to something that are specific to how we got there. That could be complex in the VFS details. We can defer it to Phase II if necessary. George, you should spend a day (not this week) figuring out how much work it would be to make that work. It will be the details of it that will be dangerous....

I'll tackle scenario #2:
* Executing chmod would be excluded because it would not be visible in the mask.
* "files created or modified can not have any execute bit set" Implicit in this statement is that, in addition to filtering object visibility, masks will preempt/proscribe certain fs operations -- in this case, the setting of certain attributes (i.e. exec bit). If this is correct then what can masks allow/prohibit WRT operations/attributes performed on objects. This is what I was trying to clarify with my earlier question.

David

#1 lore raw

Hi

I've been following and have an interest - I hope my comments and observations are valuable.

First, allow me to suggest some more terminology - like George, I always like to see this done early :) Masklet : set of modifications to a filename's access authorisations
Mask: collection of Masklets (possibly only 1)

Most of the time one will use 'mask'; eg one can now traverse a mask (cf an image overlay) however one can use masklet to refer to a specific instance (a complex mask pixel) I've used this terminology below and I think it's OK.

Quoted 5 lines · David Dabbs

Fall-Through Point
The point during some file operation at which it is determined that the file is not filtered by the mask. The request [for operation X on the file] is passed on to the VFS/underlying filesystem.

This doesn't sound right.
(Basically I suspect there has been confusion over 'visibilty' and file attribute masking)

When did masks specify visibility of files? According to Hans :

Quoted 1 line

Hmm. Yes, views should allow masking permissions.

Quoted 1 line · he then

We need to be able to support specifying a mask that allows any file within a given directory to be visible. That is, we need to support dirname/* but we don't yet need to support dirname/foo.*

I think (see last paragraphs of this email) that we have a collection of masklet types.

Quoted 11 lines

Features & Constraints
----------------------------------------------------------------------
Masks
- must support dirname/*
- do not [yet] need to support dirname/foo.*
- should not allow symbolic link traversal unless the file pointed to is within the mask.

simple question here:
does dirname/* go deep into the directory tree??

It doesn't in shell syntax

Maybe dirname/**
(which means the complete tree below dirname)

Important I think.
Also introduces the question of 'rule' interaction

dirname/bar/foo : maska
dirname/bar/* : maskb
dirname** : mask c

which mask?
options:
AND?
most specific? (definition)
first to match?

Quoted 6 lines

Masked Processes
- May not create hard links.
- Child processes [of a masked process] must inherit the parent's "mask bit" and mask definition.

remind me - what is the mask tied to? UID/GID, EUID, PID, PGID? filesystem?
Hans actually says it's derived from the executable.
What if it changes between two processes starting?
Does the running processes mask change? (cf chmod a file - seems reasonable but...)
I'd think it needs to be pretty atomic...
In fact, maybe changing masks on a running (mounted?) system is a potential security hole and forbidden? I think I could think of race examples.

aside: talking about reuse, maybe the recent lkml JOB patch is useful:
http://marc.theaimsgroup.com/?l=linux-kernel&m=109278360210574&w=2

+       A job is a group of related processes all descended from a
+       point of entry process and  identified  by  a  unique  job
+       identifier  (jid).   A  job  can	 contain multiple process
+       groups or sessions, and all processes in one of these sub-
+       groups can only be contained within a single job.

+
+ The primary purpose for having jobs is to provide job
+ based resource limits.

Maybe exe's can have something _like_ setuid? setmid()? mid being based on jid?

Quoted 4 lines

Questions
----------------------------------------------------------------------

Quoted 10 lines
Quoted 6 lines

All file types and access methods will be supported, yes? (mmap, AIO, DIRECT, pipes, hard/sym links, etc.)

Hans: Yes.
...except that they cannot create hard links (above)

Is this restriction unequivocal (yes)? Any other forbidden Unix fs objects or fs operations?

Obviously creating a hardlink _can_ circumvent semantically specified security. But shouldn't that just be a masklet attribute? see below (end)

Quoted 8 lines
Quoted 6 lines

Early on in the conversation, there was discussion about "permissible functionality." At a minimum, a mask, true to its name, will effect filesystem object _visibility_. It was not completely clear whether the mask will be proscriptive viz operations. IOW, will the mask say that fooprocess "is not permitted to [attempt to] RWX object bar?" I believe this is not something masks will do, but I wanted clarification.

I don't know why I don't understand your question, but I don't.....;-)

Quoted 9 lines

Let me try again. At a mininmum, a mask specifies what objects are
visible to a process, correct? If objext X is included in or not explicitly excluded from the mask, then fooprocess is allowed to _attempt_to_ operate on object X. I say "attempt to" because, at that point (fall-through), the mask is finished wrt the operation, yes? Permission to actually carry out an operation on object X is determined by the user/object/permission mapping in the underlying filesystem.

What was not clear to me was whether masks specified, proscribed, or
in any way controlled filesystem operations (permissions) for objects
that are visible when running under the mask. If so, what can be specified and is it an "allow" a "deny" or either?

So, you're saying that a mask can deny authorisation but not grant it. (In which case 'mask' is a good word and the concept of AND goes into the foundations)

A process can read/write/execute according to FS permissions.
If the files 'acl/attr' doesn't allow writing then the mask _cannot_ override this and allow a masked process to write to the file.

This sounds sensible.

Quoted 7 lines
Quoted 7 lines

Hans, in your preferred approach you referred to "a format that is as if it is a subdirectory of the masked executable." Did you have in mind checking for something like /usr/bin/fooprocess/metas/mask when exec() loads the exe,

yes

and if this exists then the files rooted in this directory would be set as the process's root filesystem?

Quoted 9 lines
Quoted 3 lines

Your statement is imprecise. The mask will be checked first, and then iff it falls through we do a normal filesystem traversal.

It was imprecise because perhaps I had a different vprint concept and implementation in mind. Using the creation tool, JAdmin creates a mask for fooprocess. The mask would be a directory structure rooted at /bin/fooprocess/metas/mask. All files (not dirs) in this tree would be hard links to the "real" files specified in the mask. Only dirs & files included in the spec are visible. When an instance of fooprocess is started, /bin/fooprocess/metas/mask is automagically mounted as the process's root filesystem. The mask would be the filesystem. Other than the use of the metas reiserism (and mask maintenance wizardry) this is not any different than chroot. Since the end result here is
to be no more secure than chroot, but very much easier to deploy and maintain, is there a reason why this cannot be the case?

I think the 'thing' at /usr/bin/fooprocess/metas/mask
is a semantic expansion of the mask (ie it's like a directory tree but it doesn't point to files, it just contains lots of masklets).
It can be traversed in parallel to the real tree traversal and the masklets it returns will modify the real results. It is purely semantic. I've expanded this later.

Call it a maskfs?
The email subject becomes:
Re: viewprinting: what format should maskfs use? The answer of course is something very similar to reiserfs.

(BTW perhaps, eventually, /proc/<pid>/maskfs is a better place - and the mask checking moves to vfs - all of a sudden it's not reiser specific - although maskfs is reiserfs code)

Quoted 17 lines
Quoted 12 lines

If you are limited to the semantic layer, then there's no stat node with which to play tricks.

I wonder if it would be feasible if masks only specified exclusions? If, for instance, the mask wanted to exclude /foo/*, then the directory foo would exist (in the mask semantic tree). To exclude /etc/passwd, passwd would exist in the directory /etc. Since you're already going to need to preempt dcache searches (aren't you?)

Sigh, yes, or we need to use dcache for the mask.

you can insert a search of the mask tree. If the search fails, then it is not excluded and the request falls through to normal VFS handling. In the /etc/passwd case above, it would find /etc/passwd and so the file is excluded. Processing would stop there, returning some error. How does this sound?

I don't quite understand this paragraph above.

Probably because I'm not on the same page as you and George.
Imagine a filesystem with two trees: one, the real
root filesystem and two, the anti-root tree (exclusions). This
fs would be the root fs for the process. Let's say fooprocess has the following exclusions:

Quoted 8 lines

/etc/passwd
/etc/shadow
/var

Above, when I said "insert a search of the mask tree" what I meant was
"first search the exception [semantic] tree (anti-tree) associated with this process. If you find the object there, then report it as NOT FOUND. Otherwise, proceed with a normal fs tree search (fall-through).

Here's how I see parallel traversal and using masklets could work (purely semantic) I don't know if this is feasible as I don't know if you could intertwine the fs/maskfs traversals.

The mask just contains: /etc/config.file

1. open (/etc/passwd)
search the maskfs for the first traversal point / : default - fall through to fs search the fs for / - normal behaviour
search the maskfs for the traversal point etc/ : default - fall through to fs search the fs for etc/ - normal behaviour
search the maskfs for the object passwd : not there -> file not found

2. open(/etc/config.file)
search the maskfs for the first traversal point / : default - fall through to fs search the fs for / - normal behaviour
search the maskfs for the traversal point etc/ : default - fall through to fs search the fs for etc/ - normal behaviour
search the maskfs for the object config.file : read only - fall through to fs _with masklet_ search the fs for object - apply masklet and return.

Note that in specifying /etc/config.file you infer a mask on / & /etc/ so maybe directorys mentioned in passing such as /etc/config.file imply / : x only
/etc : x only
/etc/config.file : masklet

of course this needs to be aligned with the comment at the start

This mask is interesting:
/etc : doesn't exist
/etc/config.file : r only

Quoted 10 lines
Quoted 10 lines

George:
To give a couple of examples:
1) A given process (say a restricted shell) can not exec() an executable with the set-uid bit on.
- directly
- indirectly (e.g., via bash)
2) Apache can only create/write files in /var/web/incoming.
- files created or modified can not have any execute bit set
and executing chmod is excluded.

Quoted 3 lines
Quoted 3 lines

Hans:
this protection happens while traversing the mask or at the fall through point.

Don't you always fall through - but sometimes you 'hit' a masklet and sometimes you 'miss'

Quoted 3 lines
Quoted 3 lines

Hmmm, we need to accumulate a set of permissions that apply to
something that are specific to how we got there.

In fs traversal the permision at a point in traversal (ie a directory on the way) doesn't affect the permission of the object when the fs has been traversed except insofar as it may not be reachable. So why do you need to do this? (I agree you need to check each traversal point against the mask)

As I said above: This mask is interesting:
/etc : doesn't exist
/etc/config.file : r only

it will report file not found due to a traversal failure - isn't that what you'd want?

Quoted 5 lines
Quoted 4 lines

That could be complex
in the VFS details. We can defer it to Phase II if necessary. George, you should spend a day (not this week) figuring out how much work it would be to make that work. It will be the details of it that will be dangerous....

Quoted 11 lines

I'll tackle scenario #2:
* Executing chmod would be excluded because it would not be visible in the mask.
* "files created or modified can not have any execute bit set" Implicit in this statement is that, in addition to filtering object visibility, masks will preempt/proscribe certain fs operations -- in this case, the setting of certain attributes (i.e. exec bit). If this is correct then what can masks allow/prohibit WRT operations/attributes performed on objects. This is what I was trying to clarify with my earlier question.

If you have a maskfs then if you traverse it for a filename and get a hit then the results of the hit are the masklet to be applied.

If you get a miss then implicit exclude states:
* doesn't exist (shortcut the call - file not found)

If it hits, what types are there in a masklet?
I think:
* doesn't exist (file not found)
* file attribute mask (eg: prevent any writing)
* acl 'mask' (an obvious extension of attr but no longer simple 'AND' logic)
* syscall mask (prevent hardlink and maybe chmod - although see below)
* 'umask' (chmod) mask (prevent setting suid or execute bit - but may allows setting +w and setgid on directories - may extend to acls too)

David

#2 lore raw
Quoted 13 lines · David Greaves

Hi

I've been following and have an interest - I hope my comments and observations are valuable.

First, allow me to suggest some more terminology - like George, I always like to see this done early Masklet : set of modifications to a filename's access authorisations
Mask: collection of Masklets (possibly only 1)

Most of the time one will use 'mask'; eg one can now traverse a mask (cf an image overlay) however one can use masklet to refer to a specific instance (a complex mask pixel) I've used this terminology below and I think it's OK.

David Dabbs wrote:

Quoted 8 lines
Quoted 3 lines

Fall-Through Point
The point during some file operation at which it is determined that the file is not filtered by the mask. The request [for operation X on the file] is passed on to the VFS/underlying filesystem.

This doesn't sound right.
(Basically I suspect there has been confusion over 'visibilty' and file attribute masking)

When did masks specify visibility of files? According to Hans :

This is clearcase functionality so everyone assumed it from the original posting http://www.namesys.com/blackbox_security.html

Quoted 37 lines
Quoted 2 lines

Hmm. Yes, views should allow masking permissions.

Quoted 1 line · he then

We need to be able to support specifying a mask that allows any file within a given directory to be visible. That is, we need to support dirname/* but we don't yet need to support dirname/foo.*

I think (see last paragraphs of this email) that we have a collection of masklet types.

Quoted 9 lines

Features & Constraints
----------------------------------------------------------------------
Masks - must support dirname/* - do not [yet] need to support dirname/foo.*
- should not allow symbolic link traversal unless the file pointed to is within the mask.

simple question here:
does dirname/* go deep into the directory tree??

It doesn't in shell syntax

Maybe dirname/**
(which means the complete tree below dirname)

Important I think.
Also introduces the question of 'rule' interaction

dirname/bar/foo : maska
dirname/bar/* : maskb
dirname** : mask c

Quoted 5 lines

which mask?
options:
AND?
most specific? (definition)
first to match?

Probably first to match, just thinking in terms of lex. Using every mask that applies is also potentially useful but raises more performance concerns.

Quoted 8 lines
Quoted 8 lines

Masked Processes
- May not create hard links.
- Child processes [of a masked process] must inherit the parent's "mask bit" and mask definition.

Quoted 7 lines

remind me - what is the mask tied to? UID/GID, EUID, PID, PGID? filesystem?
Hans actually says it's derived from the executable.
What if it changes between two processes starting?
Does the running processes mask change? (cf chmod a file - seems reasonable but...)
I'd think it needs to be pretty atomic...
In fact, maybe changing masks on a running (mounted?) system is a potential security hole and forbidden? I think I could think of race examples.

I am disinclined to tackle changing masks on the fly until I have a compelling story to justify the work.

Quoted 12 lines

aside: talking about reuse, maybe the recent lkml JOB patch is useful:
http://marc.theaimsgroup.com/?l=linux-kernel&m=109278360210574&w=2

(quoted diff) +8 -0
+       A job is a group of related processes all descended from a
+       point of entry process and  identified  by  a  unique  job
+       identifier  (jid).   A  job  can     contain multiple process
+       groups or sessions, and all processes in one of these sub-
+       groups can only be contained within a single job.
+
+       The  primary  purpose  for  having  jobs is to provide job
+       based resource limits.
Quoted 2 lines

Maybe exe's can have something _like_ setuid? setmid()? mid being based on jid?

Thanks for the pointer. I will take a look at this.

Quoted 13 lines
Quoted 13 lines

Questions
----------------------------------------------------------------------

Quoted 5 lines

All file types and access methods will be supported, yes? (mmap, AIO, DIRECT, pipes, hard/sym links, etc.)

Hans: Yes.
...except that they cannot create hard links (above)

Quoted 5 lines
Quoted 3 lines

Is this restriction unequivocal (yes)? Any other forbidden Unix fs objects or fs operations?

Obviously creating a hardlink _can_ circumvent semantically specified security. But shouldn't that just be a masklet attribute? see below (end)

Do you have an example in mind?
I share your belief but in a few minutes of thinking about it didn't come up with a plausible example.

Quoted 13 lines
Quoted 13 lines
Quoted 5 lines

Early on in the conversation, there was discussion about "permissible functionality." At a minimum, a mask, true to its name, will effect filesystem object _visibility_. It was not completely clear whether the mask will be proscriptive viz operations. IOW, will the mask say that fooprocess "is not permitted to [attempt to] RWX object bar?" I believe this is not something masks will do, but I wanted clarification.

I don't know why I don't understand your question, but I don't.....;-)

Let me try again. At a mininmum, a mask specifies what objects are
visible to a process, correct? If objext X is included in or not explicitly excluded from the mask, then fooprocess is allowed to _attempt_to_ operate on object X. I say "attempt to" because, at that point (fall-through), the mask is finished wrt the operation, yes? Permission to actually carry out an operation on object X is determined by the user/object/permission mapping in the underlying filesystem.

Quoted 7 lines
Quoted 5 lines

What was not clear to me was whether masks specified, proscribed, or
in any way controlled filesystem operations (permissions) for objects
that are visible when running under the mask. If so, what can be specified and is it an "allow" a "deny" or either?

So, you're saying that a mask can deny authorisation but not grant it. (In which case 'mask' is a good word and the concept of AND goes into the foundations)

YES.

Quoted 5 lines

A process can read/write/execute according to FS permissions.
If the files 'acl/attr' doesn't allow writing then the mask _cannot_ override this and allow a masked process to write to the file.

This sounds sensible.

Glad everyone is on the same page with this

Quoted 22 lines
Quoted 8 lines
Quoted 8 lines

Hans, in your preferred approach you referred to "a format that is as if it is a subdirectory of the masked executable." Did you have in mind checking for something like /usr/bin/fooprocess/metas/mask when exec() loads the exe,

yes

and if this exists then the files rooted in this directory would be set as the process's root filesystem?

Quoted 10 lines
Quoted 2 lines

Your statement is imprecise. The mask will be checked first, and then iff it falls through we do a normal filesystem traversal.

It was imprecise because perhaps I had a different vprint concept and implementation in mind. Using the creation tool, JAdmin creates a mask for fooprocess. The mask would be a directory structure rooted at /bin/fooprocess/metas/mask. All files (not dirs) in this tree would be hard links to the "real" files specified in the mask. Only dirs & files included in the spec are visible. When an instance of fooprocess is started, /bin/fooprocess/metas/mask is automagically mounted as the process's root filesystem. The mask would be the filesystem. Other than the use of the metas reiserism (and mask maintenance wizardry) this is not any different than chroot. Since the end result here is
to be no more secure than chroot, but very much easier to deploy and maintain, is there a reason why this cannot be the case?

I think the 'thing' at /usr/bin/fooprocess/metas/mask
is a semantic expansion of the mask (ie it's like a directory tree but it doesn't point to files, it just contains lots of masklets).
It can be traversed in parallel to the real tree traversal and the masklets it returns will modify the real results. It is purely semantic. I've expanded this later.

Quoted 6 lines

Call it a maskfs?
The email subject becomes:
Re: viewprinting: what format should maskfs use? The answer of course is something very similar to reiserfs.

(BTW perhaps, eventually, /proc/<pid>/maskfs is a better place - and the mask checking moves to vfs - all of a sudden it's not reiser specific - although maskfs is reiserfs code)

Hans and I discussed this briefly. For proof-of-concept work we agreed that having as much as possible in the file system layer was the way to go. If it proves to be viable then we can try to convince the rest of the community.

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

George:
To give a couple of examples:
1) A given process (say a restricted shell) can not exec() an executable with the set-uid bit on.
- directly
- indirectly (e.g., via bash)
2) Apache can only create/write files in /var/web/incoming.
- files created or modified can not have any execute bit set
and executing chmod is excluded.

Quoted 4 lines
Quoted 3 lines
Quoted 3 lines

Hans:
this protection happens while traversing the mask or at the fall through point.

Don't you always fall through - but sometimes you 'hit' a masklet and sometimes you 'miss'

"Fall through" is to the original filesystem below the mask. You don't fall through if the mask rejects the operation.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Hmmm, we need to accumulate a set of permissions that apply to
something that are specific to how we got there.

Quoted 8 lines

In fs traversal the permision at a point in traversal (ie a directory on the way) doesn't affect the permission of the object when the fs has been traversed except insofar as it may not be reachable. So why do you need to do this? (I agree you need to check each traversal point against the mask)

As I said above: This mask is interesting:
/etc : doesn't exist
/etc/config.file : r only

it will report file not found due to a traversal failure - isn't that what you'd want?

I suppose technically it is an optimization: but it makes sense that for some process nothing in /etc is writable or nothing in /home/confidential is available at all.

I tend to think that in your example /etc/config.file is a useless masklet, but perhaps if you change the order then the only file you see in /etc is config.file.

At the moment I need time to think about the mask interpreter layer and put some "stakes in the ground" about what is actually practical to implement.

Quoted 24 lines
Quoted 7 lines
Quoted 4 lines

That could be complex in the VFS details. We can defer it to Phase
II if necessary. George, you should spend a day (not this week) figuring out how much work it would be to make that work. It will be the details of it that will be dangerous....

Quoted 12 lines

I'll tackle scenario #2:
* Executing chmod would be excluded because it would not be visible in the mask.
* "files created or modified can not have any execute bit set" Implicit in this statement is that, in addition to filtering object visibility, masks will preempt/proscribe certain fs operations -- in
this case, the setting of certain attributes (i.e. exec bit). If this is correct
then what can masks allow/prohibit WRT operations/attributes performed on objects. This is what I was trying to clarify with my earlier
question.

If you have a maskfs then if you traverse it for a filename and get a hit then the results of the hit are the masklet to be applied.

If you get a miss then implicit exclude states:
* doesn't exist (shortcut the call - file not found)

Quoted 7 lines

If it hits, what types are there in a masklet?
I think:
* doesn't exist (file not found)
* file attribute mask (eg: prevent any writing)
* acl 'mask' (an obvious extension of attr but no longer simple 'AND' logic)
* syscall mask (prevent hardlink and maybe chmod - although see below)
* 'umask' (chmod) mask (prevent setting suid or execute bit - but may allows setting +w and setgid on directories - may extend to acls too)

For proof of concept the first 2 suffice.
After that we are likely to be driven by practical considerations (e.g., what gets funded )

#3 lore raw
Quoted 20 lines · George Beshers
Quoted 11 lines
Quoted 11 lines

Masked Processes
- May not create hard links.
- Child processes [of a masked process] must inherit the parent's "mask bit" and mask definition.

Quoted 7 lines

remind me - what is the mask tied to? UID/GID, EUID, PID, PGID? filesystem?
Hans actually says it's derived from the executable.
What if it changes between two processes starting?
Does the running processes mask change? (cf chmod a file - seems reasonable but...)
I'd think it needs to be pretty atomic...
In fact, maybe changing masks on a running (mounted?) system is a potential security hole and forbidden? I think I could think of race examples.

Quoted 2 lines

I am disinclined to tackle changing masks on the fly until I have a compelling story to justify the work.

It is less work to allow changing them on the fly than to not do so, since they are stored in the fs, not something loaded into the process state.

Hans

#4 lore raw
Quoted 17 lines · Hans Reiser
Quoted 16 lines · George Beshers
Quoted 15 lines
Quoted 5 lines

Masked Processes
- May not create hard links.
- Child processes [of a masked process] must inherit the parent's "mask bit" and mask definition.

remind me - what is the mask tied to? UID/GID, EUID, PID, PGID? filesystem?
Hans actually says it's derived from the executable. What if it changes between two processes starting?
Does the running processes mask change? (cf chmod a file - seems reasonable but...)
I'd think it needs to be pretty atomic...
In fact, maybe changing masks on a running (mounted?) system is a potential security hole and forbidden?
I think I could think of race examples.

Quoted 7 lines
Quoted 3 lines

I am disinclined to tackle changing masks on the fly until I have a compelling story
to justify the work.

It is less work to allow changing them on the fly than to not do so, since they are stored in the fs, not something loaded into the process state.

Yes.

Additionally, if they could not be changed "on-the-fly", then in practical terms this would force an admin to restart a daemon when a change is made. That would not be very friendly.

Signature · 3 lines
Lamont R. Peterson <[email protected]>
Senior Instructor
Guru Labs, L.C. http://www.GuruLabs.com/
#5 lore raw
Quoted 30 lines · Lamont R. Peterson
Quoted 19 lines · Hans Reiser
Quoted 16 lines · George Beshers
Quoted 16 lines
Quoted 7 lines

Masked Processes
- May not create hard links.
- Child processes [of a masked process] must inherit the parent's "mask bit" and mask definition.

remind me - what is the mask tied to? UID/GID, EUID, PID, PGID? filesystem?
Hans actually says it's derived from the executable.
What if it changes between two processes starting?
Does the running processes mask change? (cf chmod a file - seems reasonable but...)
I'd think it needs to be pretty atomic...
In fact, maybe changing masks on a running (mounted?) system is a potential security hole and forbidden? I think I could think of race examples.

Quoted 7 lines
Quoted 4 lines

I am disinclined to tackle changing masks on the fly until I have a compelling story to justify the work.

It is less work to allow changing them on the fly than to not do so, since they are stored in the fs, not something loaded into the process state.

Quoted 7 lines

Yes.

Additionally, if they could not be changed "on-the-fly", then in practical terms this would force an admin to restart a daemon when a change is made. That would not be very friendly.

Yes, and actually, part of our objective is to allow for incremental improvements/refinements to the masks as we discover more files that the blackbox binary needs.

#6 lore raw
Quoted 27 lines · Hans Reiser
Quoted 25 lines · Lamont R. Peterson
Quoted 21 lines · Hans Reiser
Quoted 14 lines · George Beshers
Quoted 6 lines
Quoted 6 lines

Masked Processes
- May not create hard links.
- Child processes [of a masked process] must inherit the parent's "mask bit" and mask definition.

Quoted 8 lines

remind me - what is the mask tied to? UID/GID, EUID, PID, PGID? filesystem?
Hans actually says it's derived from the executable.
What if it changes between two processes starting?
Does the running processes mask change? (cf chmod a file - seems reasonable but...)
I'd think it needs to be pretty atomic...
In fact, maybe changing masks on a running (mounted?) system is a potential security hole and forbidden? I think I could think of race examples.

Quoted 3 lines

I am disinclined to tackle changing masks on the fly until I have a compelling story to justify the work.

It is less work to allow changing them on the fly than to not do so, since they are stored in the fs, not something loaded into the process state.

Quoted 9 lines
Quoted 7 lines

Yes.

Additionally, if they could not be changed "on-the-fly", then in practical terms this would force an admin to restart a daemon when a change is made. That would not be very friendly.

Yes, and actually, part of our objective is to allow for incremental improvements/refinements to the masks as we discover more files that the blackbox binary needs.

All points above are sound---dynamic changes to masks will be supported in the first implementation according to current thinking.

Still, a "batch mode" for production servers is a concept that should not be discarded too quickly as static masks would certainly support a more efficient implementation --- that the savings would be significant is still very much an open question.

#7 lore raw
Quoted 38 lines · George Beshers
Quoted 34 lines · Hans Reiser
Quoted 32 lines · Lamont R. Peterson
Quoted 16 lines · Hans Reiser
Quoted 14 lines · George Beshers
Quoted 14 lines
Quoted 6 lines

Masked Processes
- May not create hard links.
- Child processes [of a masked process] must inherit the parent's "mask bit" and mask definition.

remind me - what is the mask tied to? UID/GID, EUID, PID, PGID? filesystem?
Hans actually says it's derived from the executable.
What if it changes between two processes starting?
Does the running processes mask change? (cf chmod a file - seems reasonable but...)
I'd think it needs to be pretty atomic...
In fact, maybe changing masks on a running (mounted?) system is a potential security hole and forbidden? I think I could think of race examples.

Quoted 5 lines
Quoted 3 lines

I am disinclined to tackle changing masks on the fly until I have a compelling story to justify the work.

It is less work to allow changing them on the fly than to not do so, since they are stored in the fs, not something loaded into the process state.

Yes.

Additionally, if they could not be changed "on-the-fly", then in practical terms this would force an admin to restart a daemon when a change is made. That would not be very friendly.

Quoted 8 lines
Quoted 2 lines

Yes, and actually, part of our objective is to allow for incremental improvements/refinements to the masks as we discover more files that the blackbox binary needs.

All points above are sound---dynamic changes to masks will be supported in the first implementation according to current thinking.

Still, a "batch mode" for production servers is a concept that should not be discarded too quickly as static masks would certainly support a more efficient implementation

I dispute this point. What do you think would be more efficient than reiser4 directories? Or are you referring to compiled regular expressions?

Quoted 5 lines

--- that the savings would be significant is still very much an open question.

#8 lore raw
Quoted 6 lines · Hans Reiser
Quoted 4 lines · George Beshers
Quoted 7 lines
Quoted 3 lines

Still, a "batch mode" for production servers is a concept that should not be discarded too quickly as static masks would certainly support a more efficient implementation

I dispute this point. What do you think would be more efficient than reiser4 directories? Or are you referring to compiled regular expressions?

Only as a secondary issue. I was thinking about the possibility of a linked-list of static masks. In that case it would make sense to form a single "composed" mask which allows access to just the objects that all the masks allow---basically a set intersection.

Further, an interesting algorithm would be to do the intersection lazily, i.e., so that the composed mask actually is created only for those objects (or perhaps just directories) actually in a path. Obviously the case where this wins is when there are a lot of open calls to some directory.

BTW: we might call a view (as in the database sense) the "mask + name mangling + ..." as Lamont's comment rings true.

Also, I downloaded a paper on evaluating RE which I can send along if you and Nate are interested.

Quoted 8 lines
Quoted 5 lines

--- that the savings would be significant is still very much an open question.

#9 lore raw
Quoted 22 lines · George Beshers
Quoted 6 lines · Hans Reiser
Quoted 4 lines · George Beshers
Quoted 8 lines
Quoted 3 lines

Still, a "batch mode" for production servers is a concept that should not be discarded too quickly as static masks would certainly support a more efficient implementation

I dispute this point. What do you think would be more efficient than reiser4 directories? Or are you referring to compiled regular expressions?

Only as a secondary issue. I was thinking about the possibility of a linked-list of static masks. In that case it would make sense to form a single "composed" mask which allows access to just the objects that all the masks allow---basically a set intersection.

Quoted 6 lines

Further, an interesting algorithm would be to do the intersection lazily, i.e., so that the composed mask actually is created only for those objects (or perhaps just directories) actually in a path. Obviously the case where this wins is when there are a lot of open calls to some directory.

BTW: we might call a view (as in the database sense) the "mask + name mangling + ..." as Lamont's comment rings true.

Let's get the 80% done, and leave the 20% refinements which are as much code as the 80% for later.;-)

Quoted 2 lines

Also, I downloaded a paper on evaluating RE which I can send along if you and Nate are interested.

Send it when we get to evaluating REs, and I will be interested then.

Quoted 13 lines
Quoted 10 lines
Quoted 7 lines

--- that the savings would be significant is still very much an open question.

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

#11 lore raw
Quoted 8 lines · George Beshers
Quoted 4 lines

This doesn't sound right.
(Basically I suspect there has been confusion over 'visibilty' and file attribute masking)

When did masks specify visibility of files? According to Hans :

This is clearcase functionality so everyone assumed it from the original posting http://www.namesys.com/blackbox_security.html

yes.

It was Hans' subsequent: "Hmm. Yes, views should allow masking permissions. "
which implies that requirements are that the mask doesn't just have a binary value:
not there / see filesystem
but actually each masklet contains a bitmask (or similar) to be ANDed with the attr from the fs *and* a there/not-there bit.

Trying for clarity in the role of the mask interpreter layer.
Does the mask act as a gatekeeper - passing things through to the fs (possibly simpler to implement but _far_ less functional)
Or (more likely) does the mask layer take over the role of authoriser(?) in which case it delegates to the fs for the fs authorisation (attr) and then bitwise ANDs that with it's own masklet (maybe shortcutting if the mask determines the file is invisible)

I think we all agree on the latter but I thought it best to be clear.

Quoted 11 lines
Quoted 7 lines

remind me - what is the mask tied to? UID/GID, EUID, PID, PGID? filesystem?
Hans actually says it's derived from the executable.
What if it changes between two processes starting?
Does the running processes mask change? (cf chmod a file - seems reasonable but...)
I'd think it needs to be pretty atomic...
In fact, maybe changing masks on a running (mounted?) system is a potential security hole and forbidden? I think I could think of race examples.

I am disinclined to tackle changing masks on the fly until I have a compelling story to justify the work.

ok - agreed.
Also here's a possible issue:
masklet is dirname/*
open dirname for reading
replace masklet with multiple masklets dirname/a;dirname/b;dirname/c; someone creates file dirname/d
Can I see it from a read of still open dirname/ ?
I shouldn't be able to.

This is security stuff so I'd say that masks are set at mount-time and imutable thereafter?

(errm, sorry, I read your email and wrote this and then noticed it was the *next*section you asked for an example - anyway I'll leave this one in)

Quoted 7 lines
Quoted 2 lines

Obviously creating a hardlink _can_ circumvent semantically specified security. But shouldn't that just be a masklet attribute? see below (end)

Do you have an example in mind?
I share your belief but in a few minutes of thinking about it didn't come up with a plausible example.

links are based on the filename
changing the filename changes the masklet applied. maskspec:
/var/logs/* : readonly
/var/tmp/scratch/ : full access

a file in /var/log has 666 (by mistake)
ln it to /var/tmp/scratch and you can now edit it - breaking the mask.
(so, to be clear, I think they should be allowed but only when the maskspec/interpreter allows them to be filtered - ie phase 1 disallows hardlinks, a future phase could handle them properly)

Quoted 26 lines
Quoted 26 lines
Quoted 7 lines
Quoted 7 lines

Hans, in your preferred approach you referred to "a format that is as if it is a subdirectory of the masked executable." Did you have in mind checking for something like /usr/bin/fooprocess/metas/mask when exec() loads the exe,

yes

and if this exists then the files rooted in this directory would be set as the process's root filesystem?

Quoted 10 lines
Quoted 2 lines

Your statement is imprecise. The mask will be checked first, and then iff it falls through we do a normal filesystem traversal.

It was imprecise because perhaps I had a different vprint concept and implementation in mind. Using the creation tool, JAdmin creates a mask for fooprocess. The mask would be a directory structure rooted at /bin/fooprocess/metas/mask. All files (not dirs) in this tree would be hard links to the "real" files specified in the mask. Only dirs & files included in the spec are visible. When an instance of fooprocess is started, /bin/fooprocess/metas/mask is automagically mounted as the process's root filesystem. The mask would be the filesystem. Other than the use of the metas reiserism (and mask maintenance wizardry) this is not any different than chroot. Since the end result here is
to be no more secure than chroot, but very much easier to deploy and maintain, is there a reason why this cannot be the case?

I think the 'thing' at /usr/bin/fooprocess/metas/mask
is a semantic expansion of the mask (ie it's like a directory tree but it doesn't point to files, it just contains lots of masklets).
It can be traversed in parallel to the real tree traversal and the masklets it returns will modify the real results. It is purely semantic. I've expanded this later.

Call it a maskfs?
The email subject becomes:
Re: viewprinting: what format should maskfs use? The answer of course is something very similar to reiserfs.

Quoted 6 lines
Quoted 1 line

(BTW perhaps, eventually, /proc/<pid>/maskfs is a better place - and the mask checking moves to vfs - all of a sudden it's not reiser specific - although maskfs is reiserfs code)

Hans and I discussed this briefly. For proof-of-concept work we agreed that having as much as possible in the file system layer was the way to go. If it proves to be viable then we can try to convince the rest of the community.

Sorry, the /proc bit was very much an aside.

What I was really interested in was the parallel/concurrent traversing of the fs tree and the maskfs idea.
ie check / in mask then fs, check dir1 in mask then fs, check dir2 in mask then fs, finally check filename in mask then fs (rinse and repeat for symlinks) This would increase the directory traversal time but it would be a constant factor.

I was also interested in what would essentially be a read only reiser filesystem with only directories. One issue is having directory entries that match dirname/**
I wondered about storing the masks in the directories in the inode/acl/attr space.
The issue is then mkfs'ing a maskfs from a set of masklets (rules?, presentation mask?)

Quoted 5 lines
Quoted 1 line

Don't you always fall through - but sometimes you 'hit' a masklet and sometimes you 'miss'

"Fall through" is to the original filesystem below the mask. You don't fall through if the mask rejects the operation.

Hmm I think this is a speech vs email kind of misunderstanding. I think we agree.
I'd argue that you always need the mask and the fs to perform an AND.
in the case where the mask says 'invisible' (by specification or implicitly) then there is an optimisation where you don't need to check the fs - but this isn't very interesting :) Most of the time I'd expect to be doing attr ANDs
(unless the app was actually probing about the fs where it has no right to!)
In fact an implicit fallthrough is worthy of reporting.

At one point I assumed there is no difference between file-not-found and invisible.
There isn't to the app. But you musn't forget monitoring. If an attempt is made to access an invisible file (whether or not it exists), this should go to a security log.

Also someone asked if you could tell you were being masked. The answer may be yes if you look at indirects such as time taken to return a file-not-found or could see a log.

Quoted 12 lines
Quoted 12 lines
Quoted 5 lines
Quoted 5 lines

Hmmm, we need to accumulate a set of permissions that apply to
something that are specific to how we got there.

In fs traversal the permision at a point in traversal (ie a directory on the way) doesn't affect the permission of the object when the fs has been traversed except insofar as it may not be reachable. So why do you need to do this? (I agree you need to check each traversal point against the mask)

As I said above: This mask is interesting:
/etc : doesn't exist
/etc/config.file : r only

Quoted 8 lines
Quoted 1 line

it will report file not found due to a traversal failure - isn't that what you'd want?

I suppose technically it is an optimization: but it makes sense that for some process nothing in /etc is writable or nothing in /home/confidential is available at all.

I tend to think that in your example /etc/config.file is a useless masklet, but perhaps if you change the order then the only file you see in /etc is config.file.

yes indeed. It was supposed to be 'useless'
It was about showing the 'accumulation of permissions specific to how we got there'

Quoted 3 lines

At the moment I need time to think about the mask interpreter layer and put some "stakes in the ground" about what is actually practical to implement.

see above about maskfs :)
How about mounting maskfs's?
mkfs -tmaskfs -ospec=/etc/presentation_mask.spec /etc/maskfs_file
loopback mount the /etc/maskfs_file to the appropriate location
Hijack the reiserfs(?) access/traversal functions (can you - I dunno!) check for jid and if it exists then use it to determine where to look for the maskfs /. Then use the parallel traversal technique to retrieve a masklet and overlay it on the attr.

Quoted 15 lines
Quoted 5 lines

If you have a maskfs then if you traverse it for a filename and get a hit then the results of the hit are the masklet to be applied.

If you get a miss then implicit exclude states:
* doesn't exist (shortcut the call - file not found)

Quoted 7 lines

If it hits, what types are there in a masklet?
I think:
* doesn't exist (file not found)
* file attribute mask (eg: prevent any writing)
* acl 'mask' (an obvious extension of attr but no longer simple 'AND' logic)
* syscall mask (prevent hardlink and maybe chmod - although see below)
* 'umask' (chmod) mask (prevent setting suid or execute bit - but may allows setting +w and setgid on directories - may extend to acls too)

Quoted 1 line

For proof of concept the first 2 suffice.

That's why they were the first two :) I prioritised them at first but then thought I'd leave that 'til someone at the code said what was easy.

Quoted 1 line

After that we are likely to be driven by practical considerations (e.g., what gets funded :-) )

yep - but I thought it worth identifying these for design purposes - and to maybe show how to tackle the other issues (acl, chmod, hardlinks, suid, umask etc)

Still worth prodding to see where the right place for such a thing is - it may be vfs - and designing in such a way as to make migration to there work in the future.

David
PS can I offer 'mask specification' (shortened to maskspec above) instead of 'presentation mask' for the glossary.

#12 lore raw
Quoted 5 lines · David Greaves

David
PS can I offer 'mask specification' (shortened to maskspec above) instead of 'presentation mask' for the glossary.

Glossary? of?

Instead of mask specification, just say mask.

I think I like mask more than view....

Hans

#13 lore raw

I used "presentation mask" for "source mask", i.e., something that was portable and nominally human readable. I am anticipating a compilation process to achieve performance.

Let us go with mask for now: source and compiled modifiers when clarity is needed.

Quoted 15 lines · Hans Reiser
Quoted 5 lines · David Greaves

David
PS can I offer 'mask specification' (shortened to maskspec above) instead of 'presentation mask' for the glossary.

Glossary? of?

Instead of mask specification, just say mask.

I think I like mask more than view....

Hans

#14 lore raw
In reply to Hans Reiser

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hans Reiser wrote:

| David Greaves wrote:
|
|>
|> David
|> PS can I offer 'mask specification' (shortened to maskspec above)
|> instead of 'presentation mask' for the glossary.
|>
|>
| Glossary? of?

terms.
There have been occasional mails that try and clarify what we're talking about.
I think they're helpful.

|
| Instead of mask specification, just say mask.

One way:
I write a mask each line of which is a mask and then the mask compiler turns it into a mask that the mask interpreter uses to mask the permissions?
Q: What's the role of the mask?

Another way:
I write a mask specification each line of which is a masklet and then the mask compiler turns it into a maskfs that the mask interpreter uses to modify the permissions?
Q: What's the role of the mask specification?

Confusion is bad.

Nb in conversation then of course we say 'first, write a mask' - lets just agree the terminology for clarifying the followon questions.

David
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBJgWl8LvjTle4P1gRAr6jAJ9/0QgHDHWn54yRUMhdqpXp2xL19ACfTvey NRGxwKOw87X0IQs5uLiVqrY=
=izE8
-----END PGP SIGNATURE-----

#15 lore raw
In reply to Hans Reiser
Quoted 8 lines · Hans Reiser
Quoted 6 lines · David Greaves

David
PS can I offer 'mask specification' (shortened to maskspec above) instead of 'presentation mask' for the glossary.

Quoted 5 lines

Glossary? of?

Instead of mask specification, just say mask.

I think I like mask more than view....

I respectfully disagree. I like view better than mask. After all, the term mask is used in lots of places already. If you want to distinguish viewprinting from those things, I think "view" is the way to go.

Also, I think view is more accurately descriptive of what it is that you are trying to accomplish here. It is also a more accurate term for us database people :-).

Signature · 3 lines
Lamont R. Peterson <[email protected]>
Senior Instructor
Guru Labs, L.C. http://www.GuruLabs.com/
#16 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lamont R. Peterson wrote:

| On Fri, 2004-08-20 at 00:52, Hans Reiser wrote:
|
|>David Greaves wrote:
|>
|>
|>>David
|>>PS can I offer 'mask specification' (shortened to maskspec above)
|>>instead of 'presentation mask' for the glossary.
|>>
|>>
|>
|>Glossary? of?
|>
|>Instead of mask specification, just say mask.
|>
|>I think I like mask more than view....
|
|
| I respectfully disagree.  I like view better than mask.  After all, the
| term mask is used in lots of places already.  If you want to distinguish
| viewprinting from those things, I think "view" is the way to go.

Trust me to speak up on the least important issues...

What about mask/view, or maskview? People can abbreviate how they like, and it's actually not a bad metaphor -- think of the "view" you get through a "mask", such as a Halloween mask. The eye holes aren't terribly big, so you see a much smaller part of the world. -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iQIVAwUBQX70BXgHNmZLgCUhAQLOKg//bLDAoPOR3VrAhDsjMTvndgjmSa5GohAL Y+Sb6BaLbKIpxVv8WsB9x8t7xsqRPRqWOi7NLsfkDPWV3TH0YXVKEsjR44d4SOBv /MEU4BQwaiwSpJry/FpkfFn5mc8bkV4HubTV6s3sk6qLsWVb3WOIXiHD5n9ppTqu 6qfU4z8WpttIAg1u49CSfc10GdQ4TKwNp9vvPl32EIdo58hp9XrEfLfb9J9byTXg R51cvZVNi3RJohjvvp/wqy7JxvRjUl9Cd6NliHvE/NCQrk0MhiSE7od+d5B17DCZ TonxOhk9OCyW2/d4SLQHtKMoNFXzaGQKO6haIE2ZGWr2W5DAmdZM32C7rz07f5+V CCu/TtLxfnsZ0JLWAUAf4m7e1Q/vx3YtOI/IEHFPMjThoPCiROoUIQwlvV44Y7+w 3YJfmwHfQ4I8g8PvdbR2CdXcYD4ot2XrcEhbQu0aqVUgUWoGGndIyN0AyHV91NFr aRVb6JuE95HUNXy8njakEuFvs29UjG0mlpJSMw3KEFPtEeWMlCxsE2hWpgB1FJK1 P+r/WTBGCdj4NIldl3unPtcXuq/ndxwiiZvOJ1Av2B6M1dBHAlX3Zsqyln/4FJyu JHlSQYaRB0d4RS6/hcKzuxYscgNF3Sf0rlyRgPl3DFMQkBweVDh4TLlfrIU/ERoW A6D6idBjrog=
=s5yB
-----END PGP SIGNATURE-----

#17 lore raw
In reply to David Greaves
Quoted 41 lines · David Greaves

Hi

I've been following and have an interest - I hope my comments and observations are valuable.

First, allow me to suggest some more terminology - like George, I always like to see this done early :) Masklet : set of modifications to a filename's access authorisations
Mask: collection of Masklets (possibly only 1)

Most of the time one will use 'mask'; eg one can now traverse a mask (cf an image overlay) however one can use masklet to refer to a specific instance (a complex mask pixel) I've used this terminology below and I think it's OK.

Quoted 4 lines · David Dabbs

Fall-Through Point
The point during some file operation at which it is determined that the file is not filtered by the mask. The request [for operation X on the file] is passed on to the VFS/underlying filesystem.

This doesn't sound right.
(Basically I suspect there has been confusion over 'visibilty' and file attribute masking)

When did masks specify visibility of files? According to Hans :

Quoted 1 line

Hmm. Yes, views should allow masking permissions.

Quoted 1 line · he then

We need to be able to support specifying a mask that allows any file within a given directory to be visible. That is, we need to support dirname/* but we don't yet need to support dirname/foo.*

I think (see last paragraphs of this email) that we have a collection of masklet types.

Quoted 9 lines

Features & Constraints
----------------------------------------------------------------------
Masks - must support dirname/* - do not [yet] need to support dirname/foo.*
- should not allow symbolic link traversal unless the file pointed to is within the mask.

Quoted 2 lines

simple question here:
does dirname/* go deep into the directory tree??

Yes, it does.

Quoted 13 lines

It doesn't in shell syntax

Maybe dirname/**
(which means the complete tree below dirname)

Important I think.
Also introduces the question of 'rule' interaction

dirname/bar/foo : maska
dirname/bar/* : maskb
dirname** : mask c

Quoted 5 lines

which mask?
options:
AND?
most specific? (definition)
first to match?

Not sure I understand the question, but I'll guess. The answer is that masks are anded, and have an order.

Quoted 9 lines
Quoted 8 lines

Masked Processes
- May not create hard links.
- Child processes [of a masked process] must inherit the parent's "mask bit" and mask definition.

remind me - what is the mask tied to? UID/GID, EUID, PID, PGID? filesystem?

process running.

Quoted 2 lines

Hans actually says it's derived from the executable. What if it changes between two processes starting?

then it changes for both processes.

Quoted 8 lines

Does the running processes mask change? (cf chmod a file - seems reasonable but...)
I'd think it needs to be pretty atomic...
In fact, maybe changing masks on a running (mounted?) system is a potential security hole and forbidden? I think I could think of race examples.

aside: talking about reuse, maybe the recent lkml JOB patch is useful:
http://marc.theaimsgroup.com/?l=linux-kernel&m=109278360210574&w=2

Review

Quoted 8 lines
(quoted diff) +8 -0
+       A job is a group of related processes all descended from a
+       point of entry process and  identified  by  a  unique  job
+       identifier  (jid).   A  job  can     contain multiple process
+       groups or sessions, and all processes in one of these sub-
+       groups can only be contained within a single job.
+
+       The  primary  purpose  for  having  jobs is to provide job
+       based resource limits.

Ok with me. I leave it to George.

Quoted 3 lines

Maybe exe's can have something _like_ setuid? setmid()? mid being based on jid?

?

Quoted 30 lines
Quoted 5 lines

Questions
----------------------------------------------------------------------

Quoted 10 lines
Quoted 5 lines

All file types and access methods will be supported, yes? (mmap, AIO, DIRECT, pipes, hard/sym links, etc.)

Hans: Yes.
...except that they cannot create hard links (above)

Is this restriction unequivocal (yes)? Any other forbidden Unix fs objects or fs operations?

Obviously creating a hardlink _can_ circumvent semantically specified security. But shouldn't that just be a masklet attribute? see below (end)

Quoted 12 lines
Quoted 5 lines

Early on in the conversation, there was discussion about "permissible functionality." At a minimum, a mask, true to its name, will effect filesystem object _visibility_. It was not completely clear whether the mask will be proscriptive viz operations. IOW, will the mask say that fooprocess "is not permitted to [attempt to] RWX object bar?" I believe this is not something masks will do, but I wanted clarification.

I don't know why I don't understand your question, but I don't.....;-)

Let me try again. At a mininmum, a mask specifies what objects are
visible to a process, correct? If objext X is included in or not explicitly excluded from the mask, then fooprocess is allowed to _attempt_to_ operate on object X. I say "attempt to" because, at that point (fall-through), the mask is finished wrt the operation, yes? Permission to actually carry out an operation on object X is determined by the user/object/permission mapping in the underlying filesystem.

Quoted 6 lines
Quoted 5 lines

What was not clear to me was whether masks specified, proscribed, or
in any way controlled filesystem operations (permissions) for objects
that are visible when running under the mask. If so, what can be specified and is it an "allow" a "deny" or either?

So, you're saying that a mask can deny authorisation but not grant it.

Yes.

Quoted 20 lines

(In which case 'mask' is a good word and the concept of AND goes into the foundations)

A process can read/write/execute according to FS permissions.
If the files 'acl/attr' doesn't allow writing then the mask _cannot_ override this and allow a masked process to write to the file.

This sounds sensible.

Quoted 12 lines
Quoted 9 lines

Hans, in your preferred approach you referred to "a format that is as if it is a subdirectory of the masked executable." Did you have in mind checking for something like /usr/bin/fooprocess/metas/mask when exec() loads the exe,

yes

and if this exists then the files rooted in this directory would be set as the process's root filesystem?

Your statement is imprecise. The mask will be checked first, and then iff it falls through we do a normal filesystem traversal.

It was imprecise because perhaps I had a different vprint concept and implementation in mind. Using the creation tool, JAdmin creates a mask for fooprocess. The mask would be a directory structure rooted at /bin/fooprocess/metas/mask. All files (not dirs) in this tree would be hard links to the "real" files specified in the mask.

No, I don't like this.

Quoted 9 lines
Quoted 5 lines

Only dirs & files included in the spec are visible. When an instance of fooprocess is started, /bin/fooprocess/metas/mask is automagically mounted as the process's root filesystem. The mask would be the filesystem. Other than the use of the metas reiserism (and mask maintenance wizardry) this is not any different than chroot. Since the end result here is
to be no more secure than chroot, but very much easier to deploy and maintain, is there a reason why this cannot be the case?

I think the 'thing' at /usr/bin/fooprocess/metas/mask
is a semantic expansion of the mask (ie it's like a directory tree but it doesn't point to files, it just contains lots of masklets).
It can be traversed in parallel to the real tree traversal and the masklets it returns will modify the real results. It is purely semantic. I've expanded this later.

Quoted 29 lines

Call it a maskfs?
The email subject becomes:
Re: viewprinting: what format should maskfs use? The answer of course is something very similar to reiserfs.

(BTW perhaps, eventually, /proc/<pid>/maskfs is a better place - and the mask checking moves to vfs - all of a sudden it's not reiser specific - although maskfs is reiserfs code)

Quoted 21 lines
Quoted 8 lines

If you are limited to the semantic layer, then there's no stat node with which to play tricks.
I wonder if it would be feasible if masks only specified exclusions? If, for instance, the mask wanted to exclude /foo/*, then the directory foo would exist (in the mask semantic tree). To exclude /etc/passwd, passwd would exist in the directory /etc. Since you're already going to need to preempt dcache searches (aren't you?)

Sigh, yes, or we need to use dcache for the mask.

you can insert a search of the mask tree. If the search fails, then it is not excluded and the request falls through to normal VFS handling. In the /etc/passwd case above, it would find /etc/passwd and so the file is excluded. Processing would stop there, returning some error. How does this sound? I don't quite understand this paragraph above.

Probably because I'm not on the same page as you and George.
Imagine a filesystem with two trees: one, the real
root filesystem and two, the anti-root tree (exclusions). This
fs would be the root fs for the process. Let's say fooprocess has the following exclusions:

/etc/passwd
/etc/shadow
/var

Above, when I said "insert a search of the mask tree" what I meant was
"first search the exception [semantic] tree (anti-tree) associated with this process. If you find the object there, then report it as NOT FOUND. Otherwise, proceed with a normal fs tree search (fall-through).

I suppose it could work. Ok. Phase II. Should go into final report for Phase I.

Quoted 5 lines
Quoted 1 line

Here's how I see parallel traversal and using masklets could work (purely semantic) I don't know if this is feasible as I don't know if you could intertwine the fs/maskfs traversals.

Quoted 8 lines

The mask just contains: /etc/config.file

1. open (/etc/passwd)
search the maskfs for the first traversal point / : default - fall through to fs search the fs for / - normal behaviour
search the maskfs for the traversal point etc/ : default - fall through to fs search the fs for etc/ - normal behaviour
search the maskfs for the object passwd : not there -> file not found

No, / is not a fall through point, only /etc/config.file is. There is no need to see if the underlying fs allows something if the mask does not. The mask is fully traversed, and only if we hit a fall through point do we go to the underlying fs, and if we go to the underlying fs, we only come up to the mask again for symlinks.

Quoted 81 lines

2. open(/etc/config.file)
search the maskfs for the first traversal point / : default - fall through to fs search the fs for / - normal behaviour
search the maskfs for the traversal point etc/ : default - fall through to fs search the fs for etc/ - normal behaviour
search the maskfs for the object config.file : read only - fall through to fs _with masklet_ search the fs for object - apply masklet and return.

Note that in specifying /etc/config.file you infer a mask on / & /etc/ so maybe directorys mentioned in passing such as /etc/config.file imply / : x only
/etc : x only
/etc/config.file : masklet

of course this needs to be aligned with the comment at the start

This mask is interesting:
/etc : doesn't exist
/etc/config.file : r only

Quoted 10 lines
Quoted 10 lines

George:
To give a couple of examples:
1) A given process (say a restricted shell) can not exec() an executable with the set-uid bit on.
- directly
- indirectly (e.g., via bash)
2) Apache can only create/write files in /var/web/incoming.
- files created or modified can not have any execute bit set
and executing chmod is excluded.

Quoted 3 lines
Quoted 3 lines

Hans:
this protection happens while traversing the mask or at the fall through point.

Don't you always fall through - but sometimes you 'hit' a masklet and sometimes you 'miss'

Quoted 3 lines
Quoted 3 lines

Hmmm, we need to accumulate a set of permissions that apply to
something that are specific to how we got there.

In fs traversal the permision at a point in traversal (ie a directory on the way) doesn't affect the permission of the object when the fs has been traversed except insofar as it may not be reachable. So why do you need to do this? (I agree you need to check each traversal point against the mask)

As I said above: This mask is interesting:
/etc : doesn't exist
/etc/config.file : r only

it will report file not found due to a traversal failure - isn't that what you'd want?

Quoted 5 lines
Quoted 3 lines

That could be complex in the VFS details. We can defer it to Phase
II if necessary. George, you should spend a day (not this week) figuring out how much work it would be to make that work. It will be the details of it that will be dangerous....

Quoted 12 lines

I'll tackle scenario #2:
* Executing chmod would be excluded because it would not be visible in the mask.
* "files created or modified can not have any execute bit set" Implicit in this statement is that, in addition to filtering object visibility, masks will preempt/proscribe certain fs operations -- in
this case, the setting of certain attributes (i.e. exec bit). If this is correct
then what can masks allow/prohibit WRT operations/attributes performed on objects. This is what I was trying to clarify with my earlier
question.

If you have a maskfs then if you traverse it for a filename and get a hit then the results of the hit are the masklet to be applied.

If you get a miss then implicit exclude states:
* doesn't exist (shortcut the call - file not found)

If it hits, what types are there in a masklet?
I think:
* doesn't exist (file not found)
* file attribute mask (eg: prevent any writing)
* acl 'mask' (an obvious extension of attr but no longer simple 'AND' logic)
* syscall mask (prevent hardlink and maybe chmod - although see below)
* 'umask' (chmod) mask (prevent setting suid or execute bit - but may allows setting +w and setgid on directories - may extend to acls too)

David

#18 lore raw
In reply to David Dabbs
Quoted 6 lines · David Dabbs

Questions
----------------------------------------------------------------------

Quoted 11 lines
Quoted 6 lines

All file types and access methods will be supported, yes? (mmap, AIO, DIRECT, pipes, hard/sym links, etc.)

Hans: Yes.
...except that they cannot create hard links (above)

Is this restriction unequivocal (yes)? Any other forbidden Unix fs objects or fs operations?

It needs further study which Hans and I have agreed to postpone until after we have something working.

Quoted 10 lines
Quoted 8 lines

Early on in the conversation, there was discussion about "permissible functionality." At a minimum, a mask, true to its name, will effect filesystem object _visibility_. It was not completely clear whether the mask will be proscriptive viz operations. IOW, will the mask say that fooprocess "is not permitted to [attempt to] RWX object bar?" I believe this is not something masks will do, but I wanted clarification.

I don't know why I don't understand your question, but I don't.....;-)

Quoted 9 lines

Let me try again. At a mininmum, a mask specifies what objects are
visible to a process, correct? If objext X is included in or not explicitly excluded from the mask, then fooprocess is allowed to _attempt_to_ operate on object X. I say "attempt to" because, at that point (fall-through), the mask is finished wrt the operation, yes? Permission to actually carry out an operation on object X is determined by the user/object/permission mapping in the underlying filesystem.

What was not clear to me was whether masks specified, proscribed, or
in any way controlled filesystem operations (permissions) for objects
that are visible when running under the mask. If so, what can be specified and is it an "allow" a "deny" or either?

The answer is yes... but the extent of the control is an open question.

- We have agreed not to mess with UIDs and GIDs or the associated set-uid and set-gid bits for the moment.
- We have agreed that a mask which limits the operations on a visible file is appropriate, e.g., read-only should be supported.

Beyond that we will be driven largely by the perceived utility of the functionality within the context of usual software engineering concerns.

Quoted 10 lines
Quoted 10 lines

Hans, in your preferred approach you referred to "a format that is as if it is a subdirectory of the masked executable." Did you have in mind checking for something like /usr/bin/fooprocess/metas/mask when exec() loads the exe,

yes

and if this exists then the files rooted in this directory would be set as the process's root filesystem?

Quoted 9 lines
Quoted 3 lines

Your statement is imprecise. The mask will be checked first, and then iff it falls through we do a normal filesystem traversal.

It was imprecise because perhaps I had a different vprint concept and implementation in mind. Using the creation tool, JAdmin creates a mask for fooprocess. The mask would be a directory structure rooted at /bin/fooprocess/metas/mask. All files (not dirs) in this tree would be hard links to the "real" files specified in the mask. Only dirs & files included in the spec are visible. When an instance of fooprocess is started, /bin/fooprocess/metas/mask is automagically mounted as the process's root filesystem. The mask would be the filesystem. Other than the use of the metas reiserism (and mask maintenance wizardry) this is not any different than chroot. Since the end result here is
to be no more secure than chroot, but very much easier to deploy and maintain, is there a reason why this cannot be the case?

Well, I had not planned on the hard links in particular---this is where the fall through semantics seem to be correct. Suppose there are 1000 masks and a new file gets added are you planning to add 1000 links?

Quoted 14 lines
Quoted 7 lines

you can insert a search of the mask tree. If the search fails, then it is not excluded and the request falls through to normal VFS handling. In the /etc/passwd case above, it would find /etc/passwd and so the file is excluded. Processing would stop there, returning some error. How does this sound?

I don't quite understand this paragraph above.

Probably because I'm not on the same page as you and George.
Imagine a filesystem with two trees: one, the real
root filesystem and two, the anti-root tree (exclusions). This
fs would be the root fs for the process. Let's say fooprocess has the following exclusions:

Quoted 10 lines

/etc/passwd
/etc/shadow
/var

Above, when I said "insert a search of the mask tree" what I meant was
"first search the exception [semantic] tree (anti-tree) associated with this process. If you find the object there, then report it as NOT FOUND.
Otherwise, proceed with a normal fs tree search (fall-through). Basically,
a dynamic, per-process (er, per mask) hidden attribute. The modified VFS code to store the dentry of the root of the mask base dir, then use normal namei(), etc. path resolution interfaces to see if the file exists in the exception list? IOW, when fooprocess attempts to open /etc/passwd when fooprocess is under the above mask, the following happens: VFS identifies process as being undermask and so knows dentry of the base dir of the exception list (fooprocess/metas/mask). Before doing 'normal' handling, VFS treats this as a request to operate on fooprocess/metas/mask/etc/passwd. If VFS finds the filename, then NOT FOUND is returned. Otherwise, file processing proceeds normally.

This is closer to my understanding.

Quoted 10 lines
Quoted 10 lines

George:
To give a couple of examples:
1) A given process (say a restricted shell) can not exec() an executable with the set-uid bit on.
- directly
- indirectly (e.g., via bash)
2) Apache can only create/write files in /var/web/incoming.
- files created or modified can not have any execute bit set
and executing chmod is excluded.

Quoted 9 lines
Quoted 4 lines

Hans:
this protection happens while traversing the mask or at the fall through point. Hmmm, we need to accumulate a set of permissions that apply to something that are specific to how we got there. That could be complex in the VFS details. We can defer it to Phase II if necessary. George, you should spend a day (not this week) figuring out how much work it would be to make that work. It will be the details of it that will be dangerous....

I'll tackle scenario #2:
* Executing chmod would be excluded because it would not be visible in the mask.

Note that, at some point, one would like to disallow chmod() and
fchmod() in any
child process---but this is beyond the scope or the current project.

Quoted 9 lines

* "files created or modified can not have any execute bit set" Implicit in this statement is that, in addition to filtering object visibility, masks will preempt/proscribe certain fs operations -- in this case, the setting of certain attributes (i.e. exec bit). If this is correct then what can masks allow/prohibit WRT operations/attributes performed on objects. This is what I was trying to clarify with my earlier question.

Let us say that, as this example suggests, it would make the masking
more
powerful and more useful since allowing someone on the internee to
store data
on your disk is much less risky than allowing them to get a process
running
over which they have control.

That a viable and scalable implementation of this can be developed
is an open
question---currently ;-)