Re: [PATCH][RFC] Simple tamper-proof device filesystem.

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Tetsuo Handa <penguin-kernel@...>
Cc: <linux-fsdevel@...>, <linux-kernel@...>, <w@...>, <serue@...>
Date: Wednesday, January 9, 2008 - 9:59 am

Hello,

On Wed, January 9, 2008 05:39, Tetsuo Handa wrote:

So that you miss alternatives and don't see the bigger picture.


The person that would write the config file for your fs, the one who wants
that guarantee.


Good point, but I assume they all have at least a directory granularity, and then
/dev/ can be static and udev and other can have free reign in e.g. /dev/dynamic/.
Just use subdirs for the dynamic stuff and this granularity problem is, with
slight
inconvenience, solved.


Funny, I thought that it was in the kernel because that's the way to protect
processes against eachother, the fs against processes, and for performance
reasons.

Exploits are in code, and where that code is doesn't matter that much, either
kernel or userspace, though if it's exploitable you'll rather not have it in the
kernel. So I think it's more secure if the checking would be done by udev than
in a special filesystem, even if that means that you're screwed if udev is
exploited. Of course you fully trust your own code, naturally.

A tiny daemon that communicates with udev and does the checking you have
now, and if ok it creates the node is really not much more code than your fs,
so as hard to exploit too. Then if udev is hacked you have the same guarantee
as you have now.

I can think of more alternatives that are as secure or more secure than the
current solution.


Yes, I should've read the code before asking that, instead of the other way
round.


Protecting certain files from being modified seems to me more generic than
enforcing filename/attributes pairs on device nodes. And if they can't do it
surely they can do it per directory, and the using subdirs solves it.


This is one solution. The other is to protect the files you want to guaruante
with
MAC and then all apps can do whatever they want, not only udev, except for
breaking the guaranteed filename/attributes pairs. And if that can't happen
within dev on a per filename base, then it can happen per directory, and apps
may create only nodes in certain subdirs of /dev/, instead of /dev/ itself.

And those other programs could be taught to create the nodes via udev who
does the checking, or they all modify a /dyndev/ and a daemon who does the
checking copies nodes over to the real /dev/ when it's sane. There are plenty
of ways to solve those details.

rm -f /dev/either-null-or-zero

as said before, if this is possible then the MAC config used is wrong. Exactly
the same as for your filesystem with

mknod /dev/tmp1 c 1 X
mount --bind /dev/tmp1 /dev/either-null-or-zero

and you count on the MAC to prevent that.

And as for that app, if you trust it to create device nodes, why don't you
trust it
to make the right nodes too? If an administrator wants something else than
3 or 5, you're breaking something. The worst is that as it's an administrator
app it's made for policy handling, but you just moved that to somewhere else,
basically making the app useless and spreading around config stuff.

This app is unrealistic anyway. The standard way to choose between /dev/null
and /dev/zero is to open one instead of the other, instead of changing the
content.
The interface is also crap because if the choice is really between null and
zero, the
argument shouldn't be a cryptic number but the choice. And then it are two if
checks with fixed mknod commands. If you trust this script you get what you
deserve when something else is passed than 3 or 5, because it's obvious that
that's
possible.


See above. But who says that the MAC used can provide the additional protection
that's needed to make your fs work at all?


More, because your filesystem doesn't guarantee anything at all on its own.
But assuming the MAC is decent enough to protect your fs from being bypassed,
I'm sure it can do what's needed fine without your fs. I can't answer for SELinux
because I don't know it well. But I trust it can protect files and/or
directories, and
that's all that's needed to achieve the same end result.


I hope the MAC can do it. If not, I hope it can protect /dev/ and all
modifications need to be done in subdirs of dev, which practically
already happens anyway. And if the MAC can't even do that, I think
it's a useless piece of junk.


You seem to assume that the in-kernel implementation is suddenly
guaranteed bugfree. And the alternative above doesn't require any
source code except of udev, which is available. And it doesn't need to
be more bugfree than your current code either.

You didn't answer my question why the checking isn't done globally
if it's so important.

Greetings,

Indan


-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH][RFC] Simple tamper-proof device filesystem., Tetsuo Handa, (Sun Jan 6, 2:20 am)
Re: [PATCH][RFC] Simple tamper-proof device filesystem., Willy Tarreau, (Sun Jan 6, 2:26 am)
Re: [PATCH][RFC] Simple tamper-proof device filesystem., Tetsuo Handa, (Sun Jan 6, 11:20 am)
Re: [PATCH][RFC] Simple tamper-proof device filesystem., Indan Zupancic, (Mon Jan 7, 4:37 pm)
Re: [PATCH][RFC] Simple tamper-proof device filesystem., Indan Zupancic, (Tue Jan 8, 11:47 am)
Re: [PATCH][RFC] Simple tamper-proof device filesystem., Tetsuo Handa, (Wed Jan 9, 12:39 am)
Re: [PATCH][RFC] Simple tamper-proof device filesystem., Indan Zupancic, (Wed Jan 9, 9:59 am)
Re: [PATCH][RFC] Simple tamper-proof device filesystem., Tetsuo Handa, (Thu Jan 10, 12:57 am)
Re: [PATCH][RFC] Simple tamper-proof device filesystem., Indan Zupancic, (Thu Jan 10, 7:05 pm)
Re: [PATCH][RFC] Simple tamper-proof device filesystem., Tetsuo Handa, (Fri Jan 11, 4:46 am)
Re: [PATCH][RFC] Simple tamper-proof device filesystem., Indan Zupancic, (Fri Jan 11, 8:22 am)
Re: [PATCH][RFC] Simple tamper-proof device filesystem., Tetsuo Handa, (Fri Jan 11, 10:05 am)
Re: [PATCH][RFC] Simple tamper-proof device filesystem., Lennart Sorensen, (Fri Jan 11, 10:46 am)
Re: [PATCH][RFC] Simple tamper-proof device filesystem., Serge E. Hallyn, (Wed Jan 9, 7:08 pm)
Re: [PATCH][RFC] Simple tamper-proof device filesystem., Indan Zupancic, (Wed Jan 9, 9:06 pm)
Re: [PATCH][RFC] Simple tamper-proof device filesystem., Willy Tarreau, (Sun Jan 6, 3:45 am)