initial load_policy problem
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
How long after the policy load is /dev/console supposed to become console_device_t? immediately after policy load the label of /dev/console is system_u:system_r:kernel_t. I tried to sleep init for 5 and 30 seconds before spawning the init scripts the console is still kernel_t. And if i check the console label using getfattr its console_device_t. I cant boot at all in enforcing mode because no matter what i do the /dev node labels are all kernel_t. the scripts are being run as system_u:system_r:initrc_t.
this is the first avc denied message after the initializations by simpleinit is finished.
avc: denied { use } for pid=18 exe=/bin/bash path=/dev/console dev=hda16 ino=17895218 scontext=system_u:system_r:initrc_t tcontext=system_u:system_r:kernel_t tclass=fd
im using a modified load_policy as init to load the policy file and exec /sbin/simpleinit. thats the init from util-linux-2.12. looking at the sysvinit_patches its essentially the same. both files are labeled system_u:object_r:init_exec_t. sould i setfilecon the console device before i exec simpleinit? -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using the GPG bundle for GNUMail.app
iD8DBQFAdnziyihxuQOYt8wRAp64AJ0Xnd7spN8sjal2ct3CwmwBtjf42gCfc4V5 cue9+7XoNXfXIznfwNuvUy0=
=T95p
-----END PGP SIGNATURE-----
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 17 lines · On 2004-04-09 18:37:23 +0800 Rogelio Serrano <[email protected]> wrote:
How long after the policy load is
/dev/consolesupposed to becomeconsole_device_t? immediately after policy load the label of/dev/consoleis system_u:system_r:kernel_t. I tried to sleep init for 5 and 30 seconds before spawning the init scripts the console is stillkernel_t. And if i check the console label using getfattr itsconsole_device_t. I cant boot at all in enforcing mode because no matter what i do the /dev node labels are allkernel_t. the scripts are being run as system_u:system_r:initrc_t.this is the first avc denied message after the initializations by simpleinit is finished.
avc: denied { use } for pid=18 exe=/bin/bash path=/dev/console dev=hda16 ino=17895218 scontext=system_u:system_r:initrc_t tcontext=system_u:system_r:kernel_t tclass=fd
Quoted 6 lines
im using a modified
load_policyas init to load the policy file and exec/sbin/simpleinit. thats the init from util-linux-2.12. looking at thesysvinit_patchesits essentially the same. both files are labeled system_u:object_r:init_exec_t. sould i setfilecon the console device before i exec simpleinit?
Sorry about that. It was inits fault. It did not close the old pre initial policy load console before forking off the boot scripts. a thorough audit of the programs are all thats needed. The default policy is ok. The prgrams im using are all different versions from the nsa download page. all in all i need to audit bash, mount, dmesg, busybox and udev. -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using the GPG bundle for GNUMail.app
iD8DBQFAdpLGyihxuQOYt8wRAhkWAKCW4mXm5F8ewvKuRr4p7gW/WgOvRwCfQZ2K Vzan0B3I6a1CiyCXcHu+gEo=
=wGcw
-----END PGP SIGNATURE-----
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 3 lines · Rogelio Serrano
How long after the policy load is
/dev/consolesupposed to becomeconsole_device_t? immediately after policy load the label of/dev/consoleis system_u:system_r:kernel_t.
No it isn't. The label of the open file description is kernel_t, since it was opened by a kernel thread, but the label of the device inode is console_device_t. Remember that SELinux labels and controls open file descriptions (the state referenced by a file descriptor) as well as files themselves, because they can be shared among processes. The open file descriptions are labeled based on the process that performed the open, so when an initial kernel thread opens /dev/console, the open file is labeled kernel_t.
Quoted 3 lines
avc: denied { use } for pid=18 exe=/bin/bash path=/dev/console dev=hda16 ino=17895218 scontext=system_u:system_r:initrc_t tcontext=system_u:system_r:kernel_t tclass=fd
Look closely at the above avc message. The tclass is "fd" (file descriptor, or more accurately, open file description); the permission is "use". The question is whether initrc_t should be inheriting this descriptor, not whether it can access /dev/console (the latter is also checked, but is likely allowed).
Signature · 8 lines
Stephen Smalley <[email protected]> National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 18 lines · On 2004-04-09 20:19:30 +0800 Stephen Smalley <[email protected]> wrote:
Quoted 3 lines · Rogelio Serrano
How long after the policy load is
/dev/consolesupposed to becomeconsole_device_t? immediately after policy load the label of/dev/consoleis system_u:system_r:kernel_t.No it isn't. The label of the open file description is
kernel_t, since it was opened by a kernel thread, but the label of the device inode isconsole_device_t. Remember that SELinux labels and controls open file descriptions (the state referenced by a file descriptor) as well as files themselves, because they can be shared among processes. The open file descriptions are labeled based on the process that performed the open, so when an initial kernel thread opens/dev/console, the open file is labeledkernel_t.Quoted 3 lines
avc: denied { use } for pid=18 exe=/bin/bash path=/dev/console dev=hda16 ino=17895218 scontext=system_u:system_r:initrc_t tcontext=system_u:system_r:kernel_t tclass=fd
Quoted 6 lines
Look closely at the above avc message. The tclass is "fd" (file descriptor, or more accurately, open file description); the permission is "use". The question is whether
initrc_tshould be inheriting this descriptor, not whether it can access/dev/console(the latter is also checked, but is likely allowed).
I understand. Im going to audit all the boot programs. At least all the programs called by the init scripts. I will try to avoid adding permissions to the default policy. Thanks. -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using the GPG bundle for GNUMail.app
iD8DBQFAdpWayihxuQOYt8wRAiNPAJ9lxgiva7kpDog/U907vHEhUn/QhQCgsHGL jPVspP8stzd+iENG0EEDXf8=
=md83
-----END PGP SIGNATURE-----
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.