What policy is the system running?
We have been doing some work on sestatus and selinuxconfig type tools to be able to tell us about the current running system. We have a problem in that we can not tell which policy is currently running on the system (strict, targeted, mls, ...) It would be
usefull if there was a way to identify a name in policy. Then if there was a way to ask the kernel what name it has loaded. One possible way we have thought about doing this is by defining a boolean for each policy that would define the policytype. So we could define a policytype_targeted boolean in targeted policy and a policytype_strict boolean in strict policy. Then we could make scripts and programs smart enough to look for /selinux/booleans/policytype_* to determine it.
This is admittedly a hack but would solve our problem without having to modify the kernel. One potential problem with this is
that the policy writers could define two policytype_ booleans. Another problem is that there is no requirement to define a
boolean of this type.
Other ideas that have been discussed is modifying load_policy and init to write /var/run/policytype or some such, but init runs too early in the boot process to write to the local file system.
Adding a policyname type to policy, changin checkpolicy to require this field, and then modifying the kernel to provide this field in the selinux file system, would probably be the ultimate solution.
One other thing to think about; When we have loadable policymodules, it would be nice to identify which modules are currently loaded, via a similar mechanism.
Ideas???
Dan
--
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 1 line · Daniel J Walsh
Ideas???
We could do an md5 checksum of the binary policy as it is written to /selinuxfs/load then export this via /selinux/policy_md5sum.
This would allow you to determine which policy is loaded. Each binary policy module could be similarly checksummed.
- James
Signature · 10 lines
James Morris <[email protected]> -- 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
We could do an md5 checksum of the binary policy as it is written to /selinuxfs/load then export this via /selinux/policy_md5sum.
I'm not sure I like this approach...they may have just recompiled a policy (overwriting the one in memory) and have either no policy that matches or perhaps multiple policies that match.
-Steve Grubb
__________________________________
Do you Yahoo!?
Check out the new Yahoo! Front Page.
www.yahoo.com
--
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 6 lines · Steve G
Quoted 2 lines
We could do an md5 checksum of the binary policy as it is written to /selinuxfs/load then export this via /selinux/policy_md5sum.
I'm not sure I like this approach...they may have just recompiled a policy (overwriting the one in memory) and have either no policy that matches or perhaps multiple policies that match.
Agreed. The policyname approach alluded earlier would be more useful. Policy author gets to pick a name, version numbers etc, supplemented by automatic information about when/where compiled. This would convey the useful information for management. Working with a set of machines running various different policies under continuous development, I can testify this sort of feature would really be valued. I'd speculate this much would be easy to add to /selinux fs.
Steve H
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQFBiRVVPcFX9H2zuSkRAm/+AJ4w5273zTrHRYhIa8NJaneIGu8dbgCgjrhp s5NvovzYfUgTVV4GAah3F9c=
=BJPU
-----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 7 lines · Steve G
Quoted 2 lines
We could do an md5 checksum of the binary policy as it is written to /selinuxfs/load then export this via /selinux/policy_md5sum.
I'm not sure I like this approach...they may have just recompiled a policy (overwriting the one in memory) and have either no policy that matches or perhaps multiple policies that match.
This would be case for setting boolean states on policy load, correct?
Karl
Quoted 15 lines
-Steve Grubb
__________________________________
Do you Yahoo!?
Check out the new Yahoo! Front Page.
www.yahoo.com--
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.
Signature · 10 lines
Karl MacMillan Tresys Technology [email protected] http://www.tresys.com -- 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 2 lines
This would be case for setting boolean states on policy load, correct?
I made a typo in my reply..I meant overwrite what's on disk. Sorry.
-Steve Grubb
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
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 · Steve G
Quoted 1 line
This would be case for setting boolean states on policy load, correct?
I made a typo in my reply..I meant overwrite what's on disk. Sorry.
I think the in-memory modification of the policy for the boolean settings is the larger concern, as it means that the binary policy seen by the kernel may not match any file on disk, not even the one that was "loaded".
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.
James suggests that we have a table on disk that references the checksum to a name.
So we could get the checksum from the kernel and then look up the name to display to the user. Could have Makefile and rpm update the policy whenever it is modified.
Dan
--
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 7 lines · Daniel J Walsh
James suggests that we have a table on disk that references the checksum to a name.
So we could get the checksum from the kernel and then look up the name to display
to the user. Could haveMakefileand rpm update the policy whenever it is modified.
As I mentioned, I don't believe that this will work, because load_policy is "patching" the binary policy in-memory to set the boolean values to the locally configured settings prior to loading it into the kernel. Hence, any checksum computed by the kernel will not necessarily correspond to the checksum of any binary policy file, not even the one that was loaded. You would have to update your checksum mapping not only when the binary policy file was updated, but whenever a boolean setting was changed.
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.
Quoted 22 lines · Daniel J Walsh
We have been doing some work on sestatus and selinuxconfig type tools to be able to tell us about the current running system.
We have a problem in that we can not tell which policy is currently running on the system (strict, targeted, mls, ...) It would be usefull if there was a way to identify a name in policy. Then if there was a way to ask the kernel what name it has loaded.
One possible way we have thought about doing this is by defining a boolean for each policy that would define the policytype.
So we could define apolicytype_targetedboolean in targeted policy and apolicytype_strictboolean in strict policy.
Then we could make scripts and programs smart enough to look for /selinux/booleans/policytype_* to determine it.
This is admittedly a hack but would solve our problem without having to modify the kernel. One potential problem with this is
that the policy writers could define twopolicytype_booleans. Another problem is that there is no requirement to define a
boolean of this type.Other ideas that have been discussed is modifying
load_policyand init to write/var/run/policytypeor some such, but init runs too early in the boot process to write to the local file system.
Quoted 8 lines
Adding a policyname type to policy, changin checkpolicy to require this field, and then modifying the kernel to provide this field in the selinux file system, would probably be the ultimate solution.
One other thing to think about; When we have loadable policymodules, it would be nice to identify which modules are currently loaded, via a similar mechanism.
The policy modules have a name defined in the policy language (which is required). The "loaded" modules is a little harder. You can obtain a list of installed modules in a similar manner to rpm, but when they are loaded depends on when the kernel policy that has all of the modules linked together is loaded. The kernel has no notion of modules, which is nice because it required no changes to the kernel, but may present a problem for you in this case.
Karl
Quoted 8 lines
Ideas???
Dan
--
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.
Signature · 10 lines
Karl MacMillan Tresys Technology [email protected] http://www.tresys.com -- 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 4 lines · Daniel J Walsh
We have been doing some work on sestatus and selinuxconfig type tools to be able to tell us about the current running system. We have a problem in that we can not tell which policy is currently running on the system (strict, targeted, mls, ...)
Since I've been trying out the MLS stuff, I cooked up a patch for sestatus to display that the kernel is compiled with MLS. I also put it on the "disabled" output, for the case that someone accidentally compiles a MLS kernel, and wonders why their policy won't load.
Signature · 8 lines
Chris PeBenito <[email protected]> Developer, Hardened Gentoo Linux Embedded Gentoo Linux Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE6AF9243 Key fingerprint = B0E6 877A 883F A57A 8E6A CB00 BC8E E42D E6AF 9243
Index: sestatus.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/hardened/policycoreutils-extra/src/sestatus.c,v retrieving revision 1.21
sestatus.c +10 -2
@@ -201,10 +201,18 @@switch (rc) {case 1 : -printf ("enabled\n" ); +if (is_selinux_mls_enabled ()) +printf ("enabled, MLS\n" ); +else +printf ("enabled\n" ); +break ;case 0 : -printf ("disabled\n" ); +if (is_selinux_mls_enabled ()) +printf ("disabled, MLS\n" ); +else +printf ("disabled\n" ); +return 0 ;break ;default :