From: Luke Kenneth Casson Leighton <lkcl@lkcl.net>
To: Nigel Kukard <nkukard@lbsd.net>
Cc: linux-hotplug-devel@lists.sourceforge.net,
SELinux <SELinux@tycho.nsa.gov>,
"Fedora SELinux support list for users & developers."
<fedora-selinux-list@redhat.com>,
harald@redhat.com, Bill Nottingham <notting@redhat.com>
Subject: Re: [idea] udev + selinux
Date: Tue, 31 Aug 2004 12:46:13 +0000 [thread overview]
Message-ID: <20040831124613.GF11456@lkcl.net> (raw)
In-Reply-To: <20040831102715.GJ10151@lbsd.net>
On Tue, Aug 31, 2004 at 12:27:15PM +0200, Nigel Kukard wrote:
> > > and modified udev to set the correct
> > > context of its root_path on startup.
> >
> > mount -o fscontext=system_u:object_r:device_t yes?
> >
>
> nope.... mount -t ramfs none /dev
>
> then run udevstart (udevstart does the C call to restorecon on
> root_path, so it ends up being labeled with whatever is configured)
oh, does it?
oh!
> > did you patch selinux/hooks.c to relax the constraints on
> > the fscontext= parameter to allow the correct context to be
> > correctly applied? :)
> >
>
> correct, not sure if this is the 100% right way to do it though, I think
> it would be better for the capabilities of the fs to be set properly
> instead of commenting out code, this will have better chance being
> included mainstream.
>
well if someone wants to write a new patch to hooks.c and invent
a new mount -o option oh i dunno overridecontext=.... then sure.
it's all the same to me.
> > > >
> > > > so, not only must udev be patched to restore contexts but also
> > > > the policies and various hacks added to "cope" with /dev being
> > > > incredibly basic at startup - prior to udev running.
> > >
> > > i have a simple persistent /dev which is used before udev runs, udev is
> > > then initialized, mounts a tmpfs over /dev (and restores its context)
> >
> > oh. ah.... you _restore_ its context (i.e. run restorecon
> > /dev), you don't mount it with the modified mount -o fscontext> > parameter?
>
> correct!, it does the restore in udevstart
ok.
my question is: is this desirable behaviour?
> > > Seeing as my initial /dev is on a persistent
> > > filesystem i don't have a problem with pre-udev stuff running.
> >
> > well.... you shouldn't... until you reinitialise or somehow delete,
> > upgrade or otherwise modify the "old" /dev [which you will find is
> > remounted --rbind to /.dev].
>
> got no reason to add other entries to the pre-udev /dev, so as I said
> ItWorksForMe(tm).
>
> >
> > try it: do setfiles /etc/selinux/src/file_contexts/file_contexts /.dev
> > and then reboot [in permissive mode!!!]
> >
> > due to the present files/types.fc, you will find that the entire
> > /.dev gets relabelled to something completely useless: root_t
> > or default_t. i think it's default_t.
>
> yep, i'm 100% aware of this... i don't need /.dev, nor do I have it, nor
> do I want it ... heh, on installation of our distribution the pre-udev
> /dev is created and labeled correctly.
... how?
and can you guarantee that it will _stay_ labelled correctly?
> >
> > consequently your next reboot in enforcing mode will fail because
> > /sbin/init tries to access /dev/null and /dev/initctl etc. as
> > default_t ... and it can't.
> >
>
> yep, but as I said... i don't label pre-udev /dev when udev is running,
> before I added it to our distro installer I mounted /dev/hda1 (root) as
> /mnt/hda1, chroot'd onto it and re-labeled the files there (basically
> the same thing our installer does)
that's cheating :)
> > the list i have so far in /etc/modules.postudev contains (for my purposes):
> >
> > ppp_generic
> > nvidia
> > sg
> >
>
> no probs with any of these either (and yes we do use them), the pc i'm
> on runs dual-head nvidia ;-)
bizarre.
how do you deal with that?
perhaps an answer would be best off-selinux list because it's not
entirely relevant to selinux, more the use of it.
> every distro is different, so i would expect some to gulp bubbles and
> some not to... *shrug*
>
> > i don't believe that these modules should be loaded prior to udev
> > being run: maybe they can, maybe they can't, maybe the nodes being
> > loaded prior will result in a pending hotplug event such that when
> > udev is run, the node gets created.
>
> we load them after udev, and everything ends up labeled correctly...
>
> for instance...
>
> ot@localhost.localdomain policy]# ls -Z /dev/ppp
> ls: /dev/ppp: No such file or directory
> [root@localhost.localdomain policy]# modprobe ppp_generic
^^^^^^^^^^^^^^^^^^^^
this is the bit that my /etc/init.d/modutils.postudev initscript
does for me: i'd be interested to know if you do something similar.
i can't be telling users to do _that_ they're unlikely
even know what a ppp is, that a modprobe is something to do
with police investigations in the 70s into the sex pistols,
and if you mentioned xterm they'd call rentakill.
> [root@localhost.localdomain policy]# ls -Z /dev/ppp
> crw------- root root system_u:object_r:ppp_device_t /dev/ppp
> [root@localhost.localdomain policy]#
yes, this i'd expect to happen... _if_ the modprobe ppp_generic command
is ever issued [and users shouldn't be expected to do it!]
> > perhaps there should be a "hook" into tmpfs to be able to pass
> > filenames accessed in /dev on to udev, such that udev can go
> > "oo, they tried to access /dev/ppp, let's kick off that module,
> > then".
>
> if you need any of my initscripts or anything, give me a shout, i've
> nearly got a 100% functional selinux enabled server! ;-)
if you could place them on a convenient http-accessible server
somewhere near you, that'd be great.
l.
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_idP47&alloc_id\x10808&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
WARNING: multiple messages have this Message-ID (diff)
From: Luke Kenneth Casson Leighton <lkcl@lkcl.net>
To: Nigel Kukard <nkukard@lbsd.net>
Cc: linux-hotplug-devel@lists.sourceforge.net,
SELinux <SELinux@tycho.nsa.gov>,
"Fedora SELinux support list for users & developers."
<fedora-selinux-list@redhat.com>,
harald@redhat.com, Bill Nottingham <notting@redhat.com>
Subject: Re: [idea] udev + selinux
Date: Tue, 31 Aug 2004 13:46:13 +0100 [thread overview]
Message-ID: <20040831124613.GF11456@lkcl.net> (raw)
In-Reply-To: <20040831102715.GJ10151@lbsd.net>
On Tue, Aug 31, 2004 at 12:27:15PM +0200, Nigel Kukard wrote:
> > > and modified udev to set the correct
> > > context of its root_path on startup.
> >
> > mount -o fscontext=system_u:object_r:device_t yes?
> >
>
> nope.... mount -t ramfs none /dev
>
> then run udevstart (udevstart does the C call to restorecon on
> root_path, so it ends up being labeled with whatever is configured)
oh, does it?
oh!
> > did you patch selinux/hooks.c to relax the constraints on
> > the fscontext= parameter to allow the correct context to be
> > correctly applied? :)
> >
>
> correct, not sure if this is the 100% right way to do it though, I think
> it would be better for the capabilities of the fs to be set properly
> instead of commenting out code, this will have better chance being
> included mainstream.
>
well if someone wants to write a new patch to hooks.c and invent
a new mount -o option oh i dunno overridecontext=.... then sure.
it's all the same to me.
> > > >
> > > > so, not only must udev be patched to restore contexts but also
> > > > the policies and various hacks added to "cope" with /dev being
> > > > incredibly basic at startup - prior to udev running.
> > >
> > > i have a simple persistent /dev which is used before udev runs, udev is
> > > then initialized, mounts a tmpfs over /dev (and restores its context)
> >
> > oh. ah.... you _restore_ its context (i.e. run restorecon
> > /dev), you don't mount it with the modified mount -o fscontext=
> > parameter?
>
> correct!, it does the restore in udevstart
ok.
my question is: is this desirable behaviour?
> > > Seeing as my initial /dev is on a persistent
> > > filesystem i don't have a problem with pre-udev stuff running.
> >
> > well.... you shouldn't... until you reinitialise or somehow delete,
> > upgrade or otherwise modify the "old" /dev [which you will find is
> > remounted --rbind to /.dev].
>
> got no reason to add other entries to the pre-udev /dev, so as I said
> ItWorksForMe(tm).
>
> >
> > try it: do setfiles /etc/selinux/src/file_contexts/file_contexts /.dev
> > and then reboot [in permissive mode!!!]
> >
> > due to the present files/types.fc, you will find that the entire
> > /.dev gets relabelled to something completely useless: root_t
> > or default_t. i think it's default_t.
>
> yep, i'm 100% aware of this... i don't need /.dev, nor do I have it, nor
> do I want it ... heh, on installation of our distribution the pre-udev
> /dev is created and labeled correctly.
... how?
and can you guarantee that it will _stay_ labelled correctly?
> >
> > consequently your next reboot in enforcing mode will fail because
> > /sbin/init tries to access /dev/null and /dev/initctl etc. as
> > default_t ... and it can't.
> >
>
> yep, but as I said... i don't label pre-udev /dev when udev is running,
> before I added it to our distro installer I mounted /dev/hda1 (root) as
> /mnt/hda1, chroot'd onto it and re-labeled the files there (basically
> the same thing our installer does)
that's cheating :)
> > the list i have so far in /etc/modules.postudev contains (for my purposes):
> >
> > ppp_generic
> > nvidia
> > sg
> >
>
> no probs with any of these either (and yes we do use them), the pc i'm
> on runs dual-head nvidia ;-)
bizarre.
how do you deal with that?
perhaps an answer would be best off-selinux list because it's not
entirely relevant to selinux, more the use of it.
> every distro is different, so i would expect some to gulp bubbles and
> some not to... *shrug*
>
> > i don't believe that these modules should be loaded prior to udev
> > being run: maybe they can, maybe they can't, maybe the nodes being
> > loaded prior will result in a pending hotplug event such that when
> > udev is run, the node gets created.
>
> we load them after udev, and everything ends up labeled correctly...
>
> for instance...
>
> ot@localhost.localdomain policy]# ls -Z /dev/ppp
> ls: /dev/ppp: No such file or directory
> [root@localhost.localdomain policy]# modprobe ppp_generic
^^^^^^^^^^^^^^^^^^^^
this is the bit that my /etc/init.d/modutils.postudev initscript
does for me: i'd be interested to know if you do something similar.
i can't be telling users to do _that_ they're unlikely
even know what a ppp is, that a modprobe is something to do
with police investigations in the 70s into the sex pistols,
and if you mentioned xterm they'd call rentakill.
> [root@localhost.localdomain policy]# ls -Z /dev/ppp
> crw------- root root system_u:object_r:ppp_device_t /dev/ppp
> [root@localhost.localdomain policy]#
yes, this i'd expect to happen... _if_ the modprobe ppp_generic command
is ever issued [and users shouldn't be expected to do it!]
> > perhaps there should be a "hook" into tmpfs to be able to pass
> > filenames accessed in /dev on to udev, such that udev can go
> > "oo, they tried to access /dev/ppp, let's kick off that module,
> > then".
>
> if you need any of my initscripts or anything, give me a shout, i've
> nearly got a 100% functional selinux enabled server! ;-)
if you could place them on a convenient http-accessible server
somewhere near you, that'd be great.
l.
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
next prev parent reply other threads:[~2004-08-31 12:46 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-30 17:37 [idea] udev + selinux Nigel Kukard
2004-08-30 17:37 ` Nigel Kukard
2004-08-30 20:31 ` Luke Kenneth Casson Leighton
2004-08-30 20:31 ` Luke Kenneth Casson Leighton
2004-08-31 5:02 ` Nigel Kukard
2004-08-31 5:02 ` Nigel Kukard
2004-08-31 9:49 ` Luke Kenneth Casson Leighton
2004-08-31 9:49 ` Luke Kenneth Casson Leighton
2004-08-31 10:27 ` Nigel Kukard
2004-08-31 10:27 ` Nigel Kukard
2004-08-31 12:46 ` Luke Kenneth Casson Leighton [this message]
2004-08-31 12:46 ` Luke Kenneth Casson Leighton
2004-08-31 11:26 ` Luke Kenneth Casson Leighton
2004-08-31 11:26 ` Luke Kenneth Casson Leighton
2004-08-31 16:07 ` Luke Kenneth Casson Leighton
2004-08-31 16:07 ` Luke Kenneth Casson Leighton
2004-08-31 16:46 ` Nigel Kukard
2004-08-31 16:46 ` Nigel Kukard
2004-08-31 19:18 ` Luke Kenneth Casson Leighton
2004-08-31 19:18 ` Luke Kenneth Casson Leighton
2004-08-31 19:26 ` Stephen Smalley
2004-08-31 19:26 ` Stephen Smalley
2004-08-31 20:02 ` Luke Kenneth Casson Leighton
2004-08-31 20:02 ` Luke Kenneth Casson Leighton
2004-08-31 21:18 ` Jim McCullough
2004-08-31 21:18 ` Jim McCullough
2004-08-31 23:26 ` Luke Kenneth Casson Leighton
2004-08-31 23:26 ` Luke Kenneth Casson Leighton
2004-08-31 22:44 ` [OT] SELinux vs. other systems [was Re: [idea] udev + selinux] Linas Vepstas
2004-09-01 14:23 ` Richard Troth
2004-09-01 14:23 ` Richard Troth
2004-09-01 14:29 ` Colin Walters
2004-09-01 17:25 ` Linas Vepstas
2004-09-02 16:10 ` Stephen Smalley
2004-09-02 16:10 ` Stephen Smalley
2004-09-02 17:29 ` Lomac questions [was Re: [OT] SELinux vs. other systems] Linas Vepstas
2004-09-02 17:29 ` Linas Vepstas
2004-09-02 20:05 ` Luke Kenneth Casson Leighton
2004-09-02 20:05 ` Luke Kenneth Casson Leighton
2004-09-02 12:15 ` [OT] SELinux vs. other systems [was Re: [idea] udev + selinux] Russell Coker
2004-09-02 17:07 ` Linas Vepstas
2004-09-04 8:49 ` Russell Coker
2004-09-02 17:19 ` Luke Kenneth Casson Leighton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040831124613.GF11456@lkcl.net \
--to=lkcl@lkcl.net \
--cc=SELinux@tycho.nsa.gov \
--cc=fedora-selinux-list@redhat.com \
--cc=harald@redhat.com \
--cc=linux-hotplug-devel@lists.sourceforge.net \
--cc=nkukard@lbsd.net \
--cc=notting@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.