Skip to contentSkip to conversation

New version of Targeted Reference policy is available to play with.

DISCUSSION Daniel J Walsh 2 participants 6 messages Nov 10, 2005 SELinux security module

lore
Share & tools
lore
#0 lore raw

ftp://people.redhat.com/dwalsh/SELinux/refpolicy/selinux-policy-2.0.0-0.3.src.rpm

Signature · 4 lines
--
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.
#1 lore raw
Quoted 1 line · Daniel J Walsh

ftp://people.redhat.com/dwalsh/SELinux/refpolicy/selinux-policy-2.0.0-0.3.src.rpm

Caveat: I tried updating to this policy from the current rawhide targeted policy, and while it appeared to do the right things (modulo some relabeling, see my other posting for the log file), when it finished, rpm seems to have removed the generated policy files (policy.20, file_contexts, seusers) that are now managed via libsemanage. Thus, a reboot immediately fails with no policy.

I think that what is happening is that rpm sees that these files _were_ owned by the previous targeted policy package and are no longer provided by this new policy package (since they are now generated via libsemanage), so rpm cheerfully deletes them as no longer being needed. Can we suppress that removal in some way?

Signature · 8 lines
Stephen Smalley
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.
#2 lore raw
Quoted 10 lines · Stephen Smalley
Quoted 1 line · Daniel J Walsh

ftp://people.redhat.com/dwalsh/SELinux/refpolicy/selinux-policy-2.0.0-0.3.src.rpm

Caveat: I tried updating to this policy from the current rawhide targeted policy, and while it appeared to do the right things (modulo some relabeling, see my other posting for the log file), when it finished, rpm seems to have removed the generated policy files (policy.20, file_contexts, seusers) that are now managed via libsemanage. Thus, a reboot immediately fails with no policy.

Quoted 5 lines

I think that what is happening is that rpm sees that these files _were_ owned by the previous targeted policy package and are no longer provided by this new policy package (since they are now generated via libsemanage), so rpm cheerfully deletes them as no longer being needed. Can we suppress that removal in some way?

Hmmm...so I tried regenerating the generated files from the sandbox via semodule -B, but I get the following:
Committing changes:
libsemanage.parse_assert_space: missing whitespace (/etc/selinux/targeted/modules/tmp/seusers: 1):
root:root:s0-s0:c0.c255
libsemanage.seuser_parse: could not parse seuser record libsemanage.dbase_file_cache: could not cache file database libsemanage.enter_ro: could not enter read-only section libsemanage.semanage_commit_components: could not commit local modifications
Failed!

This is with the stock seusers file from the targeted policy that was copied into the sandbox by the %post script.

Signature · 8 lines
Stephen Smalley
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.
#3 lore raw
Quoted 13 lines · Stephen Smalley

Hmmm...so I tried regenerating the generated files from the sandbox via semodule -B, but I get the following:
Committing changes:
libsemanage.parse_assert_space: missing whitespace (/etc/selinux/targeted/modules/tmp/seusers: 1):
root:root:s0-s0:c0.c255
libsemanage.seuser_parse: could not parse seuser record libsemanage.dbase_file_cache: could not cache file database libsemanage.enter_ro: could not enter read-only section libsemanage.semanage_commit_components: could not commit local modifications
Failed!

Quoted 2 lines

This is with the stock seusers file from the targeted policy that was copied into the sandbox by the %post script.

Ok, I see what is happening in the code. It checks is_selinux_mls_enabled() to decide whether to expect the MLS range field, and since SELinux is now disabled on this system (due to reboot w/o an installed policy), that returns false.

Signature · 8 lines
Stephen Smalley
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.
#4 lore raw
Quoted 4 lines · Stephen Smalley

Ok, I see what is happening in the code. It checks is_selinux_mls_enabled() to decide whether to expect the MLS range field, and since SELinux is now disabled on this system (due to reboot w/o an installed policy), that returns false.

This raises the general question of the extent to which semanage needs to work when SELinux is disabled or is enabled but running a very different policy from the policy being managed for bootstrapping and upgrading or conversion purposes. It already supports specifying the store and disabling reloads, so that provides much of the necessary flexibility. Possibly src/seusers_file.c and src/users_file.c should be using the MLS enabled status of the base policy rather than the current system MLS enabled status.

Signature · 8 lines
Stephen Smalley
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.
#5 lore raw
In reply to Daniel J Walsh

ftp://people.redhat.com/dwalsh/SELinux/refpolicy/selinux-policy-2.0.0-0.4.src.rpm

This fixes the spec file to leave the policy.20 file.

Signature · 4 lines
--
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.