Source Policy, CIL, and High Level Languages
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:
- Change how semanage_set_root was re-added to use the source policy infrastructure. Fixes were made so that semanage.conf was looked for inside the root. Also adds an semanage_root() function to get the current root.
- In previous patchsets, the semanage_module_upgrade* and semanage_module_install_base* functions were removed from the API, and semanage_module_install* had modified parameters. However, these changes broke the API and ABI. To maintain ABI compatibility, we've now added symbolic versioning to support the old version of the functions, which now just call the new install functions. semodule is updated to support --base and --upgrade, but with the addition of a deprecation message. API compatability is not maintained.
- Likewise, symbolic versioning was added to support the old module enable/disable functions, which call the new enable/disable functions.
- Modify the libsepol Makefile to now make including CIL optional via the DISABLE_CIL build flag. This only affects libsepol (not libsemanage), primarily so that SE for Android does not need to include unused CIL cruft.
With these changes, ABI compatibility is maintained. Additionally, we have tested these changes with the userspace tests and against the kernel test suite, and no new failures were discovered. We have also tested this patchset with both Fedora 20 policy and with reference policy and found no errors.
Because of the size of the patchset (67 file changes, ~8300 insertions, ~1800 deletions), all the changes have been pushed to the selinux git repository to the 'integration' branch for comments/review. Unlike the previous RFCs, for simplicity there is now only a single branch, containing three types of changes:
Reverts
Reverts changes made to master that conflict with the new source policy infrastructure (e.g. how paths are handled, enabled/disable modules). Rather than dealing with a large amount of conflicts with the source policy work, it was easier to just remove the commits that added conflicting features, rebase the old source policy work on top of that, and add back any features in a manner consistent with source policy. The only conflicts were related to enabling/disabling of modules, and semanage_set_root.
Source Policy
This is a rebase of the old src-policy branch on top of the reverted commits. The goal of these changes is to improve the API for module handling, add support for source policies, module priorities, enabling/disabling of modules, and moving the policy store from /etc/selinux/<store>/ to /var/lib/selinux/<store>/.
CIL Integration
These changes build CIL into libsepol, and updates libsepol, libsemanage, semodule, and semanage to work with and understand CIL files and manage /var/lib/selinux and /etc/selinux. Switching to CIL has a few side effects, such as removing base modules, versions, and upgrades.
This also adds a new tool (installed to /usr/libexec/selinux/hll/pp), which is an HLL compiler that converts binary pp modules to CIL. The infrastructure to use this compiler (or any other HLL compiler) was added to compile HLL modules to CIL, which is accomplished by writing the HLL data to the stdin of the compiler and reading the equivilent CIL from stdout. The resulting CIL is then cached in the policy store so this compilation does not need to take place during future store updates. Cached CIL modules can be ignored using a new semodule flag (-C/--ignore-cache) or a new configuration option in semanage.conf (ignore-cache). Other configuration options were added to semanage.conf to manage the path to HLL compilers (compiler-directory) and the policy store (store-root). Semodule was also modified to support changing the policy store with the -S/--store-root option.
Lastly, the CIL integration changes required changes to the API, but symbolic versioning was used to maintain ABI compatibility. Because of this, the .so version is no longer incremented like in the previous version of this RFC.
With these changes, it is possible to build and manage SELinux policy using pp and CIL modules and the familiar semodule/semanage tools.
To make this easier to experiment with and test, below are the steps needed to install the updated userspace and migrate a minimal Fedora 20 installation to the new policy store.
Thanks, and we look forward to any questions/comments.
- Steve
[1] http://marc.info/?l=selinux&m=138921403805934&w=2
[2] https://github.com/SELinuxProject/cil/wiki
[3] http://marc.info/?l=selinux&m=139878606630921&w=2
Steps to Install SELinux Userspace with source policy, CIL, and HLL
# Start with a fresh Fedora 20-x86_64 Mimimal Installation
# Install SELinux userspace dependencies
$ yum install audit-libs-devel bison bzip2-devel dbus-devel dbus-glib-devel flex flex-static gcc git glib2-devel libcap-ng-devel libcgroup-devel libsepol-static pcre-devel python-devel python-IPy setools-devel swig ustr-devel
# Update to the latest targeted policy
$ yum update selinux-policy-targeted
# Clone the repos and checkout branches
$ git clone -b integration https://github.com/SELinuxProject/selinux.git $ git clone -b master https://github.com/SELinuxProject/cil.git
# Create a symlink to the cil repo so CIL can be built into libsepol
$ ln -s ~/cil/ selinux/libsepol/cil
# Install SELinux userspace with CIL integration and HLL support
$ make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap
# Migrate to the new source policy infrastructure
$ ./selinux/libsemanage/utils/semanage_migrate_etc_to_var.py
# List the installed modules, showing priority and HLL
$ semodule --list=full
Quoted 6 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:
<snip>
I just spent a few hours playing with this and i am impressed.
Everything i tested just works.
What did i test?
1. disabling/enabling existing modules
2. toggling booleans with semanage
3. adding and removing port and file contexts with semanage
4. adding/removing a policy module with semodule, checkmodule, semodule_package
5. adding/removing a (cil) policy module with semodule
6. associating a (new) user with staff_t identity
Comments?
if i do restorecon -R -v -F /home it resets contexts *every* time (from s0 to s0-s0). No noticable side effects because of this
After associating user john with staff_u, johns home directory is properly labeled (staff_u associated with /home/john). However, what is strange here is that i cannot see staff_u home dir context specs in /var/lib/selinux/targeted/active/modules/file_contexts.homedirs
Am i looking in the wrong place? How does SELinux know that staff_u needs to be associated with /home/john
When you remove a custom module (semodule -r mycustmodule) semodule is a little verbose. (one line gets printed)
Other than that it looks flawless. Ofcourse i only tested it for a few hours but on the surface everything looks ok
I recorded the whole testing session for reference and submitted the video to youtube under the name of cil testday
Thanks
Quoted 24 lines · Dominick Grift
Quoted 6 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:<snip>
I just spent a few hours playing with this and i am impressed.
Everything i tested just works.
What did i test?
1. disabling/enabling existing modules
2. toggling booleans with semanage
3. adding and removing port and file contexts with semanage
4. adding/removing a policy module with semodule, checkmodule,semodule_package
5. adding/removing a (cil) policy module with semodule
6. associating a (new) user withstaff_tidentity
Quoted 4 lines
Comments?
if i do restorecon -R -v -F /home it resets contexts *every* time (from s0 to s0-s0). No noticable side effects because of this
I think this is related to how right now when generated file contexts, CIL doesn't remove the high level if it is the same as the low level. We just always include both levels separated by a hyphen. Shouldn't be too hard to fix.
We'll fix it in CIL, though, this might also be considered a bug in restorecon. It appears it doesn't doesn't realize that the u:r:t:s0 is the same as u:r:t:s0-s0, so it relabels the file. And then when it does relabel, the duplicate level isn't included.
Quoted 7 lines
After associating user john with
staff_u, johns home directory is properly labeled (staff_uassociated with/home/john). However, what is strange here is that i cannot seestaff_uhome dir context specs in/var/lib/selinux/targeted/active/modules/file_contexts.homedirsAm i looking in the wrong place? How does SELinux know that
staff_uneeds to be associated with/home/john
Interesting. Looking into this now.
Quoted 2 lines
When you remove a custom module (semodule -r mycustmodule) semodule is a little verbose. (one line gets printed)
The source policy work added a bit more logging output. This message is kindof helpful in that it lets you know that a module with a lower priority hasn't become active, and that this module is completely gone. But perhaps that is assumed, and we should only output messages when there are priority changes or something similar. We'll take a look at the new messages and reevaluate their usefulness.
Quoted 3 lines
Other than that it looks flawless. Ofcourse i only tested it for a few hours but on the surface everything looks ok
Great to hear!
Quoted 5 lines
I recorded the whole testing session for reference and submitted the video to youtube under the name of cil testday
Thanks
Thanks so much!
Quoted 37 lines · Dominick Grift
Quoted 6 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:<snip>
I just spent a few hours playing with this and i am impressed.
Everything i tested just works.
What did i test?
1. disabling/enabling existing modules
2. toggling booleans with semanage
3. adding and removing port and file contexts with semanage
4. adding/removing a policy module with semodule, checkmodule,semodule_package
5. adding/removing a (cil) policy module with semodule
6. associating a (new) user withstaff_tidentityComments?
if i do restorecon -R -v -F /home it resets contexts *every* time (from s0 to s0-s0). No noticable side effects because of this
After associating user john with
staff_u, johns home directory is properly labeled (staff_uassociated with/home/john). However, what is strange here is that i cannot seestaff_uhome dir context specs in/var/lib/selinux/targeted/active/modules/file_contexts.homedirsAm i looking in the wrong place? How does SELinux know that
staff_uneeds to be associated with/home/john
Quoted 8 lines
When you remove a custom module (semodule -r mycustmodule) semodule is a little verbose. (one line gets printed)
Other than that it looks flawless. Ofcourse i only tested it for a few hours but on the surface everything looks ok
I recorded the whole testing session for reference and submitted the video to youtube under the name of cil testday
Thanks for testing it. How did it look from a performance POV, wrt memory use and runtime?
On Thu, 2014-07-10 at 08:35 -0400, Stephen Smalley wrote:
<snip>
Quoted 3 lines
Thanks for testing it. How did it look from a performance POV, wrt memory use and runtime?
I have not (yet) really focused on that but i suppose there was no real noticeable slow down or speed up.
Any tips on how i could provide useful benchmarks?
I suppose i could enable the neverallow check
in /etc/selinux/semanage.conf and i would bet it is now much faster than it used to be (in fact ill try that)
Quoted 8 lines · Dominick Grift
On Thu, 2014-07-10 at 08:35 -0400, Stephen Smalley wrote:
<snip>
Quoted 3 lines
Thanks for testing it. How did it look from a performance POV, wrt memory use and runtime?
Quoted 10 lines
I have not (yet) really focused on that but i suppose there was no real noticeable slow down or speed up.
Any tips on how i could provide useful benchmarks?
I suppose i could enable the neverallow check
in/etc/selinux/semanage.confand i would bet it is now much faster than it used to be (in fact ill try that)
I suspect i was lying.
I am installing a guest with similar specs now and same software except the cil mods and then do some comparison.
i suppose stuff like time semodule -B
and looking at top
I did do a semodule -B with checking for neverallow rules but that found a violation really fast (thanks fedora). So although i cant really say how much faster that is , it is pretty safe to assume its much faster now
Quoted 25 lines · Dominick Grift
Quoted 8 lines · Dominick Grift
On Thu, 2014-07-10 at 08:35 -0400, Stephen Smalley wrote:
<snip>
Quoted 3 lines
Thanks for testing it. How did it look from a performance POV, wrt memory use and runtime?
Quoted 10 lines
I have not (yet) really focused on that but i suppose there was no real noticeable slow down or speed up.
Any tips on how i could provide useful benchmarks?
I suppose i could enable the neverallow check
in/etc/selinux/semanage.confand i would bet it is now much faster than it used to be (in fact ill try that)I suspect i was lying.
I am installing a guest with similar specs now and same software except the cil mods and then do some comparison.
Quoted 7 lines
i suppose stuff like time semodule -B
and looking at topI did do a semodule -B with checking for neverallow rules but that found a violation really fast (thanks fedora). So although i cant really say how much faster that is , it is pretty safe to assume its much faster now
/usr/bin/time setsebool -P httpd_can_network_connect=1 valgrind --tool=massif setsebool -P httpd_can_network_connect=1 ms_print massif.out.<pid>
Quoted 29 lines · Stephen Smalley
Quoted 28 lines · Dominick Grift
Quoted 8 lines · Dominick Grift
On Thu, 2014-07-10 at 08:35 -0400, Stephen Smalley wrote:
<snip>
Quoted 3 lines
Thanks for testing it. How did it look from a performance POV, wrt memory use and runtime?
Quoted 10 lines
I have not (yet) really focused on that but i suppose there was no real noticeable slow down or speed up.
Any tips on how i could provide useful benchmarks?
I suppose i could enable the neverallow check
in/etc/selinux/semanage.confand i would bet it is now much faster than it used to be (in fact ill try that)I suspect i was lying.
I am installing a guest with similar specs now and same software except the cil mods and then do some comparison.
i suppose stuff like time semodule -B
and looking at top
Quoted 11 lines
Quoted 4 lines
I did do a semodule -B with checking for neverallow rules but that found a violation really fast (thanks fedora). So although i cant really say how much faster that is , it is pretty safe to assume its much faster now
/usr/bin/timesetsebool -P httpd_can_network_connect=1 valgrind --tool=massif setsebool -P httpd_can_network_connect=1ms_printmassif.out.<pid>
Will do that next.
I did a time semodule -B on similar configs (2 cores/2GB ram):
Result: cil seems faster but seems to take more memory:
CIL: real 0m13.XXXs (23% mem (of 2 GB)
REGULAR: real 0m21.XXXs (15% mem (of 2 GB)
Quoted 42 lines · Dominick Grift
Quoted 29 lines · Stephen Smalley
Quoted 28 lines · Dominick Grift
Quoted 8 lines · Dominick Grift
On Thu, 2014-07-10 at 08:35 -0400, Stephen Smalley wrote:
<snip>
Quoted 3 lines
Thanks for testing it. How did it look from a performance POV, wrt memory use and runtime?
Quoted 10 lines
I have not (yet) really focused on that but i suppose there was no real noticeable slow down or speed up.
Any tips on how i could provide useful benchmarks?
I suppose i could enable the neverallow check
in/etc/selinux/semanage.confand i would bet it is now much faster than it used to be (in fact ill try that)I suspect i was lying.
I am installing a guest with similar specs now and same software except the cil mods and then do some comparison.
i suppose stuff like time semodule -B
and looking at topQuoted 11 lines
Quoted 4 lines
I did do a semodule -B with checking for neverallow rules but that found a violation really fast (thanks fedora). So although i cant really say how much faster that is , it is pretty safe to assume its much faster now
/usr/bin/timesetsebool -P httpd_can_network_connect=1 valgrind --tool=massif setsebool -P httpd_can_network_connect=1ms_printmassif.out.<pid>
Quoted 8 lines
Will do that next.
I did a time semodule -B on similar configs (2 cores/2GB ram):
Result: cil seems faster but seems to take more memory:
CIL: real 0m13.XXXs (23% mem (of 2 GB)
REGULAR: real 0m21.XXXs (15% mem (of 2 GB)
So, that's a concern, as we already have various bug reports on semodule and setsebool being killed by the OOM killer, e.g.
https://bugzilla.redhat.com/show_bug.cgi?id=1098446
Quoted 47 lines · Stephen Smalley
Quoted 46 lines · Dominick Grift
Quoted 29 lines · Stephen Smalley
Quoted 28 lines · Dominick Grift
Quoted 8 lines · Dominick Grift
On Thu, 2014-07-10 at 08:35 -0400, Stephen Smalley wrote:
<snip>
Quoted 3 lines
Thanks for testing it. How did it look from a performance POV, wrt memory use and runtime?
Quoted 10 lines
I have not (yet) really focused on that but i suppose there was no real noticeable slow down or speed up.
Any tips on how i could provide useful benchmarks?
I suppose i could enable the neverallow check
in/etc/selinux/semanage.confand i would bet it is now much faster than it used to be (in fact ill try that)I suspect i was lying.
I am installing a guest with similar specs now and same software except the cil mods and then do some comparison.
i suppose stuff like time semodule -B
and looking at topQuoted 11 lines
Quoted 4 lines
I did do a semodule -B with checking for neverallow rules but that found a violation really fast (thanks fedora). So although i cant really say how much faster that is , it is pretty safe to assume its much faster now
/usr/bin/timesetsebool -P httpd_can_network_connect=1 valgrind --tool=massif setsebool -P httpd_can_network_connect=1ms_printmassif.out.<pid>Will do that next.
I did a time semodule -B on similar configs (2 cores/2GB ram):
Quoted 10 lines
Quoted 4 lines
Result: cil seems faster but seems to take more memory:
CIL: real 0m13.XXXs (23% mem (of 2 GB)
REGULAR: real 0m21.XXXs (15% mem (of 2 GB)So, that's a concern, as we already have various bug reports on semodule and setsebool being killed by the OOM killer, e.g.
https://bugzilla.redhat.com/show_bug.cgi?id=1098446
valgrind output:
Quoted 118 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:- Change how
semanage_set_rootwas re-added to use the source policy infrastructure. Fixes were made so that semanage.conf was looked for inside the root. Also adds ansemanage_root()function to get the current root.
- In previous patchsets, the semanage_module_upgrade* and semanage_module_install_base* functions were removed from the API, and semanage_module_install* had modified parameters. However, these changes broke the API and ABI. To maintain ABI compatibility, we've now added symbolic versioning to support the old version of the functions, which now just call the new install functions. semodule is updated to support --base and --upgrade, but with the addition of a deprecation message. API compatability is not maintained.
- Likewise, symbolic versioning was added to support the old module enable/disable functions, which call the new enable/disable functions.
- Modify the libsepolMakefileto now make including CIL optional via theDISABLE_CILbuild flag. This only affects libsepol (not libsemanage), primarily so that SE for Android does not need to include unused CIL cruft.With these changes, ABI compatibility is maintained. Additionally, we have tested these changes with the userspace tests and against the kernel test suite, and no new failures were discovered. We have also tested this patchset with both Fedora 20 policy and with reference policy and found no errors.
Because of the size of the patchset (67 file changes, ~8300 insertions, ~1800 deletions), all the changes have been pushed to the selinux git repository to the 'integration' branch for comments/review. Unlike the previous RFCs, for simplicity there is now only a single branch, containing three types of changes:
Reverts
Reverts changes made to master that conflict with the new source policy infrastructure (e.g. how paths are handled, enabled/disable modules). Rather than dealing with a large amount of conflicts with the source policy work, it was easier to just remove the commits that added conflicting features, rebase the old source policy work on top of that, and add back any features in a manner consistent with source policy. The only conflicts were related to enabling/disabling of modules, andsemanage_set_root.Source Policy
This is a rebase of the old src-policy branch on top of the reverted commits. The goal of these changes is to improve the API for module handling, add support for source policies, module priorities, enabling/disabling of modules, and moving the policy store from /etc/selinux/<store>/ to /var/lib/selinux/<store>/.CIL Integration
These changes build CIL into libsepol, and updates libsepol, libsemanage, semodule, and semanage to work with and understand CIL files and manage/var/lib/selinuxand/etc/selinux. Switching to CIL has a few side effects, such as removing base modules, versions, and upgrades.This also adds a new tool (installed to
/usr/libexec/selinux/hll/pp), which is an HLL compiler that converts binary pp modules to CIL. The infrastructure to use this compiler (or any other HLL compiler) was added to compile HLL modules to CIL, which is accomplished by writing the HLL data to the stdin of the compiler and reading the equivilent CIL from stdout. The resulting CIL is then cached in the policy store so this compilation does not need to take place during future store updates. Cached CIL modules can be ignored using a new semodule flag (-C/--ignore-cache) or a new configuration option in semanage.conf (ignore-cache). Other configuration options were added to semanage.conf to manage the path to HLL compilers (compiler-directory) and the policy store (store-root). Semodule was also modified to support changing the policy store with the -S/--store-root option.Lastly, the CIL integration changes required changes to the API, but symbolic versioning was used to maintain ABI compatibility. Because of this, the .so version is no longer incremented like in the previous version of this RFC.
With these changes, it is possible to build and manage SELinux policy using pp and CIL modules and the familiar semodule/semanage tools.
To make this easier to experiment with and test, below are the steps needed to install the updated userspace and migrate a minimal Fedora 20 installation to the new policy store.
Thanks, and we look forward to any questions/comments.
- Steve
[1] http://marc.info/?l=selinux&m=138921403805934&w=2
[2] https://github.com/SELinuxProject/cil/wiki
[3] http://marc.info/?l=selinux&m=139878606630921&w=2Steps to Install SELinux Userspace with source policy, CIL, and HLL
# Start with a fresh Fedora 20-x86_64 Mimimal Installation
# Install SELinux userspace dependencies
$ yum install audit-libs-devel bison bzip2-devel dbus-devel dbus-glib-devel flex flex-static gcc git glib2-devel libcap-ng-devel libcgroup-devel libsepol-static pcre-devel python-devel python-IPy setools-devel swig ustr-devel# Update to the latest targeted policy
$ yum update selinux-policy-targeted# Clone the repos and checkout branches
$ git clone -b integration https://github.com/SELinuxProject/selinux.git $ git clone -b master https://github.com/SELinuxProject/cil.git
Quoted 8 lines
# Create a symlink to the cil repo so CIL can be built into libsepol
$ ln -s ~/cil/ selinux/libsepol/cil# Install SELinux userspace with CIL integration and HLL support
$ make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap# Migrate to the new source policy infrastructure
$ ./selinux/libsemanage/utils/semanage_migrate_etc_to_var.py
Is this expected:
# ./selinux/libsemanage/utils/semanage_migrate_etc_to_var.py Migrating from /etc/selinux/targeted/modules/active to /var/lib/selinux/targeted/active Attempting to rebuild policy from /var/lib/selinux sysnetwork: Warning: 'else' blocks in optional statements are unsupported in CIL. Dropping from output.
Quoted 121 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:- Change how
semanage_set_rootwas re-added to use the source policy infrastructure. Fixes were made so that semanage.conf was looked for inside the root. Also adds ansemanage_root()function to get the current root.
- In previous patchsets, the semanage_module_upgrade* and semanage_module_install_base* functions were removed from the API, and semanage_module_install* had modified parameters. However, these changes broke the API and ABI. To maintain ABI compatibility, we've now added symbolic versioning to support the old version of the functions, which now just call the new install functions. semodule is updated to support --base and --upgrade, but with the addition of a deprecation message. API compatability is not maintained.
- Likewise, symbolic versioning was added to support the old module enable/disable functions, which call the new enable/disable functions.
- Modify the libsepolMakefileto now make including CIL optional via theDISABLE_CILbuild flag. This only affects libsepol (not libsemanage), primarily so that SE for Android does not need to include unused CIL cruft.With these changes, ABI compatibility is maintained. Additionally, we have tested these changes with the userspace tests and against the kernel test suite, and no new failures were discovered. We have also tested this patchset with both Fedora 20 policy and with reference policy and found no errors.
Because of the size of the patchset (67 file changes, ~8300 insertions, ~1800 deletions), all the changes have been pushed to the selinux git repository to the 'integration' branch for comments/review. Unlike the previous RFCs, for simplicity there is now only a single branch, containing three types of changes:
Reverts
Reverts changes made to master that conflict with the new source policy infrastructure (e.g. how paths are handled, enabled/disable modules). Rather than dealing with a large amount of conflicts with the source policy work, it was easier to just remove the commits that added conflicting features, rebase the old source policy work on top of that, and add back any features in a manner consistent with source policy. The only conflicts were related to enabling/disabling of modules, andsemanage_set_root.Source Policy
This is a rebase of the old src-policy branch on top of the reverted commits. The goal of these changes is to improve the API for module handling, add support for source policies, module priorities, enabling/disabling of modules, and moving the policy store from /etc/selinux/<store>/ to /var/lib/selinux/<store>/.CIL Integration
These changes build CIL into libsepol, and updates libsepol, libsemanage, semodule, and semanage to work with and understand CIL files and manage/var/lib/selinuxand/etc/selinux. Switching to CIL has a few side effects, such as removing base modules, versions, and upgrades.This also adds a new tool (installed to
/usr/libexec/selinux/hll/pp), which is an HLL compiler that converts binary pp modules to CIL. The infrastructure to use this compiler (or any other HLL compiler) was added to compile HLL modules to CIL, which is accomplished by writing the HLL data to the stdin of the compiler and reading the equivilent CIL from stdout. The resulting CIL is then cached in the policy store so this compilation does not need to take place during future store updates. Cached CIL modules can be ignored using a new semodule flag (-C/--ignore-cache) or a new configuration option in semanage.conf (ignore-cache). Other configuration options were added to semanage.conf to manage the path to HLL compilers (compiler-directory) and the policy store (store-root). Semodule was also modified to support changing the policy store with the -S/--store-root option.Lastly, the CIL integration changes required changes to the API, but symbolic versioning was used to maintain ABI compatibility. Because of this, the .so version is no longer incremented like in the previous version of this RFC.
With these changes, it is possible to build and manage SELinux policy using pp and CIL modules and the familiar semodule/semanage tools.
To make this easier to experiment with and test, below are the steps needed to install the updated userspace and migrate a minimal Fedora 20 installation to the new policy store.
Thanks, and we look forward to any questions/comments.
- Steve
[1] http://marc.info/?l=selinux&m=138921403805934&w=2
[2] https://github.com/SELinuxProject/cil/wiki
[3] http://marc.info/?l=selinux&m=139878606630921&w=2Steps to Install SELinux Userspace with source policy, CIL, and HLL
# Start with a fresh Fedora 20-x86_64 Mimimal Installation
# Install SELinux userspace dependencies
$ yum install audit-libs-devel bison bzip2-devel dbus-devel dbus-glib-devel flex flex-static gcc git glib2-devel libcap-ng-devel libcgroup-devel libsepol-static pcre-devel python-devel python-IPy setools-devel swig ustr-devel# Update to the latest targeted policy
$ yum update selinux-policy-targeted# Clone the repos and checkout branches
$ git clone -b integration https://github.com/SELinuxProject/selinux.git $ git clone -b master https://github.com/SELinuxProject/cil.git# Create a symlink to the cil repo so CIL can be built into libsepol
$ ln -s ~/cil/ selinux/libsepol/cil
Quoted 8 lines
# Install SELinux userspace with CIL integration and HLL support
$ make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap# Migrate to the new source policy infrastructure
$ ./selinux/libsemanage/utils/semanage_migrate_etc_to_var.py# List the installed modules, showing priority and HLL
$ semodule --list=full
valgrind memcheck reports some issues:
# valgrind --leak-check=full setsebool -P httpd_can_network_connect=1 ==10089== Memcheck, a memory error detector ==10089== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==10089== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info ==10089== Command: setsebool -P httpd_can_network_connect=1 ==10089== ==10089== Conditional jump or move depends on uninitialised value(s) ==10089== at 0x511F50A: semanage_compile_hll (direct_api.c:937) ==10089== by 0x511FD97: semanage_direct_commit (direct_api.c:1071) ==10089== by 0x512DF59: semanage_commit (handle.c:426) ==10089== by 0x4019C2: semanage_set_boolean_list (setsebool.c:206) ==10089== by 0x401C48: setbool (setsebool.c:271) ==10089== by 0x40161A: main (setsebool.c:94) ==10089== (still running, may be more...)
Quoted 8 lines · Stephen Smalley
Is this expected:
# ./selinux/libsemanage/utils/semanage_migrate_etc_to_var.py Migrating from /etc/selinux/targeted/modules/active to /var/lib/selinux/targeted/active Attempting to rebuild policy from /var/lib/selinux sysnetwork: Warning: 'else' blocks in optional statements are unsupported in CIL. Dropping from output.
Maybe, but this particular one (in sysnetwork) seem to me a bug in policy or at least not optimal, maybe even redundant. I encountered the issue earlier, looked at it and i could not make sense out of it.
I concluded that similar result could be achieved without that "else"
Quoted 128 lines · Stephen Smalley
Quoted 118 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:- Change how
semanage_set_rootwas re-added to use the source policy infrastructure. Fixes were made so that semanage.conf was looked for inside the root. Also adds ansemanage_root()function to get the current root.
- In previous patchsets, the semanage_module_upgrade* and semanage_module_install_base* functions were removed from the API, and semanage_module_install* had modified parameters. However, these changes broke the API and ABI. To maintain ABI compatibility, we've now added symbolic versioning to support the old version of the functions, which now just call the new install functions. semodule is updated to support --base and --upgrade, but with the addition of a deprecation message. API compatability is not maintained.
- Likewise, symbolic versioning was added to support the old module enable/disable functions, which call the new enable/disable functions.
- Modify the libsepolMakefileto now make including CIL optional via theDISABLE_CILbuild flag. This only affects libsepol (not libsemanage), primarily so that SE for Android does not need to include unused CIL cruft.With these changes, ABI compatibility is maintained. Additionally, we have tested these changes with the userspace tests and against the kernel test suite, and no new failures were discovered. We have also tested this patchset with both Fedora 20 policy and with reference policy and found no errors.
Because of the size of the patchset (67 file changes, ~8300 insertions, ~1800 deletions), all the changes have been pushed to the selinux git repository to the 'integration' branch for comments/review. Unlike the previous RFCs, for simplicity there is now only a single branch, containing three types of changes:
Reverts
Reverts changes made to master that conflict with the new source policy infrastructure (e.g. how paths are handled, enabled/disable modules). Rather than dealing with a large amount of conflicts with the source policy work, it was easier to just remove the commits that added conflicting features, rebase the old source policy work on top of that, and add back any features in a manner consistent with source policy. The only conflicts were related to enabling/disabling of modules, andsemanage_set_root.Source Policy
This is a rebase of the old src-policy branch on top of the reverted commits. The goal of these changes is to improve the API for module handling, add support for source policies, module priorities, enabling/disabling of modules, and moving the policy store from /etc/selinux/<store>/ to /var/lib/selinux/<store>/.CIL Integration
These changes build CIL into libsepol, and updates libsepol, libsemanage, semodule, and semanage to work with and understand CIL files and manage/var/lib/selinuxand/etc/selinux. Switching to CIL has a few side effects, such as removing base modules, versions, and upgrades.This also adds a new tool (installed to
/usr/libexec/selinux/hll/pp), which is an HLL compiler that converts binary pp modules to CIL. The infrastructure to use this compiler (or any other HLL compiler) was added to compile HLL modules to CIL, which is accomplished by writing the HLL data to the stdin of the compiler and reading the equivilent CIL from stdout. The resulting CIL is then cached in the policy store so this compilation does not need to take place during future store updates. Cached CIL modules can be ignored using a new semodule flag (-C/--ignore-cache) or a new configuration option in semanage.conf (ignore-cache). Other configuration options were added to semanage.conf to manage the path to HLL compilers (compiler-directory) and the policy store (store-root). Semodule was also modified to support changing the policy store with the -S/--store-root option.Lastly, the CIL integration changes required changes to the API, but symbolic versioning was used to maintain ABI compatibility. Because of this, the .so version is no longer incremented like in the previous version of this RFC.
With these changes, it is possible to build and manage SELinux policy using pp and CIL modules and the familiar semodule/semanage tools.
To make this easier to experiment with and test, below are the steps needed to install the updated userspace and migrate a minimal Fedora 20 installation to the new policy store.
Thanks, and we look forward to any questions/comments.
- Steve
[1] http://marc.info/?l=selinux&m=138921403805934&w=2
[2] https://github.com/SELinuxProject/cil/wiki
[3] http://marc.info/?l=selinux&m=139878606630921&w=2Steps to Install SELinux Userspace with source policy, CIL, and HLL
# Start with a fresh Fedora 20-x86_64 Mimimal Installation
# Install SELinux userspace dependencies
$ yum install audit-libs-devel bison bzip2-devel dbus-devel dbus-glib-devel flex flex-static gcc git glib2-devel libcap-ng-devel libcgroup-devel libsepol-static pcre-devel python-devel python-IPy setools-devel swig ustr-devel# Update to the latest targeted policy
$ yum update selinux-policy-targeted# Clone the repos and checkout branches
$ git clone -b integration https://github.com/SELinuxProject/selinux.git $ git clone -b master https://github.com/SELinuxProject/cil.gitQuoted 8 lines
# Create a symlink to the cil repo so CIL can be built into libsepol
$ ln -s ~/cil/ selinux/libsepol/cil# Install SELinux userspace with CIL integration and HLL support
$ make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap# Migrate to the new source policy infrastructure
$ ./selinux/libsemanage/utils/semanage_migrate_etc_to_var.py
Quoted 8 lines
Is this expected:
# ./selinux/libsemanage/utils/semanage_migrate_etc_to_var.py Migrating from /etc/selinux/targeted/modules/active to /var/lib/selinux/targeted/active Attempting to rebuild policy from /var/lib/selinux sysnetwork: Warning: 'else' blocks in optional statements are unsupported in CIL. Dropping from output.
Yes. The sysnetwork module is the only module that uses 'else' in an optional statement. The relevant refpolicy is:
optional_policy(`
netutils_run_ping(dhcpc_t, dhcpc_roles)
netutils_run(dhcpc_t, dhcpc_roles)
',`
allow dhcpc_t self:capability setuid;
allow dhcpc_t self:rawip_socket create_socket_perms;')
So the 'else' block is only hit if the netutils module isn't installed (which it is by default).
CIL does not support else blocks in optional statements, so the decision was made to just drop the else block with a warning.
Quoted 121 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:- Change how
semanage_set_rootwas re-added to use the source policy infrastructure. Fixes were made so that semanage.conf was looked for inside the root. Also adds ansemanage_root()function to get the current root.
- In previous patchsets, the semanage_module_upgrade* and semanage_module_install_base* functions were removed from the API, and semanage_module_install* had modified parameters. However, these changes broke the API and ABI. To maintain ABI compatibility, we've now added symbolic versioning to support the old version of the functions, which now just call the new install functions. semodule is updated to support --base and --upgrade, but with the addition of a deprecation message. API compatability is not maintained.
- Likewise, symbolic versioning was added to support the old module enable/disable functions, which call the new enable/disable functions.
- Modify the libsepolMakefileto now make including CIL optional via theDISABLE_CILbuild flag. This only affects libsepol (not libsemanage), primarily so that SE for Android does not need to include unused CIL cruft.With these changes, ABI compatibility is maintained. Additionally, we have tested these changes with the userspace tests and against the kernel test suite, and no new failures were discovered. We have also tested this patchset with both Fedora 20 policy and with reference policy and found no errors.
Because of the size of the patchset (67 file changes, ~8300 insertions, ~1800 deletions), all the changes have been pushed to the selinux git repository to the 'integration' branch for comments/review. Unlike the previous RFCs, for simplicity there is now only a single branch, containing three types of changes:
Reverts
Reverts changes made to master that conflict with the new source policy infrastructure (e.g. how paths are handled, enabled/disable modules). Rather than dealing with a large amount of conflicts with the source policy work, it was easier to just remove the commits that added conflicting features, rebase the old source policy work on top of that, and add back any features in a manner consistent with source policy. The only conflicts were related to enabling/disabling of modules, andsemanage_set_root.Source Policy
This is a rebase of the old src-policy branch on top of the reverted commits. The goal of these changes is to improve the API for module handling, add support for source policies, module priorities, enabling/disabling of modules, and moving the policy store from /etc/selinux/<store>/ to /var/lib/selinux/<store>/.CIL Integration
These changes build CIL into libsepol, and updates libsepol, libsemanage, semodule, and semanage to work with and understand CIL files and manage/var/lib/selinuxand/etc/selinux. Switching to CIL has a few side effects, such as removing base modules, versions, and upgrades.This also adds a new tool (installed to
/usr/libexec/selinux/hll/pp), which is an HLL compiler that converts binary pp modules to CIL. The infrastructure to use this compiler (or any other HLL compiler) was added to compile HLL modules to CIL, which is accomplished by writing the HLL data to the stdin of the compiler and reading the equivilent CIL from stdout. The resulting CIL is then cached in the policy store so this compilation does not need to take place during future store updates. Cached CIL modules can be ignored using a new semodule flag (-C/--ignore-cache) or a new configuration option in semanage.conf (ignore-cache). Other configuration options were added to semanage.conf to manage the path to HLL compilers (compiler-directory) and the policy store (store-root). Semodule was also modified to support changing the policy store with the -S/--store-root option.Lastly, the CIL integration changes required changes to the API, but symbolic versioning was used to maintain ABI compatibility. Because of this, the .so version is no longer incremented like in the previous version of this RFC.
With these changes, it is possible to build and manage SELinux policy using pp and CIL modules and the familiar semodule/semanage tools.
To make this easier to experiment with and test, below are the steps needed to install the updated userspace and migrate a minimal Fedora 20 installation to the new policy store.
Thanks, and we look forward to any questions/comments.
- Steve
[1] http://marc.info/?l=selinux&m=138921403805934&w=2
[2] https://github.com/SELinuxProject/cil/wiki
[3] http://marc.info/?l=selinux&m=139878606630921&w=2Steps to Install SELinux Userspace with source policy, CIL, and HLL
# Start with a fresh Fedora 20-x86_64 Mimimal Installation
# Install SELinux userspace dependencies
$ yum install audit-libs-devel bison bzip2-devel dbus-devel dbus-glib-devel flex flex-static gcc git glib2-devel libcap-ng-devel libcgroup-devel libsepol-static pcre-devel python-devel python-IPy setools-devel swig ustr-devel# Update to the latest targeted policy
$ yum update selinux-policy-targeted# Clone the repos and checkout branches
$ git clone -b integration https://github.com/SELinuxProject/selinux.git $ git clone -b master https://github.com/SELinuxProject/cil.git# Create a symlink to the cil repo so CIL can be built into libsepol
$ ln -s ~/cil/ selinux/libsepol/cil
Quoted 8 lines
# Install SELinux userspace with CIL integration and HLL support
$ make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap# Migrate to the new source policy infrastructure
$ ./selinux/libsemanage/utils/semanage_migrate_etc_to_var.py# List the installed modules, showing priority and HLL
$ semodule --list=full
Is the classorder bug?
$ su <hangs forever> $ dmesg systemd[1]: SELinux policy denies access.
Quoted 128 lines · Stephen Smalley
Quoted 127 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:- Change how
semanage_set_rootwas re-added to use the source policy infrastructure. Fixes were made so that semanage.conf was looked for inside the root. Also adds ansemanage_root()function to get the current root.
- In previous patchsets, the semanage_module_upgrade* and semanage_module_install_base* functions were removed from the API, and semanage_module_install* had modified parameters. However, these changes broke the API and ABI. To maintain ABI compatibility, we've now added symbolic versioning to support the old version of the functions, which now just call the new install functions. semodule is updated to support --base and --upgrade, but with the addition of a deprecation message. API compatability is not maintained.
- Likewise, symbolic versioning was added to support the old module enable/disable functions, which call the new enable/disable functions.
- Modify the libsepolMakefileto now make including CIL optional via theDISABLE_CILbuild flag. This only affects libsepol (not libsemanage), primarily so that SE for Android does not need to include unused CIL cruft.With these changes, ABI compatibility is maintained. Additionally, we have tested these changes with the userspace tests and against the kernel test suite, and no new failures were discovered. We have also tested this patchset with both Fedora 20 policy and with reference policy and found no errors.
Because of the size of the patchset (67 file changes, ~8300 insertions, ~1800 deletions), all the changes have been pushed to the selinux git repository to the 'integration' branch for comments/review. Unlike the previous RFCs, for simplicity there is now only a single branch, containing three types of changes:
Reverts
Reverts changes made to master that conflict with the new source policy infrastructure (e.g. how paths are handled, enabled/disable modules). Rather than dealing with a large amount of conflicts with the source policy work, it was easier to just remove the commits that added conflicting features, rebase the old source policy work on top of that, and add back any features in a manner consistent with source policy. The only conflicts were related to enabling/disabling of modules, andsemanage_set_root.Source Policy
This is a rebase of the old src-policy branch on top of the reverted commits. The goal of these changes is to improve the API for module handling, add support for source policies, module priorities, enabling/disabling of modules, and moving the policy store from /etc/selinux/<store>/ to /var/lib/selinux/<store>/.CIL Integration
These changes build CIL into libsepol, and updates libsepol, libsemanage, semodule, and semanage to work with and understand CIL files and manage/var/lib/selinuxand/etc/selinux. Switching to CIL has a few side effects, such as removing base modules, versions, and upgrades.This also adds a new tool (installed to
/usr/libexec/selinux/hll/pp), which is an HLL compiler that converts binary pp modules to CIL. The infrastructure to use this compiler (or any other HLL compiler) was added to compile HLL modules to CIL, which is accomplished by writing the HLL data to the stdin of the compiler and reading the equivilent CIL from stdout. The resulting CIL is then cached in the policy store so this compilation does not need to take place during future store updates. Cached CIL modules can be ignored using a new semodule flag (-C/--ignore-cache) or a new configuration option in semanage.conf (ignore-cache). Other configuration options were added to semanage.conf to manage the path to HLL compilers (compiler-directory) and the policy store (store-root). Semodule was also modified to support changing the policy store with the -S/--store-root option.Lastly, the CIL integration changes required changes to the API, but symbolic versioning was used to maintain ABI compatibility. Because of this, the .so version is no longer incremented like in the previous version of this RFC.
With these changes, it is possible to build and manage SELinux policy using pp and CIL modules and the familiar semodule/semanage tools.
To make this easier to experiment with and test, below are the steps needed to install the updated userspace and migrate a minimal Fedora 20 installation to the new policy store.
Thanks, and we look forward to any questions/comments.
- Steve
[1] http://marc.info/?l=selinux&m=138921403805934&w=2
[2] https://github.com/SELinuxProject/cil/wiki
[3] http://marc.info/?l=selinux&m=139878606630921&w=2Steps to Install SELinux Userspace with source policy, CIL, and HLL
# Start with a fresh Fedora 20-x86_64 Mimimal Installation
# Install SELinux userspace dependencies
$ yum install audit-libs-devel bison bzip2-devel dbus-devel dbus-glib-devel flex flex-static gcc git glib2-devel libcap-ng-devel libcgroup-devel libsepol-static pcre-devel python-devel python-IPy setools-devel swig ustr-devel# Update to the latest targeted policy
$ yum update selinux-policy-targeted# Clone the repos and checkout branches
$ git clone -b integration https://github.com/SELinuxProject/selinux.git $ git clone -b master https://github.com/SELinuxProject/cil.git# Create a symlink to the cil repo so CIL can be built into libsepol
$ ln -s ~/cil/ selinux/libsepol/cil# Install SELinux userspace with CIL integration and HLL support
$ make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap# Migrate to the new source policy infrastructure
$ ./selinux/libsemanage/utils/semanage_migrate_etc_to_var.py
Quoted 7 lines
Quoted 2 lines
# List the installed modules, showing priority and HLL
$ semodule --list=fullIs the classorder bug?
$ su <hangs forever> $ dmesg systemd[1]: SELinux policy denies access.
Ok, not forever - but it does take a while to timeout.
Quoted 128 lines · Stephen Smalley
Quoted 127 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:- Change how
semanage_set_rootwas re-added to use the source policy infrastructure. Fixes were made so that semanage.conf was looked for inside the root. Also adds ansemanage_root()function to get the current root.
- In previous patchsets, the semanage_module_upgrade* and semanage_module_install_base* functions were removed from the API, and semanage_module_install* had modified parameters. However, these changes broke the API and ABI. To maintain ABI compatibility, we've now added symbolic versioning to support the old version of the functions, which now just call the new install functions. semodule is updated to support --base and --upgrade, but with the addition of a deprecation message. API compatability is not maintained.
- Likewise, symbolic versioning was added to support the old module enable/disable functions, which call the new enable/disable functions.
- Modify the libsepolMakefileto now make including CIL optional via theDISABLE_CILbuild flag. This only affects libsepol (not libsemanage), primarily so that SE for Android does not need to include unused CIL cruft.With these changes, ABI compatibility is maintained. Additionally, we have tested these changes with the userspace tests and against the kernel test suite, and no new failures were discovered. We have also tested this patchset with both Fedora 20 policy and with reference policy and found no errors.
Because of the size of the patchset (67 file changes, ~8300 insertions, ~1800 deletions), all the changes have been pushed to the selinux git repository to the 'integration' branch for comments/review. Unlike the previous RFCs, for simplicity there is now only a single branch, containing three types of changes:
Reverts
Reverts changes made to master that conflict with the new source policy infrastructure (e.g. how paths are handled, enabled/disable modules). Rather than dealing with a large amount of conflicts with the source policy work, it was easier to just remove the commits that added conflicting features, rebase the old source policy work on top of that, and add back any features in a manner consistent with source policy. The only conflicts were related to enabling/disabling of modules, andsemanage_set_root.Source Policy
This is a rebase of the old src-policy branch on top of the reverted commits. The goal of these changes is to improve the API for module handling, add support for source policies, module priorities, enabling/disabling of modules, and moving the policy store from /etc/selinux/<store>/ to /var/lib/selinux/<store>/.CIL Integration
These changes build CIL into libsepol, and updates libsepol, libsemanage, semodule, and semanage to work with and understand CIL files and manage/var/lib/selinuxand/etc/selinux. Switching to CIL has a few side effects, such as removing base modules, versions, and upgrades.This also adds a new tool (installed to
/usr/libexec/selinux/hll/pp), which is an HLL compiler that converts binary pp modules to CIL. The infrastructure to use this compiler (or any other HLL compiler) was added to compile HLL modules to CIL, which is accomplished by writing the HLL data to the stdin of the compiler and reading the equivilent CIL from stdout. The resulting CIL is then cached in the policy store so this compilation does not need to take place during future store updates. Cached CIL modules can be ignored using a new semodule flag (-C/--ignore-cache) or a new configuration option in semanage.conf (ignore-cache). Other configuration options were added to semanage.conf to manage the path to HLL compilers (compiler-directory) and the policy store (store-root). Semodule was also modified to support changing the policy store with the -S/--store-root option.Lastly, the CIL integration changes required changes to the API, but symbolic versioning was used to maintain ABI compatibility. Because of this, the .so version is no longer incremented like in the previous version of this RFC.
With these changes, it is possible to build and manage SELinux policy using pp and CIL modules and the familiar semodule/semanage tools.
To make this easier to experiment with and test, below are the steps needed to install the updated userspace and migrate a minimal Fedora 20 installation to the new policy store.
Thanks, and we look forward to any questions/comments.
- Steve
[1] http://marc.info/?l=selinux&m=138921403805934&w=2
[2] https://github.com/SELinuxProject/cil/wiki
[3] http://marc.info/?l=selinux&m=139878606630921&w=2Steps to Install SELinux Userspace with source policy, CIL, and HLL
# Start with a fresh Fedora 20-x86_64 Mimimal Installation
# Install SELinux userspace dependencies
$ yum install audit-libs-devel bison bzip2-devel dbus-devel dbus-glib-devel flex flex-static gcc git glib2-devel libcap-ng-devel libcgroup-devel libsepol-static pcre-devel python-devel python-IPy setools-devel swig ustr-devel# Update to the latest targeted policy
$ yum update selinux-policy-targeted# Clone the repos and checkout branches
$ git clone -b integration https://github.com/SELinuxProject/selinux.git $ git clone -b master https://github.com/SELinuxProject/cil.git# Create a symlink to the cil repo so CIL can be built into libsepol
$ ln -s ~/cil/ selinux/libsepol/cil# Install SELinux userspace with CIL integration and HLL support
$ make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap# Migrate to the new source policy infrastructure
$ ./selinux/libsemanage/utils/semanage_migrate_etc_to_var.py
Quoted 9 lines
Quoted 2 lines
# List the installed modules, showing priority and HLL
$ semodule --list=fullIs the classorder bug?
$ su <hangs forever> $ dmesg systemd[1]: SELinux policy denies access.
The classorder bug has been fixed with the latest cil & integration branch, and shouldn't have been a problem with fedora's policy since the pp2cil tool should have output the classes in the correct order.
I'm not able to reproduce this problem. su works correctly and immediately for me. What commands did you run before this?
Quoted 139 lines · Steve Lawrence
Quoted 128 lines · Stephen Smalley
Quoted 127 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:- Change how
semanage_set_rootwas re-added to use the source policy infrastructure. Fixes were made so that semanage.conf was looked for inside the root. Also adds ansemanage_root()function to get the current root.
- In previous patchsets, the semanage_module_upgrade* and semanage_module_install_base* functions were removed from the API, and semanage_module_install* had modified parameters. However, these changes broke the API and ABI. To maintain ABI compatibility, we've now added symbolic versioning to support the old version of the functions, which now just call the new install functions. semodule is updated to support --base and --upgrade, but with the addition of a deprecation message. API compatability is not maintained.
- Likewise, symbolic versioning was added to support the old module enable/disable functions, which call the new enable/disable functions.
- Modify the libsepolMakefileto now make including CIL optional via theDISABLE_CILbuild flag. This only affects libsepol (not libsemanage), primarily so that SE for Android does not need to include unused CIL cruft.With these changes, ABI compatibility is maintained. Additionally, we have tested these changes with the userspace tests and against the kernel test suite, and no new failures were discovered. We have also tested this patchset with both Fedora 20 policy and with reference policy and found no errors.
Because of the size of the patchset (67 file changes, ~8300 insertions, ~1800 deletions), all the changes have been pushed to the selinux git repository to the 'integration' branch for comments/review. Unlike the previous RFCs, for simplicity there is now only a single branch, containing three types of changes:
Reverts
Reverts changes made to master that conflict with the new source policy infrastructure (e.g. how paths are handled, enabled/disable modules). Rather than dealing with a large amount of conflicts with the source policy work, it was easier to just remove the commits that added conflicting features, rebase the old source policy work on top of that, and add back any features in a manner consistent with source policy. The only conflicts were related to enabling/disabling of modules, andsemanage_set_root.Source Policy
This is a rebase of the old src-policy branch on top of the reverted commits. The goal of these changes is to improve the API for module handling, add support for source policies, module priorities, enabling/disabling of modules, and moving the policy store from /etc/selinux/<store>/ to /var/lib/selinux/<store>/.CIL Integration
These changes build CIL into libsepol, and updates libsepol, libsemanage, semodule, and semanage to work with and understand CIL files and manage/var/lib/selinuxand/etc/selinux. Switching to CIL has a few side effects, such as removing base modules, versions, and upgrades.This also adds a new tool (installed to
/usr/libexec/selinux/hll/pp), which is an HLL compiler that converts binary pp modules to CIL. The infrastructure to use this compiler (or any other HLL compiler) was added to compile HLL modules to CIL, which is accomplished by writing the HLL data to the stdin of the compiler and reading the equivilent CIL from stdout. The resulting CIL is then cached in the policy store so this compilation does not need to take place during future store updates. Cached CIL modules can be ignored using a new semodule flag (-C/--ignore-cache) or a new configuration option in semanage.conf (ignore-cache). Other configuration options were added to semanage.conf to manage the path to HLL compilers (compiler-directory) and the policy store (store-root). Semodule was also modified to support changing the policy store with the -S/--store-root option.Lastly, the CIL integration changes required changes to the API, but symbolic versioning was used to maintain ABI compatibility. Because of this, the .so version is no longer incremented like in the previous version of this RFC.
With these changes, it is possible to build and manage SELinux policy using pp and CIL modules and the familiar semodule/semanage tools.
To make this easier to experiment with and test, below are the steps needed to install the updated userspace and migrate a minimal Fedora 20 installation to the new policy store.
Thanks, and we look forward to any questions/comments.
- Steve
[1] http://marc.info/?l=selinux&m=138921403805934&w=2
[2] https://github.com/SELinuxProject/cil/wiki
[3] http://marc.info/?l=selinux&m=139878606630921&w=2Steps to Install SELinux Userspace with source policy, CIL, and HLL
# Start with a fresh Fedora 20-x86_64 Mimimal Installation
# Install SELinux userspace dependencies
$ yum install audit-libs-devel bison bzip2-devel dbus-devel dbus-glib-devel flex flex-static gcc git glib2-devel libcap-ng-devel libcgroup-devel libsepol-static pcre-devel python-devel python-IPy setools-devel swig ustr-devel# Update to the latest targeted policy
$ yum update selinux-policy-targeted# Clone the repos and checkout branches
$ git clone -b integration https://github.com/SELinuxProject/selinux.git $ git clone -b master https://github.com/SELinuxProject/cil.git# Create a symlink to the cil repo so CIL can be built into libsepol
$ ln -s ~/cil/ selinux/libsepol/cil# Install SELinux userspace with CIL integration and HLL support
$ make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap# Migrate to the new source policy infrastructure
$ ./selinux/libsemanage/utils/semanage_migrate_etc_to_var.pyQuoted 9 lines
Quoted 2 lines
# List the installed modules, showing priority and HLL
$ semodule --list=fullIs the classorder bug?
$ su <hangs forever> $ dmesg systemd[1]: SELinux policy denies access.
Quoted 6 lines
The classorder bug has been fixed with the latest cil & integration branch, and shouldn't have been a problem with fedora's policy since the pp2cil tool should have output the classes in the correct order.
I'm not able to reproduce this problem. su works correctly and immediately for me. What commands did you run before this?
I tried various setsebool and semodule commands, and ran the selinux-testsuite. Not sure exactly when it started doing this but it seems to be consistent right now.
Quoted 5 lines · Stephen Smalley
Is the classorder bug?
$ su <hangs forever> $ dmesg systemd[1]: SELinux policy denies access.
Is that with handle-unknown set to deny?
if so then this is due to a missing av permission for the system class in the fedora policy
Else it may be indeed related to classorder but i think its the former
Quoted 8 lines · Dominick Grift
Quoted 5 lines · Stephen Smalley
Is the classorder bug?
$ su <hangs forever> $ dmesg systemd[1]: SELinux policy denies access.
Quoted 6 lines
Is that with handle-unknown set to deny?
if so then this is due to a missing av permission for the system class in the fedora policy
Else it may be indeed related to classorder but i think its the former
No, this is a stock system, so semanage.conf has the defaults, i.e. no expand-check and no handle-unknown.
Quoted 115 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:- Change how
semanage_set_rootwas re-added to use the source policy infrastructure. Fixes were made so that semanage.conf was looked for inside the root. Also adds ansemanage_root()function to get the current root.
- In previous patchsets, the semanage_module_upgrade* and semanage_module_install_base* functions were removed from the API, and semanage_module_install* had modified parameters. However, these changes broke the API and ABI. To maintain ABI compatibility, we've now added symbolic versioning to support the old version of the functions, which now just call the new install functions. semodule is updated to support --base and --upgrade, but with the addition of a deprecation message. API compatability is not maintained.
- Likewise, symbolic versioning was added to support the old module enable/disable functions, which call the new enable/disable functions.
- Modify the libsepolMakefileto now make including CIL optional via theDISABLE_CILbuild flag. This only affects libsepol (not libsemanage), primarily so that SE for Android does not need to include unused CIL cruft.With these changes, ABI compatibility is maintained. Additionally, we have tested these changes with the userspace tests and against the kernel test suite, and no new failures were discovered. We have also tested this patchset with both Fedora 20 policy and with reference policy and found no errors.
Because of the size of the patchset (67 file changes, ~8300 insertions, ~1800 deletions), all the changes have been pushed to the selinux git repository to the 'integration' branch for comments/review. Unlike the previous RFCs, for simplicity there is now only a single branch, containing three types of changes:
Reverts
Reverts changes made to master that conflict with the new source policy infrastructure (e.g. how paths are handled, enabled/disable modules). Rather than dealing with a large amount of conflicts with the source policy work, it was easier to just remove the commits that added conflicting features, rebase the old source policy work on top of that, and add back any features in a manner consistent with source policy. The only conflicts were related to enabling/disabling of modules, andsemanage_set_root.Source Policy
This is a rebase of the old src-policy branch on top of the reverted commits. The goal of these changes is to improve the API for module handling, add support for source policies, module priorities, enabling/disabling of modules, and moving the policy store from /etc/selinux/<store>/ to /var/lib/selinux/<store>/.CIL Integration
These changes build CIL into libsepol, and updates libsepol, libsemanage, semodule, and semanage to work with and understand CIL files and manage/var/lib/selinuxand/etc/selinux. Switching to CIL has a few side effects, such as removing base modules, versions, and upgrades.This also adds a new tool (installed to
/usr/libexec/selinux/hll/pp), which is an HLL compiler that converts binary pp modules to CIL. The infrastructure to use this compiler (or any other HLL compiler) was added to compile HLL modules to CIL, which is accomplished by writing the HLL data to the stdin of the compiler and reading the equivilent CIL from stdout. The resulting CIL is then cached in the policy store so this compilation does not need to take place during future store updates. Cached CIL modules can be ignored using a new semodule flag (-C/--ignore-cache) or a new configuration option in semanage.conf (ignore-cache). Other configuration options were added to semanage.conf to manage the path to HLL compilers (compiler-directory) and the policy store (store-root). Semodule was also modified to support changing the policy store with the -S/--store-root option.Lastly, the CIL integration changes required changes to the API, but symbolic versioning was used to maintain ABI compatibility. Because of this, the .so version is no longer incremented like in the previous version of this RFC.
With these changes, it is possible to build and manage SELinux policy using pp and CIL modules and the familiar semodule/semanage tools.
To make this easier to experiment with and test, below are the steps needed to install the updated userspace and migrate a minimal Fedora 20 installation to the new policy store.
Thanks, and we look forward to any questions/comments.
- Steve
[1] http://marc.info/?l=selinux&m=138921403805934&w=2
[2] https://github.com/SELinuxProject/cil/wiki
[3] http://marc.info/?l=selinux&m=139878606630921&w=2Steps to Install SELinux Userspace with source policy, CIL, and HLL
# Start with a fresh Fedora 20-x86_64 Mimimal Installation
# Install SELinux userspace dependencies
$ yum install audit-libs-devel bison bzip2-devel dbus-devel dbus-glib-devel flex flex-static gcc git glib2-devel libcap-ng-devel libcgroup-devel libsepol-static pcre-devel python-devel python-IPy setools-devel swig ustr-devel# Update to the latest targeted policy
$ yum update selinux-policy-targeted# Clone the repos and checkout branches
Quoted 8 lines
$ git clone -b integration https://github.com/SELinuxProject/selinux.git $ git clone -b master https://github.com/SELinuxProject/cil.git# Create a symlink to the cil repo so CIL can be built into libsepol
$ ln -s ~/cil/ selinux/libsepol/cil# Install SELinux userspace with CIL integration and HLL support
$ make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap
There is something weird about your build system with cil; you can't build twice without first doing a complete clean.
Quoted 11 lines · Stephen Smalley
Quoted 10 lines · Dominick Grift
Quoted 5 lines · Stephen Smalley
Is the classorder bug?
$ su <hangs forever> $ dmesg systemd[1]: SELinux policy denies access.Is that with handle-unknown set to deny?
Quoted 7 lines
Quoted 4 lines
if so then this is due to a missing av permission for the system class in the fedora policy
Else it may be indeed related to classorder but i think its the former
No, this is a stock system, so semanage.conf has the defaults, i.e. no expand-check and no handle-unknown.
Hmmm...but rebooting "cleared" it and now I can su without delay and no systemd error message.
Merged #next to #integration locally to try to pick up the improved error reporting on unknown class/perms but can't reproduce it now...
Quoted 5 lines · Stephen Smalley
No, this is a stock system, so semanage.conf has the defaults, i.e. no expand-check and no handle-unknown.
I see, If this only happened right after policy was (re) loaded and after that it was gone. Then i might have hit the same issue (not with this test though but yesterday with my e145 policy built using latest secilc) when i loaded my policy with the classorder added (i am not saying that classorder is causing this though)
I started seeing dbus denials for a short period (even though the rules were in the policy). Soon after they disappeared and everything was fine.
It probably going to take a little time for me to be able to reproduce this if i can reproduce it at all.
Quoted 119 lines · Stephen Smalley
Quoted 118 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:- Change how
semanage_set_rootwas re-added to use the source policy infrastructure. Fixes were made so that semanage.conf was looked for inside the root. Also adds ansemanage_root()function to get the current root.
- In previous patchsets, the semanage_module_upgrade* and semanage_module_install_base* functions were removed from the API, and semanage_module_install* had modified parameters. However, these changes broke the API and ABI. To maintain ABI compatibility, we've now added symbolic versioning to support the old version of the functions, which now just call the new install functions. semodule is updated to support --base and --upgrade, but with the addition of a deprecation message. API compatability is not maintained.
- Likewise, symbolic versioning was added to support the old module enable/disable functions, which call the new enable/disable functions.
- Modify the libsepolMakefileto now make including CIL optional via theDISABLE_CILbuild flag. This only affects libsepol (not libsemanage), primarily so that SE for Android does not need to include unused CIL cruft.With these changes, ABI compatibility is maintained. Additionally, we have tested these changes with the userspace tests and against the kernel test suite, and no new failures were discovered. We have also tested this patchset with both Fedora 20 policy and with reference policy and found no errors.
Because of the size of the patchset (67 file changes, ~8300 insertions, ~1800 deletions), all the changes have been pushed to the selinux git repository to the 'integration' branch for comments/review. Unlike the previous RFCs, for simplicity there is now only a single branch, containing three types of changes:
Reverts
Reverts changes made to master that conflict with the new source policy infrastructure (e.g. how paths are handled, enabled/disable modules). Rather than dealing with a large amount of conflicts with the source policy work, it was easier to just remove the commits that added conflicting features, rebase the old source policy work on top of that, and add back any features in a manner consistent with source policy. The only conflicts were related to enabling/disabling of modules, andsemanage_set_root.Source Policy
This is a rebase of the old src-policy branch on top of the reverted commits. The goal of these changes is to improve the API for module handling, add support for source policies, module priorities, enabling/disabling of modules, and moving the policy store from /etc/selinux/<store>/ to /var/lib/selinux/<store>/.CIL Integration
These changes build CIL into libsepol, and updates libsepol, libsemanage, semodule, and semanage to work with and understand CIL files and manage/var/lib/selinuxand/etc/selinux. Switching to CIL has a few side effects, such as removing base modules, versions, and upgrades.This also adds a new tool (installed to
/usr/libexec/selinux/hll/pp), which is an HLL compiler that converts binary pp modules to CIL. The infrastructure to use this compiler (or any other HLL compiler) was added to compile HLL modules to CIL, which is accomplished by writing the HLL data to the stdin of the compiler and reading the equivilent CIL from stdout. The resulting CIL is then cached in the policy store so this compilation does not need to take place during future store updates. Cached CIL modules can be ignored using a new semodule flag (-C/--ignore-cache) or a new configuration option in semanage.conf (ignore-cache). Other configuration options were added to semanage.conf to manage the path to HLL compilers (compiler-directory) and the policy store (store-root). Semodule was also modified to support changing the policy store with the -S/--store-root option.Lastly, the CIL integration changes required changes to the API, but symbolic versioning was used to maintain ABI compatibility. Because of this, the .so version is no longer incremented like in the previous version of this RFC.
With these changes, it is possible to build and manage SELinux policy using pp and CIL modules and the familiar semodule/semanage tools.
To make this easier to experiment with and test, below are the steps needed to install the updated userspace and migrate a minimal Fedora 20 installation to the new policy store.
Thanks, and we look forward to any questions/comments.
- Steve
[1] http://marc.info/?l=selinux&m=138921403805934&w=2
[2] https://github.com/SELinuxProject/cil/wiki
[3] http://marc.info/?l=selinux&m=139878606630921&w=2Steps to Install SELinux Userspace with source policy, CIL, and HLL
# Start with a fresh Fedora 20-x86_64 Mimimal Installation
# Install SELinux userspace dependencies
$ yum install audit-libs-devel bison bzip2-devel dbus-devel dbus-glib-devel flex flex-static gcc git glib2-devel libcap-ng-devel libcgroup-devel libsepol-static pcre-devel python-devel python-IPy setools-devel swig ustr-devel# Update to the latest targeted policy
$ yum update selinux-policy-targeted# Clone the repos and checkout branches
$ git clone -b integration https://github.com/SELinuxProject/selinux.git $ git clone -b master https://github.com/SELinuxProject/cil.git
Quoted 8 lines
Quoted 5 lines
# Create a symlink to the cil repo so CIL can be built into libsepol
$ ln -s ~/cil/ selinux/libsepol/cil# Install SELinux userspace with CIL integration and HLL support
$ make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrapThere is something weird about your build system with cil; you can't build twice without first doing a complete clean.
So, to be precise, it is some sequence where I build, do a git clean -fdx in selinux, try to rebuild, fails due to missing cil symlink (why doesn't it test for its existence explicitly?), re-create the symlink, and try to build again. Ends up with duplicated symbols in cil. Have to clean the cil directory to get it to build again.
Also, what's the plan for actual merging of cil into libsepol? If libsepol depends on cil for building, then you can't really keep it separate and require cloning two projects and setting up a symlink by hand like this in the long term.
On Thu, 2014-07-10 at 10:34 -0400, Stephen Smalley wrote:
\
Quoted 4 lines
Hmmm...but rebooting "cleared" it and now I can su without delay and no systemd error message.
Yes , sound like the issue i hit yesterday (when i updated my e145 policy)
basically i loaded the updated policy, rebooted (system was hanging), hard reset, looking at avc denials, system_t self:dbus send_msg was denied. (even though i had that rule both before and after i updated my policy. was not able to reproduce it after that, but looks like we will be seeing more from this issue soon.
Quoted 5 lines
Merged #next to #integration locally to try to pick up the improved error reporting on unknown class/perms but can't reproduce it now...
Quoted 18 lines · Stephen Smalley
valgrind memcheck reports some issues:
# valgrind --leak-check=full setsebool -P httpd_can_network_connect=1 ==10089== Memcheck, a memory error detector ==10089== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==10089== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info ==10089== Command: setsebool -P httpd_can_network_connect=1 ==10089== ==10089== Conditional jump or move depends on uninitialised value(s) ==10089== at 0x511F50A: semanage_compile_hll (direct_api.c:937) ==10089== by 0x511FD97: semanage_direct_commit (direct_api.c:1071) ==10089== by 0x512DF59: semanage_commit (handle.c:426) ==10089== by 0x4019C2: semanage_set_boolean_list (setsebool.c:206) ==10089== by 0x401C48: setbool (setsebool.c:271) ==10089== by 0x40161A: main (setsebool.c:94) ==10089== (still running, may be more...)
This issue has been fixed and squashed/pushed into the integration branch. We were missing a variable initiation, which affected cases where no HLL modules needed to be compiled (i.e. all modules had been previously compiled and cached).
Thanks,
- Steve
Quoted 149 lines · Steve Lawrence
Quoted 128 lines · Stephen Smalley
Quoted 118 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:- Change how
semanage_set_rootwas re-added to use the source policy infrastructure. Fixes were made so that semanage.conf was looked for inside the root. Also adds ansemanage_root()function to get the current root.
- In previous patchsets, the semanage_module_upgrade* and semanage_module_install_base* functions were removed from the API, and semanage_module_install* had modified parameters. However, these changes broke the API and ABI. To maintain ABI compatibility, we've now added symbolic versioning to support the old version of the functions, which now just call the new install functions. semodule is updated to support --base and --upgrade, but with the addition of a deprecation message. API compatability is not maintained.
- Likewise, symbolic versioning was added to support the old module enable/disable functions, which call the new enable/disable functions.
- Modify the libsepolMakefileto now make including CIL optional via theDISABLE_CILbuild flag. This only affects libsepol (not libsemanage), primarily so that SE for Android does not need to include unused CIL cruft.With these changes, ABI compatibility is maintained. Additionally, we have tested these changes with the userspace tests and against the kernel test suite, and no new failures were discovered. We have also tested this patchset with both Fedora 20 policy and with reference policy and found no errors.
Because of the size of the patchset (67 file changes, ~8300 insertions, ~1800 deletions), all the changes have been pushed to the selinux git repository to the 'integration' branch for comments/review. Unlike the previous RFCs, for simplicity there is now only a single branch, containing three types of changes:
Reverts
Reverts changes made to master that conflict with the new source policy infrastructure (e.g. how paths are handled, enabled/disable modules). Rather than dealing with a large amount of conflicts with the source policy work, it was easier to just remove the commits that added conflicting features, rebase the old source policy work on top of that, and add back any features in a manner consistent with source policy. The only conflicts were related to enabling/disabling of modules, andsemanage_set_root.Source Policy
This is a rebase of the old src-policy branch on top of the reverted commits. The goal of these changes is to improve the API for module handling, add support for source policies, module priorities, enabling/disabling of modules, and moving the policy store from /etc/selinux/<store>/ to /var/lib/selinux/<store>/.CIL Integration
These changes build CIL into libsepol, and updates libsepol, libsemanage, semodule, and semanage to work with and understand CIL files and manage/var/lib/selinuxand/etc/selinux. Switching to CIL has a few side effects, such as removing base modules, versions, and upgrades.This also adds a new tool (installed to
/usr/libexec/selinux/hll/pp), which is an HLL compiler that converts binary pp modules to CIL. The infrastructure to use this compiler (or any other HLL compiler) was added to compile HLL modules to CIL, which is accomplished by writing the HLL data to the stdin of the compiler and reading the equivilent CIL from stdout. The resulting CIL is then cached in the policy store so this compilation does not need to take place during future store updates. Cached CIL modules can be ignored using a new semodule flag (-C/--ignore-cache) or a new configuration option in semanage.conf (ignore-cache). Other configuration options were added to semanage.conf to manage the path to HLL compilers (compiler-directory) and the policy store (store-root). Semodule was also modified to support changing the policy store with the -S/--store-root option.Lastly, the CIL integration changes required changes to the API, but symbolic versioning was used to maintain ABI compatibility. Because of this, the .so version is no longer incremented like in the previous version of this RFC.
With these changes, it is possible to build and manage SELinux policy using pp and CIL modules and the familiar semodule/semanage tools.
To make this easier to experiment with and test, below are the steps needed to install the updated userspace and migrate a minimal Fedora 20 installation to the new policy store.
Thanks, and we look forward to any questions/comments.
- Steve
[1] http://marc.info/?l=selinux&m=138921403805934&w=2
[2] https://github.com/SELinuxProject/cil/wiki
[3] http://marc.info/?l=selinux&m=139878606630921&w=2Steps to Install SELinux Userspace with source policy, CIL, and HLL
# Start with a fresh Fedora 20-x86_64 Mimimal Installation
# Install SELinux userspace dependencies
$ yum install audit-libs-devel bison bzip2-devel dbus-devel dbus-glib-devel flex flex-static gcc git glib2-devel libcap-ng-devel libcgroup-devel libsepol-static pcre-devel python-devel python-IPy setools-devel swig ustr-devel# Update to the latest targeted policy
$ yum update selinux-policy-targeted# Clone the repos and checkout branches
$ git clone -b integration https://github.com/SELinuxProject/selinux.git $ git clone -b master https://github.com/SELinuxProject/cil.gitQuoted 8 lines
# Create a symlink to the cil repo so CIL can be built into libsepol
$ ln -s ~/cil/ selinux/libsepol/cil# Install SELinux userspace with CIL integration and HLL support
$ make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap# Migrate to the new source policy infrastructure
$ ./selinux/libsemanage/utils/semanage_migrate_etc_to_var.pyQuoted 8 lines
Is this expected:
# ./selinux/libsemanage/utils/semanage_migrate_etc_to_var.py Migrating from /etc/selinux/targeted/modules/active to /var/lib/selinux/targeted/active Attempting to rebuild policy from /var/lib/selinux sysnetwork: Warning: 'else' blocks in optional statements are unsupported in CIL. Dropping from output.Yes. The sysnetwork module is the only module that uses 'else' in an optional statement. The relevant refpolicy is:
optional_policy(` netutils_run_ping(dhcpc_t, dhcpc_roles) netutils_run(dhcpc_t, dhcpc_roles) ',` allow dhcpc_t self:capability setuid; allow dhcpc_t self:rawip_socket create_socket_perms; ')
Quoted 5 lines
So the 'else' block is only hit if the netutils module isn't installed (which it is by default).
CIL does not support else blocks in optional statements, so the decision was made to just drop the else block with a warning.
It would be easy to get rid of this. I use the following patch when I convert Refpolicy.
policy/modules/admin/netutils.te +2 -0
@@ -1,5 +1,7 @@ policy_module(netutils, 1.12.0) +define(`use_netutils') + ######################################## # # Declarations
policy/modules/system/sysnetwork.te +3 -1
@@ -190,7 +190,9 @@ optional_policy(` optional_policy(` netutils_run_ping(dhcpc_t, dhcpc_roles) netutils_run(dhcpc_t, dhcpc_roles) -',` +') + +ifndef(`use_netutils',` allow dhcpc_t self:capability setuid; allow dhcpc_t self:rawip_socket create_socket_perms; ')
Signature · 2 lines
James Carter <[email protected]> National Security Agency
Quoted 42 lines · Dominick Grift
Quoted 29 lines · Stephen Smalley
Quoted 28 lines · Dominick Grift
Quoted 8 lines · Dominick Grift
On Thu, 2014-07-10 at 08:35 -0400, Stephen Smalley wrote:
<snip>
Quoted 3 lines
Thanks for testing it. How did it look from a performance POV, wrt memory use and runtime?
Quoted 10 lines
I have not (yet) really focused on that but i suppose there was no real noticeable slow down or speed up.
Any tips on how i could provide useful benchmarks?
I suppose i could enable the neverallow check
in/etc/selinux/semanage.confand i would bet it is now much faster than it used to be (in fact ill try that)I suspect i was lying.
I am installing a guest with similar specs now and same software except the cil mods and then do some comparison.
i suppose stuff like time semodule -B
and looking at topQuoted 11 lines
Quoted 4 lines
I did do a semodule -B with checking for neverallow rules but that found a violation really fast (thanks fedora). So although i cant really say how much faster that is , it is pretty safe to assume its much faster now
/usr/bin/timesetsebool -P httpd_can_network_connect=1 valgrind --tool=massif setsebool -P httpd_can_network_connect=1ms_printmassif.out.<pid>
Quoted 8 lines
Will do that next.
I did a time semodule -B on similar configs (2 cores/2GB ram):
Result: cil seems faster but seems to take more memory:
CIL: real 0m13.XXXs (23% mem (of 2 GB)
REGULAR: real 0m21.XXXs (15% mem (of 2 GB)
For /usr/bin/time semodule -i test_policy.pp (from selinux-testsuite), I see:
#integration (i.e. CIL): 6.24user 1.00system 0:07.30elapsed 99%CPU (0avgtext+0avgdata 464480maxresident)k
#next (i.e. regular/upstream): 24.31user 0.88system 0:25.37elapsed 99%CPU (0avgtext+0avgdata 300792maxresident)k
That seems like a significant speed-up but it is more expensive in memory use.
This is with up-to-date Fedora 20 policy, no customization of semanage.conf.
Quoted 126 lines · Stephen Smalley
Quoted 125 lines · Stephen Smalley
Quoted 123 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:- Change how
semanage_set_rootwas re-added to use the source policy infrastructure. Fixes were made so that semanage.conf was looked for inside the root. Also adds ansemanage_root()function to get the current root.
- In previous patchsets, the semanage_module_upgrade* and semanage_module_install_base* functions were removed from the API, and semanage_module_install* had modified parameters. However, these changes broke the API and ABI. To maintain ABI compatibility, we've now added symbolic versioning to support the old version of the functions, which now just call the new install functions. semodule is updated to support --base and --upgrade, but with the addition of a deprecation message. API compatability is not maintained.
- Likewise, symbolic versioning was added to support the old module enable/disable functions, which call the new enable/disable functions.
- Modify the libsepolMakefileto now make including CIL optional via theDISABLE_CILbuild flag. This only affects libsepol (not libsemanage), primarily so that SE for Android does not need to include unused CIL cruft.With these changes, ABI compatibility is maintained. Additionally, we have tested these changes with the userspace tests and against the kernel test suite, and no new failures were discovered. We have also tested this patchset with both Fedora 20 policy and with reference policy and found no errors.
Because of the size of the patchset (67 file changes, ~8300 insertions, ~1800 deletions), all the changes have been pushed to the selinux git repository to the 'integration' branch for comments/review. Unlike the previous RFCs, for simplicity there is now only a single branch, containing three types of changes:
Reverts
Reverts changes made to master that conflict with the new source policy infrastructure (e.g. how paths are handled, enabled/disable modules). Rather than dealing with a large amount of conflicts with the source policy work, it was easier to just remove the commits that added conflicting features, rebase the old source policy work on top of that, and add back any features in a manner consistent with source policy. The only conflicts were related to enabling/disabling of modules, andsemanage_set_root.Source Policy
This is a rebase of the old src-policy branch on top of the reverted commits. The goal of these changes is to improve the API for module handling, add support for source policies, module priorities, enabling/disabling of modules, and moving the policy store from /etc/selinux/<store>/ to /var/lib/selinux/<store>/.CIL Integration
These changes build CIL into libsepol, and updates libsepol, libsemanage, semodule, and semanage to work with and understand CIL files and manage/var/lib/selinuxand/etc/selinux. Switching to CIL has a few side effects, such as removing base modules, versions, and upgrades.This also adds a new tool (installed to
/usr/libexec/selinux/hll/pp), which is an HLL compiler that converts binary pp modules to CIL. The infrastructure to use this compiler (or any other HLL compiler) was added to compile HLL modules to CIL, which is accomplished by writing the HLL data to the stdin of the compiler and reading the equivilent CIL from stdout. The resulting CIL is then cached in the policy store so this compilation does not need to take place during future store updates. Cached CIL modules can be ignored using a new semodule flag (-C/--ignore-cache) or a new configuration option in semanage.conf (ignore-cache). Other configuration options were added to semanage.conf to manage the path to HLL compilers (compiler-directory) and the policy store (store-root). Semodule was also modified to support changing the policy store with the -S/--store-root option.Lastly, the CIL integration changes required changes to the API, but symbolic versioning was used to maintain ABI compatibility. Because of this, the .so version is no longer incremented like in the previous version of this RFC.
With these changes, it is possible to build and manage SELinux policy using pp and CIL modules and the familiar semodule/semanage tools.
To make this easier to experiment with and test, below are the steps needed to install the updated userspace and migrate a minimal Fedora 20 installation to the new policy store.
Thanks, and we look forward to any questions/comments.
- Steve
[1] http://marc.info/?l=selinux&m=138921403805934&w=2
[2] https://github.com/SELinuxProject/cil/wiki
[3] http://marc.info/?l=selinux&m=139878606630921&w=2Steps to Install SELinux Userspace with source policy, CIL, and HLL
# Start with a fresh Fedora 20-x86_64 Mimimal Installation
# Install SELinux userspace dependencies
$ yum install audit-libs-devel bison bzip2-devel dbus-devel dbus-glib-devel flex flex-static gcc git glib2-devel libcap-ng-devel libcgroup-devel libsepol-static pcre-devel python-devel python-IPy setools-devel swig ustr-devel# Update to the latest targeted policy
$ yum update selinux-policy-targeted# Clone the repos and checkout branches
$ git clone -b integration https://github.com/SELinuxProject/selinux.git $ git clone -b master https://github.com/SELinuxProject/cil.git# Create a symlink to the cil repo so CIL can be built into libsepol
$ ln -s ~/cil/ selinux/libsepol/cil# Install SELinux userspace with CIL integration and HLL support
$ make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap
Quoted 8 lines
Quoted 2 lines
There is something weird about your build system with cil; you can't build twice without first doing a complete clean.
So, to be precise, it is some sequence where I build, do a git clean -fdx in selinux, try to rebuild, fails due to missing cil symlink (why doesn't it test for its existence explicitly?), re-create the symlink, and try to build again. Ends up with duplicated symbols in cil. Have to clean the cil directory to get it to build again.
Thanks for the detailed steps to reproduce. Looking into this now.
Quoted 4 lines
Also, what's the plan for actual merging of cil into libsepol? If libsepol depends on cil for building, then you can't really keep it separate and require cloning two projects and setting up a symlink by hand like this in the long term.
I'm all open for other ideas, but I had always assumed that the CIL repo would would be merged (via git subtree merge) into the SELinux userspace repo right where the symlink goes, and it just becomes part of libsepol.
Licensing might be a problem, since CIL is currently BSD 2-Clause and libsepol is LGPLv2. Not sure exactly how that works, or if relicensing is in order. Relicesning CIL shouldn't be a problem if necessary.
Quoted 143 lines · Steve Lawrence
Quoted 126 lines · Stephen Smalley
Quoted 125 lines · Stephen Smalley
Quoted 123 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:- Change how
semanage_set_rootwas re-added to use the source policy infrastructure. Fixes were made so that semanage.conf was looked for inside the root. Also adds ansemanage_root()function to get the current root.
- In previous patchsets, the semanage_module_upgrade* and semanage_module_install_base* functions were removed from the API, and semanage_module_install* had modified parameters. However, these changes broke the API and ABI. To maintain ABI compatibility, we've now added symbolic versioning to support the old version of the functions, which now just call the new install functions. semodule is updated to support --base and --upgrade, but with the addition of a deprecation message. API compatability is not maintained.
- Likewise, symbolic versioning was added to support the old module enable/disable functions, which call the new enable/disable functions.
- Modify the libsepolMakefileto now make including CIL optional via theDISABLE_CILbuild flag. This only affects libsepol (not libsemanage), primarily so that SE for Android does not need to include unused CIL cruft.With these changes, ABI compatibility is maintained. Additionally, we have tested these changes with the userspace tests and against the kernel test suite, and no new failures were discovered. We have also tested this patchset with both Fedora 20 policy and with reference policy and found no errors.
Because of the size of the patchset (67 file changes, ~8300 insertions, ~1800 deletions), all the changes have been pushed to the selinux git repository to the 'integration' branch for comments/review. Unlike the previous RFCs, for simplicity there is now only a single branch, containing three types of changes:
Reverts
Reverts changes made to master that conflict with the new source policy infrastructure (e.g. how paths are handled, enabled/disable modules). Rather than dealing with a large amount of conflicts with the source policy work, it was easier to just remove the commits that added conflicting features, rebase the old source policy work on top of that, and add back any features in a manner consistent with source policy. The only conflicts were related to enabling/disabling of modules, andsemanage_set_root.Source Policy
This is a rebase of the old src-policy branch on top of the reverted commits. The goal of these changes is to improve the API for module handling, add support for source policies, module priorities, enabling/disabling of modules, and moving the policy store from /etc/selinux/<store>/ to /var/lib/selinux/<store>/.CIL Integration
These changes build CIL into libsepol, and updates libsepol, libsemanage, semodule, and semanage to work with and understand CIL files and manage/var/lib/selinuxand/etc/selinux. Switching to CIL has a few side effects, such as removing base modules, versions, and upgrades.This also adds a new tool (installed to
/usr/libexec/selinux/hll/pp), which is an HLL compiler that converts binary pp modules to CIL. The infrastructure to use this compiler (or any other HLL compiler) was added to compile HLL modules to CIL, which is accomplished by writing the HLL data to the stdin of the compiler and reading the equivilent CIL from stdout. The resulting CIL is then cached in the policy store so this compilation does not need to take place during future store updates. Cached CIL modules can be ignored using a new semodule flag (-C/--ignore-cache) or a new configuration option in semanage.conf (ignore-cache). Other configuration options were added to semanage.conf to manage the path to HLL compilers (compiler-directory) and the policy store (store-root). Semodule was also modified to support changing the policy store with the -S/--store-root option.Lastly, the CIL integration changes required changes to the API, but symbolic versioning was used to maintain ABI compatibility. Because of this, the .so version is no longer incremented like in the previous version of this RFC.
With these changes, it is possible to build and manage SELinux policy using pp and CIL modules and the familiar semodule/semanage tools.
To make this easier to experiment with and test, below are the steps needed to install the updated userspace and migrate a minimal Fedora 20 installation to the new policy store.
Thanks, and we look forward to any questions/comments.
- Steve
[1] http://marc.info/?l=selinux&m=138921403805934&w=2
[2] https://github.com/SELinuxProject/cil/wiki
[3] http://marc.info/?l=selinux&m=139878606630921&w=2Steps to Install SELinux Userspace with source policy, CIL, and HLL
# Start with a fresh Fedora 20-x86_64 Mimimal Installation
# Install SELinux userspace dependencies
$ yum install audit-libs-devel bison bzip2-devel dbus-devel dbus-glib-devel flex flex-static gcc git glib2-devel libcap-ng-devel libcgroup-devel libsepol-static pcre-devel python-devel python-IPy setools-devel swig ustr-devel# Update to the latest targeted policy
$ yum update selinux-policy-targeted# Clone the repos and checkout branches
$ git clone -b integration https://github.com/SELinuxProject/selinux.git $ git clone -b master https://github.com/SELinuxProject/cil.git# Create a symlink to the cil repo so CIL can be built into libsepol
$ ln -s ~/cil/ selinux/libsepol/cil# Install SELinux userspace with CIL integration and HLL support
$ make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrapQuoted 8 lines
Quoted 2 lines
There is something weird about your build system with cil; you can't build twice without first doing a complete clean.
So, to be precise, it is some sequence where I build, do a git clean -fdx in selinux, try to rebuild, fails due to missing cil symlink (why doesn't it test for its existence explicitly?), re-create the symlink, and try to build again. Ends up with duplicated symbols in cil. Have to clean the cil directory to get it to build again.
Thanks for the detailed steps to reproduce. Looking into this now.
Quoted 4 lines
Also, what's the plan for actual merging of cil into libsepol? If libsepol depends on cil for building, then you can't really keep it separate and require cloning two projects and setting up a symlink by hand like this in the long term.
Quoted 7 lines
I'm all open for other ideas, but I had always assumed that the CIL repo would would be merged (via git subtree merge) into the SELinux userspace repo right where the symlink goes, and it just becomes part of libsepol.
Licensing might be a problem, since CIL is currently BSD 2-Clause and libsepol is LGPLv2. Not sure exactly how that works, or if relicensing is in order. Relicesning CIL shouldn't be a problem if necessary.
I don't think re-licensing is required there (i.e. BSD 2-clause is compatible with GPL/LGPL, and inclusion of BSD code within a LGPL library shouldn't be a problem).
Quoted 119 lines · Stephen Smalley
Quoted 118 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:- Change how
semanage_set_rootwas re-added to use the source policy infrastructure. Fixes were made so that semanage.conf was looked for inside the root. Also adds ansemanage_root()function to get the current root.
- In previous patchsets, the semanage_module_upgrade* and semanage_module_install_base* functions were removed from the API, and semanage_module_install* had modified parameters. However, these changes broke the API and ABI. To maintain ABI compatibility, we've now added symbolic versioning to support the old version of the functions, which now just call the new install functions. semodule is updated to support --base and --upgrade, but with the addition of a deprecation message. API compatability is not maintained.
- Likewise, symbolic versioning was added to support the old module enable/disable functions, which call the new enable/disable functions.
- Modify the libsepolMakefileto now make including CIL optional via theDISABLE_CILbuild flag. This only affects libsepol (not libsemanage), primarily so that SE for Android does not need to include unused CIL cruft.With these changes, ABI compatibility is maintained. Additionally, we have tested these changes with the userspace tests and against the kernel test suite, and no new failures were discovered. We have also tested this patchset with both Fedora 20 policy and with reference policy and found no errors.
Because of the size of the patchset (67 file changes, ~8300 insertions, ~1800 deletions), all the changes have been pushed to the selinux git repository to the 'integration' branch for comments/review. Unlike the previous RFCs, for simplicity there is now only a single branch, containing three types of changes:
Reverts
Reverts changes made to master that conflict with the new source policy infrastructure (e.g. how paths are handled, enabled/disable modules). Rather than dealing with a large amount of conflicts with the source policy work, it was easier to just remove the commits that added conflicting features, rebase the old source policy work on top of that, and add back any features in a manner consistent with source policy. The only conflicts were related to enabling/disabling of modules, andsemanage_set_root.Source Policy
This is a rebase of the old src-policy branch on top of the reverted commits. The goal of these changes is to improve the API for module handling, add support for source policies, module priorities, enabling/disabling of modules, and moving the policy store from /etc/selinux/<store>/ to /var/lib/selinux/<store>/.CIL Integration
These changes build CIL into libsepol, and updates libsepol, libsemanage, semodule, and semanage to work with and understand CIL files and manage/var/lib/selinuxand/etc/selinux. Switching to CIL has a few side effects, such as removing base modules, versions, and upgrades.This also adds a new tool (installed to
/usr/libexec/selinux/hll/pp), which is an HLL compiler that converts binary pp modules to CIL. The infrastructure to use this compiler (or any other HLL compiler) was added to compile HLL modules to CIL, which is accomplished by writing the HLL data to the stdin of the compiler and reading the equivilent CIL from stdout. The resulting CIL is then cached in the policy store so this compilation does not need to take place during future store updates. Cached CIL modules can be ignored using a new semodule flag (-C/--ignore-cache) or a new configuration option in semanage.conf (ignore-cache). Other configuration options were added to semanage.conf to manage the path to HLL compilers (compiler-directory) and the policy store (store-root). Semodule was also modified to support changing the policy store with the -S/--store-root option.Lastly, the CIL integration changes required changes to the API, but symbolic versioning was used to maintain ABI compatibility. Because of this, the .so version is no longer incremented like in the previous version of this RFC.
With these changes, it is possible to build and manage SELinux policy using pp and CIL modules and the familiar semodule/semanage tools.
To make this easier to experiment with and test, below are the steps needed to install the updated userspace and migrate a minimal Fedora 20 installation to the new policy store.
Thanks, and we look forward to any questions/comments.
- Steve
[1] http://marc.info/?l=selinux&m=138921403805934&w=2
[2] https://github.com/SELinuxProject/cil/wiki
[3] http://marc.info/?l=selinux&m=139878606630921&w=2Steps to Install SELinux Userspace with source policy, CIL, and HLL
# Start with a fresh Fedora 20-x86_64 Mimimal Installation
# Install SELinux userspace dependencies
$ yum install audit-libs-devel bison bzip2-devel dbus-devel dbus-glib-devel flex flex-static gcc git glib2-devel libcap-ng-devel libcgroup-devel libsepol-static pcre-devel python-devel python-IPy setools-devel swig ustr-devel# Update to the latest targeted policy
$ yum update selinux-policy-targeted# Clone the repos and checkout branches
$ git clone -b integration https://github.com/SELinuxProject/selinux.git $ git clone -b master https://github.com/SELinuxProject/cil.git
Quoted 10 lines
Quoted 5 lines
# Create a symlink to the cil repo so CIL can be built into libsepol
$ ln -s ~/cil/ selinux/libsepol/cil# Install SELinux userspace with CIL integration and HLL support
$ make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrapThere is something weird about your build system with cil; you can't build twice without first doing a complete clean.
I've just squashed/pushed a fix for this in the integration branch.
The problem was that we defined OBJS as CIL_DIR/*.c + CIL_GENERATED, where CIL_GENERATED is a .c file created by flex. So if the CIL_GENERATED .c file already existed (like would happen second time building), it would be matched by the wildcard, so it would appear twice in OBJS. This resulted in it trying to link in the same object twice, causing duplicate definitions. Adding a $(sort ...) to the Makefile seems to be the standard way to remove these duplicates, and fixes the problem.
Thanks,
- Steve
Quoted 53 lines · Dominick Grift
Quoted 52 lines · Stephen Smalley
Quoted 50 lines · Dominick Grift
Quoted 29 lines · Stephen Smalley
Quoted 28 lines · Dominick Grift
Quoted 8 lines · Dominick Grift
On Thu, 2014-07-10 at 08:35 -0400, Stephen Smalley wrote:
<snip>
Quoted 3 lines
Thanks for testing it. How did it look from a performance POV, wrt memory use and runtime?
Quoted 10 lines
I have not (yet) really focused on that but i suppose there was no real noticeable slow down or speed up.
Any tips on how i could provide useful benchmarks?
I suppose i could enable the neverallow check
in/etc/selinux/semanage.confand i would bet it is now much faster than it used to be (in fact ill try that)I suspect i was lying.
I am installing a guest with similar specs now and same software except the cil mods and then do some comparison.
i suppose stuff like time semodule -B
and looking at topQuoted 11 lines
Quoted 4 lines
I did do a semodule -B with checking for neverallow rules but that found a violation really fast (thanks fedora). So although i cant really say how much faster that is , it is pretty safe to assume its much faster now
/usr/bin/timesetsebool -P httpd_can_network_connect=1 valgrind --tool=massif setsebool -P httpd_can_network_connect=1ms_printmassif.out.<pid>Will do that next.
I did a time semodule -B on similar configs (2 cores/2GB ram):
Result: cil seems faster but seems to take more memory:
CIL: real 0m13.XXXs (23% mem (of 2 GB)
REGULAR: real 0m21.XXXs (15% mem (of 2 GB)
Quoted 9 lines
Quoted 5 lines
So, that's a concern, as we already have various bug reports on semodule and setsebool being killed by the OOM killer, e.g.
https://bugzilla.redhat.com/show_bug.cgi?id=1098446valgrind output:
We just pushed a commit to CIL that greatly reduces peak memory usage. Some quick testing brings the peak memory usage of compiling Fedora's policy from around 460MB down to around 260MB. So I think its now about on par with current userspace. We're also working on some other changes, but those require a bit more work and so might take a little longer. But I don't think those changes will get memory usage down significantly more (maybe down another 10-20MB), so I doubt this will do a whole lot in solving the OOM killer issue.
- Steve
Quoted 24 lines · Dominick Grift
Quoted 6 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:<snip>
I just spent a few hours playing with this and i am impressed.
Everything i tested just works.
What did i test?
1. disabling/enabling existing modules
2. toggling booleans with semanage
3. adding and removing port and file contexts with semanage
4. adding/removing a policy module with semodule, checkmodule,semodule_package
5. adding/removing a (cil) policy module with semodule
6. associating a (new) user withstaff_tidentity
Quoted 5 lines
Comments?
if i do restorecon -R -v -F /home it resets contexts *every* time (from s0 to s0-s0). No noticable side effects because of this
We recently pushed a fix to CIL that fixes the issue with how CIL generates file contexts. It now removes the high level if it is the same as the low level.
- Steve
Quoted 27 lines · Steve Lawrence
Quoted 26 lines · Dominick Grift
Quoted 6 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:<snip>
I just spent a few hours playing with this and i am impressed.
Everything i tested just works.
What did i test?
1. disabling/enabling existing modules
2. toggling booleans with semanage
3. adding and removing port and file contexts with semanage
4. adding/removing a policy module with semodule, checkmodule,semodule_package
5. adding/removing a (cil) policy module with semodule
6. associating a (new) user withstaff_tidentityComments?
Quoted 7 lines
Quoted 3 lines
if i do restorecon -R -v -F /home it resets contexts *every* time (from s0 to s0-s0). No noticable side effects because of this
We recently pushed a fix to CIL that fixes the issue with how CIL generates file contexts. It now removes the high level if it is the same as the low level.
So, if I revert my system to stock F20 (yum reinstall checkpolicy* libsepol* libsemanage* libselinux* policycoreutils* selinux-policy-targeted) , then re-install from the integration branch as per your instructions and run the migration script, then attempt to ssh into the system, sshd says "Unable to get valid context for sds" and the connection is closed. dmesg shows:
systemd[1]: SELinux policy denies access.
Can you merge #next to #integration so we get the more detailed information on unknown classes/perms?
I'm guessing a reboot will clear the problem again (since systemd will then remap the class from name to value at boot against the current policy). But ideally this wouldn't be necessary.
Quoted 44 lines · Stephen Smalley
Quoted 27 lines · Steve Lawrence
Quoted 26 lines · Dominick Grift
Quoted 6 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:<snip>
I just spent a few hours playing with this and i am impressed.
Everything i tested just works.
What did i test?
1. disabling/enabling existing modules
2. toggling booleans with semanage
3. adding and removing port and file contexts with semanage
4. adding/removing a policy module with semodule, checkmodule,semodule_package
5. adding/removing a (cil) policy module with semodule
6. associating a (new) user withstaff_tidentityComments?
Quoted 7 lines
Quoted 3 lines
if i do restorecon -R -v -F /home it resets contexts *every* time (from s0 to s0-s0). No noticable side effects because of this
We recently pushed a fix to CIL that fixes the issue with how CIL generates file contexts. It now removes the high level if it is the same as the low level.
So, if I revert my system to stock F20 (yum reinstall checkpolicy* libsepol* libsemanage* libselinux* policycoreutils* selinux-policy-targeted) , then re-install from the integration branch as per your instructions and run the migration script, then attempt to ssh into the system, sshd says "Unable to get valid context for sds" and the connection is closed. dmesg shows:
systemd[1]: SELinux policy denies access.
Quoted 6 lines
Can you merge #next to #integration so we get the more detailed information on unknown classes/perms?
I'm guessing a reboot will clear the problem again (since systemd will then remap the class from name to value at boot against the current policy). But ideally this wouldn't be necessary.
Hmmm....a reboot did not clear it. All logins, local or remote, disabled for non-root.
Quoted 48 lines · Stephen Smalley
Quoted 47 lines · Stephen Smalley
Quoted 27 lines · Steve Lawrence
Quoted 26 lines · Dominick Grift
Quoted 6 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:<snip>
I just spent a few hours playing with this and i am impressed.
Everything i tested just works.
What did i test?
1. disabling/enabling existing modules
2. toggling booleans with semanage
3. adding and removing port and file contexts with semanage
4. adding/removing a policy module with semodule, checkmodule,semodule_package
5. adding/removing a (cil) policy module with semodule
6. associating a (new) user withstaff_tidentityComments?
Quoted 7 lines
Quoted 3 lines
if i do restorecon -R -v -F /home it resets contexts *every* time (from s0 to s0-s0). No noticable side effects because of this
We recently pushed a fix to CIL that fixes the issue with how CIL generates file contexts. It now removes the high level if it is the same as the low level.
So, if I revert my system to stock F20 (yum reinstall checkpolicy* libsepol* libsemanage* libselinux* policycoreutils* selinux-policy-targeted) , then re-install from the integration branch as per your instructions and run the migration script, then attempt to ssh into the system, sshd says "Unable to get valid context for sds" and the connection is closed. dmesg shows:
systemd[1]: SELinux policy denies access.Can you merge #next to #integration so we get the more detailed information on unknown classes/perms?
Quoted 6 lines
Quoted 3 lines
I'm guessing a reboot will clear the problem again (since systemd will then remap the class from name to value at boot against the current policy). But ideally this wouldn't be necessary.
Hmmm....a reboot did not clear it. All logins, local or remote, disabled for non-root.
This seems to be a labeling problem; saw denials on attempts to read seusers with semanage_store_t. But restorecon -Rv /etc/selinux/targeted restored it to selinux_config_t.
Quoted 53 lines · Stephen Smalley
Quoted 52 lines · Stephen Smalley
Quoted 50 lines · Stephen Smalley
Quoted 27 lines · Steve Lawrence
Quoted 26 lines · Dominick Grift
Quoted 6 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:<snip>
I just spent a few hours playing with this and i am impressed.
Everything i tested just works.
What did i test?
1. disabling/enabling existing modules
2. toggling booleans with semanage
3. adding and removing port and file contexts with semanage
4. adding/removing a policy module with semodule, checkmodule,semodule_package
5. adding/removing a (cil) policy module with semodule
6. associating a (new) user withstaff_tidentityComments?
Quoted 7 lines
Quoted 3 lines
if i do restorecon -R -v -F /home it resets contexts *every* time (from s0 to s0-s0). No noticable side effects because of this
We recently pushed a fix to CIL that fixes the issue with how CIL generates file contexts. It now removes the high level if it is the same as the low level.
So, if I revert my system to stock F20 (yum reinstall checkpolicy* libsepol* libsemanage* libselinux* policycoreutils* selinux-policy-targeted) , then re-install from the integration branch as per your instructions and run the migration script, then attempt to ssh into the system, sshd says "Unable to get valid context for sds" and the connection is closed. dmesg shows:
systemd[1]: SELinux policy denies access.Can you merge #next to #integration so we get the more detailed information on unknown classes/perms?
I'm guessing a reboot will clear the problem again (since systemd will then remap the class from name to value at boot against the current policy). But ideally this wouldn't be necessary.
Quoted 7 lines
Quoted 2 lines
Hmmm....a reboot did not clear it. All logins, local or remote, disabled for non-root.
This seems to be a labeling problem; saw denials on attempts to read seusers with
semanage_store_t. But restorecon -Rv/etc/selinux/targetedrestored it toselinux_config_t.
Ah, interesting. We saw that problem a long time ago, but couldn't reproduce it and it disappeared. Though I'm still unable to reproduce it following your steps. I can still login and seusers is labeled selinux_config_t. I'll keep looking into this.
I've also rebased/pushed #integration onto #next.
Quoted 53 lines · Stephen Smalley
Quoted 52 lines · Stephen Smalley
Quoted 50 lines · Stephen Smalley
Quoted 27 lines · Steve Lawrence
Quoted 26 lines · Dominick Grift
Quoted 6 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:<snip>
I just spent a few hours playing with this and i am impressed.
Everything i tested just works.
What did i test?
1. disabling/enabling existing modules
2. toggling booleans with semanage
3. adding and removing port and file contexts with semanage
4. adding/removing a policy module with semodule, checkmodule,semodule_package
5. adding/removing a (cil) policy module with semodule
6. associating a (new) user withstaff_tidentityComments?
Quoted 7 lines
Quoted 3 lines
if i do restorecon -R -v -F /home it resets contexts *every* time (from s0 to s0-s0). No noticable side effects because of this
We recently pushed a fix to CIL that fixes the issue with how CIL generates file contexts. It now removes the high level if it is the same as the low level.
So, if I revert my system to stock F20 (yum reinstall checkpolicy* libsepol* libsemanage* libselinux* policycoreutils* selinux-policy-targeted) , then re-install from the integration branch as per your instructions and run the migration script, then attempt to ssh into the system, sshd says "Unable to get valid context for sds" and the connection is closed. dmesg shows:
systemd[1]: SELinux policy denies access.Can you merge #next to #integration so we get the more detailed information on unknown classes/perms?
I'm guessing a reboot will clear the problem again (since systemd will then remap the class from name to value at boot against the current policy). But ideally this wouldn't be necessary.
Quoted 7 lines
Quoted 2 lines
Hmmm....a reboot did not clear it. All logins, local or remote, disabled for non-root.
This seems to be a labeling problem; saw denials on attempts to read seusers with
semanage_store_t. But restorecon -Rv/etc/selinux/targetedrestored it toselinux_config_t.
In my experience this is probably not related to the event "systemd[1]:
SELinux policy denied access."
I may be wrong but I do not believe systemd prints those messages if it is not directly related to systemd.
SSHD (and other login programs) might be (trying to) dbus chat to systemd logind, and systemd logind needs to be able to "start" the session manager. (although that should not prevent the login)
So i think there are two issue here. The labeling issue, which prevents the login, and the issue that causes systemd to print "systemd[1]:
SELinux denied access."
I might be wrong...
Quoted 6 lines · Steve Lawrence
Ah, interesting. We saw that problem a long time ago, but couldn't reproduce it and it disappeared. Though I'm still unable to reproduce it following your steps. I can still login and seusers is labeled
selinux_config_t. I'll keep looking into this.I've also rebased/pushed #integration onto #next.
# Revert to stock F20 SELinux userspace and policy. yum reinstall checkpolicy* libsepol* libsemanage* libselinux* policycoreutils* selinux-policy-targeted
# Clear prior source/CIL policy store.
rm -rf /var/lib/selinux
# Reboot to ensure systemd and friends are using the new policy. reboot
# Reset selinux and cil to latest sources
cd selinux
git clean -fdx
git fetch origin
git reset --hard origin/integration
cd ../cil
git clean -fdx
git fetch origin
git reset --hard origin/master
# Build and install new userspace
cd ..
ln -sf ../../cil selinux/libsepol/cil
make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap relabel
# Convert
./selinux/libsemanage/utils/semanage_migrate_etc_to_var.py
Try to login on console or via ssh: Unable to get valid context for sds.
dmesg | grep systemd
[ 343.739985] systemd[1]: SELinux policy denies access. [ 348.256030] systemd[1]: SELinux policy denies access. [ 376.335248] systemd[1]: SELinux policy denies access. [ 376.515343] systemd[1]: SELinux policy denies access.
restorecon -R /etc/selinux/targeted
Try to login again, hangs for a long time before finally succeeding.
reboot
Everything is happy.
100% reproducible, every time.
Quoted 47 lines · Stephen Smalley
Quoted 6 lines · Steve Lawrence
Ah, interesting. We saw that problem a long time ago, but couldn't reproduce it and it disappeared. Though I'm still unable to reproduce it following your steps. I can still login and seusers is labeled
selinux_config_t. I'll keep looking into this.I've also rebased/pushed #integration onto #next.
# Revert to stock F20 SELinux userspace and policy. yum reinstall checkpolicy* libsepol* libsemanage* libselinux* policycoreutils* selinux-policy-targeted
# Clear prior source/CIL policy store.
rm -rf/var/lib/selinux# Reboot to ensure systemd and friends are using the new policy. reboot
# Reset selinux and cil to latest sources
cd selinux
git clean -fdx
git fetch origin
git reset --hard origin/integration
cd ../cil
git clean -fdx
git fetch origin
git reset --hard origin/master# Build and install new userspace
cd ..
ln -sf ../../cil selinux/libsepol/cil
make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap relabel# Convert
./selinux/libsemanage/utils/semanage_migrate_etc_to_var.pyTry to login on console or via ssh: Unable to get valid context for sds.
dmesg | grep systemd
[ 343.739985] systemd[1]: SELinux policy denies access. [ 348.256030] systemd[1]: SELinux policy denies access. [ 376.335248] systemd[1]: SELinux policy denies access. [ 376.515343] systemd[1]: SELinux policy denies access.restorecon -R
/etc/selinux/targeted
Quoted 9 lines
Try to login again, hangs for a long time before finally succeeding.
reboot
Everything is happy.
100% reproducible, every time.
Thanks for the steps. I think I found what causes the labeling problem, but I'm not yet sure why. It looks like it has something to do with how the migration script rebuilds policy. If you run the migration script with the --norebuild flag, and then run semodule -B, everything is rebuilt and the files in /etc/selinux are labeled correctly.
I'm not yet convinced this is the same problem as the systemd issue (I do get "unable to get valid context", but I still don't get "SELinux policy denies access"). Let me know if you still see that after using --norebuild/semodule -B.
Quoted 64 lines · Steve Lawrence
Quoted 53 lines · Dominick Grift
Quoted 52 lines · Stephen Smalley
Quoted 50 lines · Dominick Grift
Quoted 29 lines · Stephen Smalley
Quoted 28 lines · Dominick Grift
Quoted 8 lines · Dominick Grift
On Thu, 2014-07-10 at 08:35 -0400, Stephen Smalley wrote:
<snip>
Quoted 3 lines
Thanks for testing it. How did it look from a performance POV, wrt memory use and runtime?
Quoted 10 lines
I have not (yet) really focused on that but i suppose there was no real noticeable slow down or speed up.
Any tips on how i could provide useful benchmarks?
I suppose i could enable the neverallow check
in/etc/selinux/semanage.confand i would bet it is now much faster than it used to be (in fact ill try that)I suspect i was lying.
I am installing a guest with similar specs now and same software except the cil mods and then do some comparison.
i suppose stuff like time semodule -B
and looking at topQuoted 11 lines
Quoted 4 lines
I did do a semodule -B with checking for neverallow rules but that found a violation really fast (thanks fedora). So although i cant really say how much faster that is , it is pretty safe to assume its much faster now
/usr/bin/timesetsebool -P httpd_can_network_connect=1 valgrind --tool=massif setsebool -P httpd_can_network_connect=1ms_printmassif.out.<pid>Will do that next.
I did a time semodule -B on similar configs (2 cores/2GB ram):
Result: cil seems faster but seems to take more memory:
CIL: real 0m13.XXXs (23% mem (of 2 GB)
REGULAR: real 0m21.XXXs (15% mem (of 2 GB)Quoted 9 lines
Quoted 5 lines
So, that's a concern, as we already have various bug reports on semodule and setsebool being killed by the OOM killer, e.g.
https://bugzilla.redhat.com/show_bug.cgi?id=1098446valgrind output:
Quoted 9 lines
We just pushed a commit to CIL that greatly reduces peak memory usage. Some quick testing brings the peak memory usage of compiling Fedora's policy from around 460MB down to around 260MB. So I think its now about on par with current userspace. We're also working on some other changes, but those require a bit more work and so might take a little longer. But I don't think those changes will get memory usage down significantly more (maybe down another 10-20MB), so I doubt this will do a whole lot in solving the OOM killer issue.
We recently pushed the second group of changes to reduce peak memory usage, and reduced it much more than we thought it would, reducing about 50MB. It now takes about 210MB to build current fedora policy, which is quite a bit less than the 15% of 2GB (~300MB) that Dominick saw.
Quoted 64 lines · Steve Lawrence
Quoted 47 lines · Stephen Smalley
Quoted 6 lines · Steve Lawrence
Ah, interesting. We saw that problem a long time ago, but couldn't reproduce it and it disappeared. Though I'm still unable to reproduce it following your steps. I can still login and seusers is labeled
selinux_config_t. I'll keep looking into this.I've also rebased/pushed #integration onto #next.
# Revert to stock F20 SELinux userspace and policy. yum reinstall checkpolicy* libsepol* libsemanage* libselinux* policycoreutils* selinux-policy-targeted
# Clear prior source/CIL policy store.
rm -rf/var/lib/selinux# Reboot to ensure systemd and friends are using the new policy. reboot
# Reset selinux and cil to latest sources
cd selinux
git clean -fdx
git fetch origin
git reset --hard origin/integration
cd ../cil
git clean -fdx
git fetch origin
git reset --hard origin/master# Build and install new userspace
cd ..
ln -sf ../../cil selinux/libsepol/cil
make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap relabel# Convert
./selinux/libsemanage/utils/semanage_migrate_etc_to_var.pyTry to login on console or via ssh: Unable to get valid context for sds.
dmesg | grep systemd
[ 343.739985] systemd[1]: SELinux policy denies access. [ 348.256030] systemd[1]: SELinux policy denies access. [ 376.335248] systemd[1]: SELinux policy denies access. [ 376.515343] systemd[1]: SELinux policy denies access.restorecon -R
/etc/selinux/targetedQuoted 9 lines
Try to login again, hangs for a long time before finally succeeding.
reboot
Everything is happy.
100% reproducible, every time.
Thanks for the steps. I think I found what causes the labeling problem, but I'm not yet sure why. It looks like it has something to do with how the migration script rebuilds policy. If you run the migration script with the --norebuild flag, and then run semodule -B, everything is rebuilt and the files in
/etc/selinuxare labeled correctly.
Quoted 4 lines
I'm not yet convinced this is the same problem as the systemd issue (I do get "unable to get valid context", but I still don't get "SELinux policy denies access"). Let me know if you still see that after using --norebuild/semodule -B.
Ok, if I do:./libsemanage/utils/semanage_migrate_etc_to_var.py -n semodule -B
then /etc/selinux is labeled correctly and I can still login. However, running su hangs and I get the systemd error message again.
Quoted 70 lines · Stephen Smalley
Quoted 64 lines · Steve Lawrence
Quoted 47 lines · Stephen Smalley
Quoted 6 lines · Steve Lawrence
Ah, interesting. We saw that problem a long time ago, but couldn't reproduce it and it disappeared. Though I'm still unable to reproduce it following your steps. I can still login and seusers is labeled
selinux_config_t. I'll keep looking into this.I've also rebased/pushed #integration onto #next.
# Revert to stock F20 SELinux userspace and policy. yum reinstall checkpolicy* libsepol* libsemanage* libselinux* policycoreutils* selinux-policy-targeted
# Clear prior source/CIL policy store.
rm -rf/var/lib/selinux# Reboot to ensure systemd and friends are using the new policy. reboot
# Reset selinux and cil to latest sources
cd selinux
git clean -fdx
git fetch origin
git reset --hard origin/integration
cd ../cil
git clean -fdx
git fetch origin
git reset --hard origin/master# Build and install new userspace
cd ..
ln -sf ../../cil selinux/libsepol/cil
make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap relabel# Convert
./selinux/libsemanage/utils/semanage_migrate_etc_to_var.pyTry to login on console or via ssh: Unable to get valid context for sds.
dmesg | grep systemd
[ 343.739985] systemd[1]: SELinux policy denies access. [ 348.256030] systemd[1]: SELinux policy denies access. [ 376.335248] systemd[1]: SELinux policy denies access. [ 376.515343] systemd[1]: SELinux policy denies access.restorecon -R
/etc/selinux/targetedQuoted 9 lines
Try to login again, hangs for a long time before finally succeeding.
reboot
Everything is happy.
100% reproducible, every time.
Thanks for the steps. I think I found what causes the labeling problem, but I'm not yet sure why. It looks like it has something to do with how the migration script rebuilds policy. If you run the migration script with the --norebuild flag, and then run semodule -B, everything is rebuilt and the files in
/etc/selinuxare labeled correctly.Quoted 4 lines
I'm not yet convinced this is the same problem as the systemd issue (I do get "unable to get valid context", but I still don't get "SELinux policy denies access"). Let me know if you still see that after using --norebuild/semodule -B.
Quoted 6 lines
Ok, if I do:
./libsemanage/utils/semanage_migrate_etc_to_var.py-n semodule -Bthen
/etc/selinuxis labeled correctly and I can still login. However, running su hangs and I get the systemd error message again.
Also get this:
ERROR:dbus.proxies:Introspect error on :1.4:/org/freedesktop/login1:
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
when trying to re-install the original selinux userspace packages. With more errors from systemd in dmesg,
[14421.297045] systemd[1]: SELinux policy denies access. [14451.711732] systemd[1]: SELinux policy denies access. [14451.743787] systemd[1]: SELinux policy denies access. [14512.551210] systemd[1]: SELinux policy denies access. [14512.584126] systemd[1]: SELinux policy denies access. [14543.063872] systemd[1]: SELinux policy denies access. [14634.451680] systemd[1]: SELinux policy denies access. [14634.469813] systemd[1]: SELinux policy denies access. [14659.346867] systemd[1]: SELinux policy denies access. [14659.665108] systemd[1]: SELinux policy denies access. [14695.602174] systemd[1]: SELinux policy denies access.
Quoted 87 lines · Stephen Smalley
Quoted 70 lines · Stephen Smalley
Quoted 64 lines · Steve Lawrence
Quoted 47 lines · Stephen Smalley
Quoted 6 lines · Steve Lawrence
Ah, interesting. We saw that problem a long time ago, but couldn't reproduce it and it disappeared. Though I'm still unable to reproduce it following your steps. I can still login and seusers is labeled
selinux_config_t. I'll keep looking into this.I've also rebased/pushed #integration onto #next.
# Revert to stock F20 SELinux userspace and policy. yum reinstall checkpolicy* libsepol* libsemanage* libselinux* policycoreutils* selinux-policy-targeted
# Clear prior source/CIL policy store.
rm -rf/var/lib/selinux# Reboot to ensure systemd and friends are using the new policy. reboot
# Reset selinux and cil to latest sources
cd selinux
git clean -fdx
git fetch origin
git reset --hard origin/integration
cd ../cil
git clean -fdx
git fetch origin
git reset --hard origin/master# Build and install new userspace
cd ..
ln -sf ../../cil selinux/libsepol/cil
make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap relabel# Convert
./selinux/libsemanage/utils/semanage_migrate_etc_to_var.pyTry to login on console or via ssh: Unable to get valid context for sds.
dmesg | grep systemd
[ 343.739985] systemd[1]: SELinux policy denies access. [ 348.256030] systemd[1]: SELinux policy denies access. [ 376.335248] systemd[1]: SELinux policy denies access. [ 376.515343] systemd[1]: SELinux policy denies access.restorecon -R
/etc/selinux/targetedQuoted 9 lines
Try to login again, hangs for a long time before finally succeeding.
reboot
Everything is happy.
100% reproducible, every time.
Thanks for the steps. I think I found what causes the labeling problem, but I'm not yet sure why. It looks like it has something to do with how the migration script rebuilds policy. If you run the migration script with the --norebuild flag, and then run semodule -B, everything is rebuilt and the files in
/etc/selinuxare labeled correctly.Quoted 4 lines
I'm not yet convinced this is the same problem as the systemd issue (I do get "unable to get valid context", but I still don't get "SELinux policy denies access"). Let me know if you still see that after using --norebuild/semodule -B.
Quoted 6 lines
Ok, if I do:
./libsemanage/utils/semanage_migrate_etc_to_var.py-n semodule -Bthen
/etc/selinuxis labeled correctly and I can still login. However, running su hangs and I get the systemd error message again.Also get this:
ERROR:dbus.proxies:Introspect error on :1.4:/org/freedesktop/login1:
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.when trying to re-install the original selinux userspace packages. With more errors from systemd in dmesg,
Quoted 11 lines
[14421.297045] systemd[1]: SELinux policy denies access. [14451.711732] systemd[1]: SELinux policy denies access. [14451.743787] systemd[1]: SELinux policy denies access. [14512.551210] systemd[1]: SELinux policy denies access. [14512.584126] systemd[1]: SELinux policy denies access. [14543.063872] systemd[1]: SELinux policy denies access. [14634.451680] systemd[1]: SELinux policy denies access. [14634.469813] systemd[1]: SELinux policy denies access. [14659.346867] systemd[1]: SELinux policy denies access. [14659.665108] systemd[1]: SELinux policy denies access. [14695.602174] systemd[1]: SELinux policy denies access.
journalctl -r shows an additional error message for each of these denials:
systemd-logind[913]: Failed to query ActiveState: Access denied
Quoted 100 lines · Stephen Smalley
Quoted 87 lines · Stephen Smalley
Quoted 70 lines · Stephen Smalley
Quoted 64 lines · Steve Lawrence
Quoted 47 lines · Stephen Smalley
Quoted 6 lines · Steve Lawrence
Ah, interesting. We saw that problem a long time ago, but couldn't reproduce it and it disappeared. Though I'm still unable to reproduce it following your steps. I can still login and seusers is labeled
selinux_config_t. I'll keep looking into this.I've also rebased/pushed #integration onto #next.
# Revert to stock F20 SELinux userspace and policy. yum reinstall checkpolicy* libsepol* libsemanage* libselinux* policycoreutils* selinux-policy-targeted
# Clear prior source/CIL policy store.
rm -rf/var/lib/selinux# Reboot to ensure systemd and friends are using the new policy. reboot
# Reset selinux and cil to latest sources
cd selinux
git clean -fdx
git fetch origin
git reset --hard origin/integration
cd ../cil
git clean -fdx
git fetch origin
git reset --hard origin/master# Build and install new userspace
cd ..
ln -sf ../../cil selinux/libsepol/cil
make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap relabel# Convert
./selinux/libsemanage/utils/semanage_migrate_etc_to_var.pyTry to login on console or via ssh: Unable to get valid context for sds.
dmesg | grep systemd
[ 343.739985] systemd[1]: SELinux policy denies access. [ 348.256030] systemd[1]: SELinux policy denies access. [ 376.335248] systemd[1]: SELinux policy denies access. [ 376.515343] systemd[1]: SELinux policy denies access.restorecon -R
/etc/selinux/targetedQuoted 9 lines
Try to login again, hangs for a long time before finally succeeding.
reboot
Everything is happy.
100% reproducible, every time.
Thanks for the steps. I think I found what causes the labeling problem, but I'm not yet sure why. It looks like it has something to do with how the migration script rebuilds policy. If you run the migration script with the --norebuild flag, and then run semodule -B, everything is rebuilt and the files in
/etc/selinuxare labeled correctly.Quoted 4 lines
I'm not yet convinced this is the same problem as the systemd issue (I do get "unable to get valid context", but I still don't get "SELinux policy denies access"). Let me know if you still see that after using --norebuild/semodule -B.
Quoted 6 lines
Ok, if I do:
./libsemanage/utils/semanage_migrate_etc_to_var.py-n semodule -Bthen
/etc/selinuxis labeled correctly and I can still login. However, running su hangs and I get the systemd error message again.Also get this:
ERROR:dbus.proxies:Introspect error on :1.4:/org/freedesktop/login1:
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.when trying to re-install the original selinux userspace packages. With more errors from systemd in dmesg,
Quoted 11 lines
[14421.297045] systemd[1]: SELinux policy denies access. [14451.711732] systemd[1]: SELinux policy denies access. [14451.743787] systemd[1]: SELinux policy denies access. [14512.551210] systemd[1]: SELinux policy denies access. [14512.584126] systemd[1]: SELinux policy denies access. [14543.063872] systemd[1]: SELinux policy denies access. [14634.451680] systemd[1]: SELinux policy denies access. [14634.469813] systemd[1]: SELinux policy denies access. [14659.346867] systemd[1]: SELinux policy denies access. [14659.665108] systemd[1]: SELinux policy denies access. [14695.602174] systemd[1]: SELinux policy denies access.
Quoted 2 lines
journalctl -r shows an additional error message for each of these denials:
systemd-logind[913]: Failed to query ActiveState: Access denied
ausearch -m USER_AVC reports:
type=USER_AVC msg=audit(1405520109.191:1031): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc: denied { status } for auid=-1 uid=-1 gid=-1 scontext=system_u:system_r:systemd_logind_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=service exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
Quoted 104 lines · Stephen Smalley
Quoted 100 lines · Stephen Smalley
Quoted 87 lines · Stephen Smalley
Quoted 70 lines · Stephen Smalley
Quoted 64 lines · Steve Lawrence
Quoted 47 lines · Stephen Smalley
Quoted 6 lines · Steve Lawrence
Ah, interesting. We saw that problem a long time ago, but couldn't reproduce it and it disappeared. Though I'm still unable to reproduce it following your steps. I can still login and seusers is labeled
selinux_config_t. I'll keep looking into this.I've also rebased/pushed #integration onto #next.
# Revert to stock F20 SELinux userspace and policy. yum reinstall checkpolicy* libsepol* libsemanage* libselinux* policycoreutils* selinux-policy-targeted
# Clear prior source/CIL policy store.
rm -rf/var/lib/selinux# Reboot to ensure systemd and friends are using the new policy. reboot
# Reset selinux and cil to latest sources
cd selinux
git clean -fdx
git fetch origin
git reset --hard origin/integration
cd ../cil
git clean -fdx
git fetch origin
git reset --hard origin/master# Build and install new userspace
cd ..
ln -sf ../../cil selinux/libsepol/cil
make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap relabel# Convert
./selinux/libsemanage/utils/semanage_migrate_etc_to_var.pyTry to login on console or via ssh: Unable to get valid context for sds.
dmesg | grep systemd
[ 343.739985] systemd[1]: SELinux policy denies access. [ 348.256030] systemd[1]: SELinux policy denies access. [ 376.335248] systemd[1]: SELinux policy denies access. [ 376.515343] systemd[1]: SELinux policy denies access.restorecon -R
/etc/selinux/targetedQuoted 9 lines
Try to login again, hangs for a long time before finally succeeding.
reboot
Everything is happy.
100% reproducible, every time.
Thanks for the steps. I think I found what causes the labeling problem, but I'm not yet sure why. It looks like it has something to do with how the migration script rebuilds policy. If you run the migration script with the --norebuild flag, and then run semodule -B, everything is rebuilt and the files in
/etc/selinuxare labeled correctly.Quoted 4 lines
I'm not yet convinced this is the same problem as the systemd issue (I do get "unable to get valid context", but I still don't get "SELinux policy denies access"). Let me know if you still see that after using --norebuild/semodule -B.
Quoted 6 lines
Ok, if I do:
./libsemanage/utils/semanage_migrate_etc_to_var.py-n semodule -Bthen
/etc/selinuxis labeled correctly and I can still login. However, running su hangs and I get the systemd error message again.Also get this:
ERROR:dbus.proxies:Introspect error on :1.4:/org/freedesktop/login1:
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.when trying to re-install the original selinux userspace packages. With more errors from systemd in dmesg,
Quoted 11 lines
[14421.297045] systemd[1]: SELinux policy denies access. [14451.711732] systemd[1]: SELinux policy denies access. [14451.743787] systemd[1]: SELinux policy denies access. [14512.551210] systemd[1]: SELinux policy denies access. [14512.584126] systemd[1]: SELinux policy denies access. [14543.063872] systemd[1]: SELinux policy denies access. [14634.451680] systemd[1]: SELinux policy denies access. [14634.469813] systemd[1]: SELinux policy denies access. [14659.346867] systemd[1]: SELinux policy denies access. [14659.665108] systemd[1]: SELinux policy denies access. [14695.602174] systemd[1]: SELinux policy denies access.Quoted 2 lines
journalctl -r shows an additional error message for each of these denials:
systemd-logind[913]: Failed to query ActiveState: Access denied
Quoted 8 lines
ausearch -m
USER_AVCreports:
type=USER_AVC msg=audit(1405520109.191:1031): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc: denied { status } for auid=-1 uid=-1 gid=-1 scontext=system_u:system_r:systemd_logind_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=service exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
Hmm. I still can't get this error. The only thing I get with ausearch is
type=USER_AVC msg=audit(1405522202.264:463): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='Unknown permission start for class system exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
Which looks correct. Fedora's latest policy does not include start in the system class:
$ seinfo -csystem -x
system
status
module_request
reboot
disable
enable
undefined
ipc_info
syslog_read
halt
reload
syslog_console
syslog_modAlso, the policy built with CIL on my machine allows the USER_AVC you're seeing:
$ sesearch -A -s systemd_logind_t -t init_t -c service
Found 2 semantic av rules:
allow systemd_domain init_t : service { stop status reload start } ;
allow systemd_logind_t init_t : service status ;Not sure if this would help, but it looks like you can set the boot parameter systemd.log_level=debug, and it should print all the selinux access checks, including which ones cause the "SELinux policy denies access" message. Unfortunately, I think the extra debug messages prevents my VM from booting, but you might have better luck.
Quoted 64 lines · Steve Lawrence
Quoted 47 lines · Stephen Smalley
Quoted 6 lines · Steve Lawrence
Ah, interesting. We saw that problem a long time ago, but couldn't reproduce it and it disappeared. Though I'm still unable to reproduce it following your steps. I can still login and seusers is labeled
selinux_config_t. I'll keep looking into this.I've also rebased/pushed #integration onto #next.
# Revert to stock F20 SELinux userspace and policy. yum reinstall checkpolicy* libsepol* libsemanage* libselinux* policycoreutils* selinux-policy-targeted
# Clear prior source/CIL policy store.
rm -rf/var/lib/selinux# Reboot to ensure systemd and friends are using the new policy. reboot
# Reset selinux and cil to latest sources
cd selinux
git clean -fdx
git fetch origin
git reset --hard origin/integration
cd ../cil
git clean -fdx
git fetch origin
git reset --hard origin/master# Build and install new userspace
cd ..
ln -sf ../../cil selinux/libsepol/cil
make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap relabel# Convert
./selinux/libsemanage/utils/semanage_migrate_etc_to_var.pyTry to login on console or via ssh: Unable to get valid context for sds.
dmesg | grep systemd
[ 343.739985] systemd[1]: SELinux policy denies access. [ 348.256030] systemd[1]: SELinux policy denies access. [ 376.335248] systemd[1]: SELinux policy denies access. [ 376.515343] systemd[1]: SELinux policy denies access.restorecon -R
/etc/selinux/targetedQuoted 9 lines
Try to login again, hangs for a long time before finally succeeding.
reboot
Everything is happy.
100% reproducible, every time.
Thanks for the steps. I think I found what causes the labeling problem, but I'm not yet sure why. It looks like it has something to do with how the migration script rebuilds policy. If you run the migration script with the --norebuild flag, and then run semodule -B, everything is rebuilt and the files in
/etc/selinuxare labeled correctly.
Quoted 4 lines
I'm not yet convinced this is the same problem as the systemd issue (I do get "unable to get valid context", but I still don't get "SELinux policy denies access"). Let me know if you still see that after using --norebuild/semodule -B.
This issue has been fixed and rebased/pushed to the #integration branch. The problem was that the migration script called setfscreatecon to ensure file contexts in the new store were correct. However, it never reset the fs create context, so when it rebuilt policy after migration, all files were created with semanage_store_t instead of using default labeling rules/transitions.
On Wed, 2014-07-16 at 11:11 -0400, Steve Lawrence wrote:
<snip>
Quoted 35 lines
Hmm. I still can't get this error. The only thing I get with ausearch is
type=USER_AVC msg=audit(1405522202.264:463): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='Unknown permission start for class system exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
Which looks correct. Fedora's latest policy does not include start in the system class:
$ seinfo -csystem -x system status module_request reboot disable enable undefined ipc_info syslog_read halt reload syslog_console syslog_modAlso, the policy built with CIL on my machine allows the
USER_AVCyou're seeing:$ sesearch -A -s systemd_logind_t -t init_t -c service Found 2 semantic av rules: allow systemd_domain init_t : service { stop status reload start } ; allow systemd_logind_t init_t : service status ;
Quoted 6 lines
Not sure if this would help, but it looks like you can set the boot parameter systemd.log_level=debug, and it should print all the selinux access checks, including which ones cause the "SELinux policy denies access" message. Unfortunately, I think the extra debug messages prevents my VM from booting, but you might have better luck.
The same symptoms as with the classorder issue except that this time it only happens once after the upgrade. Rebooting fixes the issue (?)
That was not the case with the classorder issue.
Quoted 44 lines · Dominick Grift
On Wed, 2014-07-16 at 11:11 -0400, Steve Lawrence wrote:
<snip>Quoted 35 lines
Hmm. I still can't get this error. The only thing I get with ausearch is
type=USER_AVC msg=audit(1405522202.264:463): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='Unknown permission start for class system exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
Which looks correct. Fedora's latest policy does not include start in the system class:
$ seinfo -csystem -x system status module_request reboot disable enable undefined ipc_info syslog_read halt reload syslog_console syslog_modAlso, the policy built with CIL on my machine allows the
USER_AVCyou're seeing:$ sesearch -A -s systemd_logind_t -t init_t -c service Found 2 semantic av rules: allow systemd_domain init_t : service { stop status reload start } ; allow systemd_logind_t init_t : service status ;Quoted 6 lines
Not sure if this would help, but it looks like you can set the boot parameter systemd.log_level=debug, and it should print all the selinux access checks, including which ones cause the "SELinux policy denies access" message. Unfortunately, I think the extra debug messages prevents my VM from booting, but you might have better luck.
Quoted 6 lines
The same symptoms as with the classorder issue except that this time it only happens once after the upgrade. Rebooting fixes the issue (?)
That was not the case with the classorder issue.
I meant the boolean issue. (access denied whilst rules to allow are present)
I have a feeling that this is caused by the migration script since i have no issues on my systems with plain secilc, load_policy.
Quoted 44 lines · Dominick Grift
On Wed, 2014-07-16 at 11:11 -0400, Steve Lawrence wrote:
<snip>Quoted 35 lines
Hmm. I still can't get this error. The only thing I get with ausearch is
type=USER_AVC msg=audit(1405522202.264:463): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='Unknown permission start for class system exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
Which looks correct. Fedora's latest policy does not include start in the system class:
$ seinfo -csystem -x system status module_request reboot disable enable undefined ipc_info syslog_read halt reload syslog_console syslog_modAlso, the policy built with CIL on my machine allows the
USER_AVCyou're seeing:$ sesearch -A -s systemd_logind_t -t init_t -c service Found 2 semantic av rules: allow systemd_domain init_t : service { stop status reload start } ; allow systemd_logind_t init_t : service status ;Quoted 6 lines
Not sure if this would help, but it looks like you can set the boot parameter systemd.log_level=debug, and it should print all the selinux access checks, including which ones cause the "SELinux policy denies access" message. Unfortunately, I think the extra debug messages prevents my VM from booting, but you might have better luck.
Quoted 4 lines
The same symptoms as with the classorder issue except that this time it only happens once after the upgrade. Rebooting fixes the issue (?)
That was not the case with the classorder issue.
$ yum reinstall checkpolicy* libsepol* libsemanage* libselinux* policycoreutils* selinux-policy-targeted $ cp -a /sys/fs/selinux/class class.orig $ make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap relabel $ ./selinux/libsemanage/utils/semanage_migrate_etc_to_var.py $ cp -a /sys/fs/selinux/class class.new $ diff -ru class.orig class.new
Lots of differences in permission values.
Quoted 59 lines · Stephen Smalley
Quoted 44 lines · Dominick Grift
On Wed, 2014-07-16 at 11:11 -0400, Steve Lawrence wrote:
<snip>Quoted 35 lines
Hmm. I still can't get this error. The only thing I get with ausearch is
type=USER_AVC msg=audit(1405522202.264:463): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='Unknown permission start for class system exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
Which looks correct. Fedora's latest policy does not include start in the system class:
$ seinfo -csystem -x system status module_request reboot disable enable undefined ipc_info syslog_read halt reload syslog_console syslog_modAlso, the policy built with CIL on my machine allows the
USER_AVCyou're seeing:$ sesearch -A -s systemd_logind_t -t init_t -c service Found 2 semantic av rules: allow systemd_domain init_t : service { stop status reload start } ; allow systemd_logind_t init_t : service status ;Quoted 6 lines
Not sure if this would help, but it looks like you can set the boot parameter systemd.log_level=debug, and it should print all the selinux access checks, including which ones cause the "SELinux policy denies access" message. Unfortunately, I think the extra debug messages prevents my VM from booting, but you might have better luck.
Quoted 4 lines
The same symptoms as with the classorder issue except that this time it only happens once after the upgrade. Rebooting fixes the issue (?)
That was not the case with the classorder issue.
$ yum reinstall checkpolicy* libsepol* libsemanage* libselinux* policycoreutils* selinux-policy-targeted $ cp -a /sys/fs/selinux/class class.orig $ make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap relabel $ ./selinux/libsemanage/utils/semanage_migrate_etc_to_var.py $ cp -a /sys/fs/selinux/class class.new $ diff -ru class.orig class.new
Quoted 2 lines
Lots of differences in permission values.
Nice find! This looks like it's the problem. When we convert the base pp to CIL, the permissions are output to CIL in the order that hashtab_map receives them, which is is not in any particular order. So the permission orders are all wrong, causing the values in the binary to be different. I guess the kernel doesn't like when permission values change when loading a new policy. And this explains why things work following a reboot.
We've updated the pp2cil compiler to sort the permissions and output them in the correct order. This change has been rebased and pushed to the integration branch on github.
Thanks,
- Steve
Quoted 63 lines · Steve Lawrence
Quoted 59 lines · Stephen Smalley
Quoted 44 lines · Dominick Grift
On Wed, 2014-07-16 at 11:11 -0400, Steve Lawrence wrote:
<snip>Quoted 35 lines
Hmm. I still can't get this error. The only thing I get with ausearch is
type=USER_AVC msg=audit(1405522202.264:463): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='Unknown permission start for class system exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
Which looks correct. Fedora's latest policy does not include start in the system class:
$ seinfo -csystem -x system status module_request reboot disable enable undefined ipc_info syslog_read halt reload syslog_console syslog_modAlso, the policy built with CIL on my machine allows the
USER_AVCyou're seeing:$ sesearch -A -s systemd_logind_t -t init_t -c service Found 2 semantic av rules: allow systemd_domain init_t : service { stop status reload start } ; allow systemd_logind_t init_t : service status ;Quoted 6 lines
Not sure if this would help, but it looks like you can set the boot parameter systemd.log_level=debug, and it should print all the selinux access checks, including which ones cause the "SELinux policy denies access" message. Unfortunately, I think the extra debug messages prevents my VM from booting, but you might have better luck.
Quoted 4 lines
The same symptoms as with the classorder issue except that this time it only happens once after the upgrade. Rebooting fixes the issue (?)
That was not the case with the classorder issue.
$ yum reinstall checkpolicy* libsepol* libsemanage* libselinux* policycoreutils* selinux-policy-targeted $ cp -a /sys/fs/selinux/class class.orig $ make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap relabel $ ./selinux/libsemanage/utils/semanage_migrate_etc_to_var.py $ cp -a /sys/fs/selinux/class class.new $ diff -ru class.orig class.newQuoted 2 lines
Lots of differences in permission values.
Quoted 7 lines
Nice find! This looks like it's the problem. When we convert the base pp to CIL, the permissions are output to CIL in the order that
hashtab_mapreceives them, which is is not in any particular order. So the permission orders are all wrong, causing the values in the binary to be different. I guess the kernel doesn't like when permission values change when loading a new policy. And this explains why things work following a reboot.
I think the kernel is fine with it, but not all userspace object managers will be. Legacy userspace object managers may still be using fixed permission values from selinux/av_permissions.h, and even modern ones may be only mapping classes/permissions once at startup (via selinux_set_mapping) and then assuming that this mapping is stable at runtime. Even for userspace object managers that are using selinux_check_access(), libselinux/src/stringrep.c currently caches the class/perm values on first lookup and does not flush this cache from avc_reset upon policy reload notification - that's likely a bug that should be fixed. But even if we fix it there, there is no current atomicity provided within selinux_check_access() around the class/perm lookup and the AVC lookup so they could end up being inconsistent. In short, we don't currently guarantee that changing class/perm values at runtime without a reboot will work.
Quoted 3 lines
We've updated the pp2cil compiler to sort the permissions and output them in the correct order. This change has been rebased and pushed to the integration branch on github.
Quoted 71 lines · Steve Lawrence
Quoted 59 lines · Stephen Smalley
Quoted 44 lines · Dominick Grift
On Wed, 2014-07-16 at 11:11 -0400, Steve Lawrence wrote:
<snip>Quoted 35 lines
Hmm. I still can't get this error. The only thing I get with ausearch is
type=USER_AVC msg=audit(1405522202.264:463): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='Unknown permission start for class system exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
Which looks correct. Fedora's latest policy does not include start in the system class:
$ seinfo -csystem -x system status module_request reboot disable enable undefined ipc_info syslog_read halt reload syslog_console syslog_modAlso, the policy built with CIL on my machine allows the
USER_AVCyou're seeing:$ sesearch -A -s systemd_logind_t -t init_t -c service Found 2 semantic av rules: allow systemd_domain init_t : service { stop status reload start } ; allow systemd_logind_t init_t : service status ;Quoted 6 lines
Not sure if this would help, but it looks like you can set the boot parameter systemd.log_level=debug, and it should print all the selinux access checks, including which ones cause the "SELinux policy denies access" message. Unfortunately, I think the extra debug messages prevents my VM from booting, but you might have better luck.
Quoted 4 lines
The same symptoms as with the classorder issue except that this time it only happens once after the upgrade. Rebooting fixes the issue (?)
That was not the case with the classorder issue.
$ yum reinstall checkpolicy* libsepol* libsemanage* libselinux* policycoreutils* selinux-policy-targeted $ cp -a /sys/fs/selinux/class class.orig $ make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap relabel $ ./selinux/libsemanage/utils/semanage_migrate_etc_to_var.py $ cp -a /sys/fs/selinux/class class.new $ diff -ru class.orig class.newQuoted 2 lines
Lots of differences in permission values.
Nice find! This looks like it's the problem. When we convert the base pp to CIL, the permissions are output to CIL in the order that
hashtab_mapreceives them, which is is not in any particular order. So the permission orders are all wrong, causing the values in the binary to be different. I guess the kernel doesn't like when permission values change when loading a new policy. And this explains why things work following a reboot.
Quoted 3 lines
We've updated the pp2cil compiler to sort the permissions and output them in the correct order. This change has been rebased and pushed to the integration branch on github.
Ok, so I think this resolves the issues I noticed.
What other known issues remain unresolved? Is there any functionality known to be missing that was supported by the old policy toolchain?
What new functionality is included here that was not previously supported by the old policy toolchain?
Any chance of getting a hll compiler for refpolicy source modules, i.e. in .if/.te/.fc form?
Quoted 72 lines · Stephen Smalley
Quoted 71 lines · Steve Lawrence
Quoted 59 lines · Stephen Smalley
Quoted 44 lines · Dominick Grift
On Wed, 2014-07-16 at 11:11 -0400, Steve Lawrence wrote:
<snip>Quoted 35 lines
Hmm. I still can't get this error. The only thing I get with ausearch is
type=USER_AVC msg=audit(1405522202.264:463): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='Unknown permission start for class system exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
Which looks correct. Fedora's latest policy does not include start in the system class:
$ seinfo -csystem -x system status module_request reboot disable enable undefined ipc_info syslog_read halt reload syslog_console syslog_modAlso, the policy built with CIL on my machine allows the
USER_AVCyou're seeing:$ sesearch -A -s systemd_logind_t -t init_t -c service Found 2 semantic av rules: allow systemd_domain init_t : service { stop status reload start } ; allow systemd_logind_t init_t : service status ;Quoted 6 lines
Not sure if this would help, but it looks like you can set the boot parameter systemd.log_level=debug, and it should print all the selinux access checks, including which ones cause the "SELinux policy denies access" message. Unfortunately, I think the extra debug messages prevents my VM from booting, but you might have better luck.
Quoted 4 lines
The same symptoms as with the classorder issue except that this time it only happens once after the upgrade. Rebooting fixes the issue (?)
That was not the case with the classorder issue.
$ yum reinstall checkpolicy* libsepol* libsemanage* libselinux* policycoreutils* selinux-policy-targeted $ cp -a /sys/fs/selinux/class class.orig $ make -C selinux LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap relabel $ ./selinux/libsemanage/utils/semanage_migrate_etc_to_var.py $ cp -a /sys/fs/selinux/class class.new $ diff -ru class.orig class.newQuoted 2 lines
Lots of differences in permission values.
Nice find! This looks like it's the problem. When we convert the base pp to CIL, the permissions are output to CIL in the order that
hashtab_mapreceives them, which is is not in any particular order. So the permission orders are all wrong, causing the values in the binary to be different. I guess the kernel doesn't like when permission values change when loading a new policy. And this explains why things work following a reboot.
Quoted 5 lines
Quoted 3 lines
We've updated the pp2cil compiler to sort the permissions and output them in the correct order. This change has been rebased and pushed to the integration branch on github.
Ok, so I think this resolves the issues I noticed.
Great!
Quoted 2 lines
What other known issues remain unresolved? Is there any functionality known to be missing that was supported by the old policy toolchain?
I think the only remaining issue is the one Dominick mentioned in his first email regarding file_contexts.homedirs. I don't think this is an actual bug, just the migration script migrating things that don't need to be migrated. Still investigating it. We should have an update sometime tomorrow.
Quoted 2 lines
What new functionality is included here that was not previously supported by the old policy toolchain?
In terms a user would see, the most visible change is support for CIL policies and HLLs, of which there's only one right now (pp2cil). There are also some new semanage.conf options (target-platform, compiler-dir, ignore-module-cache, store-root) but I imagine the vast majority of people could just use the defaults. Similarly, we've added --ignore-module-cache and --store-root to the semodule command. We've also moved the store to /var/lib/selinux, but this is more behind the scenes and should really only affect distributions.
Though, there are two things we just realized have a different behavior.
1) verify_modules is now performed on the CIL modules, rather than pp (or HLL) modules. So if someone is using verify_modules, things will probably break. I'm not sure if anyone uses this feature or how important it is that we maintain backwards compatibility.
2) verify_linked is no longer called, since there isn't any concept of a linked base module with CIL
Aside from that, I think all functionality should remain the same.
Quoted 2 lines
Any chance of getting a hll compiler for refpolicy source modules, i.e. in .if/.te/.fc form?
That's in the plan. Jim has a tool that will compile .if/.te/.fc to CIL, but the current HLL infrastructure may need some changes before that can be supported. I think the main problem is that Jim's tool needs knowledge of all modules to be able to convert them to CIL, but the current HLL infrastructure compiles each module separately. We have various ideas on how we can update the HLL infrastructure to support this, but we've primarily been focused on getting the core CIL/HLL functionality complete and upstreamed before focusing on the more complicated HLL patterns.
Quoted 5 lines · Steve Lawrence
I think the only remaining issue is the one Dominick mentioned in his first email regarding file_contexts.homedirs. I don't think this is an actual bug, just the migration script migrating things that don't need to be migrated. Still investigating it. We should have an update sometime tomorrow.
So everything you reverted you restored in equivalent form?
Quoted 11 lines
Quoted 2 lines
What new functionality is included here that was not previously supported by the old policy toolchain?
In terms a user would see, the most visible change is support for CIL policies and HLLs, of which there's only one right now (pp2cil). There are also some new semanage.conf options (target-platform, compiler-dir, ignore-module-cache, store-root) but I imagine the vast majority of people could just use the defaults. Similarly, we've added --ignore-module-cache and --store-root to the semodule command. We've also moved the store to
/var/lib/selinux, but this is more behind the scenes and should really only affect distributions.
What about new features/options of the user-facing commands? I know some features were copied from earlier source/CIL releases into the main selinux userspace (e.g. enabled/disabled modules), but aren't some things like module priorities new?
Quoted 11 lines
Though, there are two things we just realized have a different behavior.
1)
verify_modulesis now performed on the CIL modules, rather than pp (or HLL) modules. So if someone is usingverify_modules, things will probably break. I'm not sure if anyone uses this feature or how important it is that we maintain backwards compatibility.2)
verify_linkedis no longer called, since there isn't any concept of a linked base module with CILAside from that, I think all functionality should remain the same.
I'm not aware of anyone using anything other than verify kernel.
Quoted 12 lines
Quoted 2 lines
Any chance of getting a hll compiler for refpolicy source modules, i.e. in .if/.te/.fc form?
That's in the plan. Jim has a tool that will compile .if/.te/.fc to CIL, but the current HLL infrastructure may need some changes before that can be supported. I think the main problem is that Jim's tool needs knowledge of all modules to be able to convert them to CIL, but the current HLL infrastructure compiles each module separately. We have various ideas on how we can update the HLL infrastructure to support this, but we've primarily been focused on getting the core CIL/HLL functionality complete and upstreamed before focusing on the more complicated HLL patterns.
Ok. Ultimately audit2allow -M i.e. sepolgen module compiler should be re-tooled to generate source modules, and we'll essentially need a workflow that replaces the old make -f /usr/share/selinux/devel/Makefile mymodule.pp; semodule -i mymodule.pp.
Quoted 53 lines · Stephen Smalley
Quoted 5 lines · Steve Lawrence
I think the only remaining issue is the one Dominick mentioned in his first email regarding file_contexts.homedirs. I don't think this is an actual bug, just the migration script migrating things that don't need to be migrated. Still investigating it. We should have an update sometime tomorrow.
So everything you reverted you restored in equivalent form?
Quoted 11 lines
Quoted 2 lines
What new functionality is included here that was not previously supported by the old policy toolchain?
In terms a user would see, the most visible change is support for CIL policies and HLLs, of which there's only one right now (pp2cil). There are also some new semanage.conf options (target-platform, compiler-dir, ignore-module-cache, store-root) but I imagine the vast majority of people could just use the defaults. Similarly, we've added --ignore-module-cache and --store-root to the semodule command. We've also moved the store to
/var/lib/selinux, but this is more behind the scenes and should really only affect distributions.What about new features/options of the user-facing commands? I know some features were copied from earlier source/CIL releases into the main selinux userspace (e.g. enabled/disabled modules), but aren't some things like module priorities new?
Quoted 11 lines
Though, there are two things we just realized have a different behavior.
1)
verify_modulesis now performed on the CIL modules, rather than pp (or HLL) modules. So if someone is usingverify_modules, things will probably break. I'm not sure if anyone uses this feature or how important it is that we maintain backwards compatibility.2)
verify_linkedis no longer called, since there isn't any concept of a linked base module with CILAside from that, I think all functionality should remain the same.
I'm not aware of anyone using anything other than verify kernel.
Quoted 12 lines
Quoted 2 lines
Any chance of getting a hll compiler for refpolicy source modules, i.e. in .if/.te/.fc form?
That's in the plan. Jim has a tool that will compile .if/.te/.fc to CIL, but the current HLL infrastructure may need some changes before that can be supported. I think the main problem is that Jim's tool needs knowledge of all modules to be able to convert them to CIL, but the current HLL infrastructure compiles each module separately. We have various ideas on how we can update the HLL infrastructure to support this, but we've primarily been focused on getting the core CIL/HLL functionality complete and upstreamed before focusing on the more complicated HLL patterns.
Quoted 4 lines
Ok. Ultimately audit2allow -M i.e. sepolgen module compiler should be re-tooled to generate source modules, and we'll essentially need a workflow that replaces the old make -f
/usr/share/selinux/devel/Makefilemymodule.pp; semodule -i mymodule.pp.
I guess one other possible concern might be storage:
$ du -sh /etc/selinux/targeted/modules /var/lib/selinux/ 5.4M /etc/selinux/targeted/modules 11M /var/lib/selinux/
I'm guessing that is just the cost of storing each module in both binary and cil form?
Is there an option to discard the .pp files altogether and only retain the cil files?
Quoted 9 lines · Stephen Smalley
Quoted 5 lines · Steve Lawrence
I think the only remaining issue is the one Dominick mentioned in his first email regarding file_contexts.homedirs. I don't think this is an actual bug, just the migration script migrating things that don't need to be migrated. Still investigating it. We should have an update sometime tomorrow.
So everything you reverted you restored in equivalent form?
Yep. The only features reverted were enable/disable and semanage_set_root (multiple commits added these features, which is why there are 8 commits). Enable/disable as added back by the source policy work, and setmanage_set_root was manually added back.
Quoted 12 lines
Quoted 11 lines
Quoted 2 lines
What new functionality is included here that was not previously supported by the old policy toolchain?
In terms a user would see, the most visible change is support for CIL policies and HLLs, of which there's only one right now (pp2cil). There are also some new semanage.conf options (target-platform, compiler-dir, ignore-module-cache, store-root) but I imagine the vast majority of people could just use the defaults. Similarly, we've added --ignore-module-cache and --store-root to the semodule command. We've also moved the store to
/var/lib/selinux, but this is more behind the scenes and should really only affect distributions.
Quoted 4 lines
What about new features/options of the user-facing commands? I know some features were copied from earlier source/CIL releases into the main selinux userspace (e.g. enabled/disabled modules), but aren't some things like module priorities new?
Yes. The changes to semodule were:
New option -X, --priority to set the priority, defaults to 400. New option -C, --ignore_module_cache to ignore cached CIL modules to force recompilation.
Deprecated --base and --upgrade, which are both equivalent to --install. Versions are no longer output in semodule --list (they don't exist in CIL). The -l option can now accept a parameter (either "full" or "standard"). "standard" lists just active modules. This is the default if a parameter is not provided. "full" lists all modules, priorities, and high level language.
Changes to semanage:
- Add support for priorities with the module subcommand with the -X option
- Removes version references
- Modifies list to also output priority and hll
- Making a module permissive uses CIL instead of building a pp module
Quoted 31 lines
Quoted 11 lines
Though, there are two things we just realized have a different behavior.
1)
verify_modulesis now performed on the CIL modules, rather than pp (or HLL) modules. So if someone is usingverify_modules, things will probably break. I'm not sure if anyone uses this feature or how important it is that we maintain backwards compatibility.2)
verify_linkedis no longer called, since there isn't any concept of a linked base module with CILAside from that, I think all functionality should remain the same.
I'm not aware of anyone using anything other than verify kernel.
Quoted 12 lines
Quoted 2 lines
Any chance of getting a hll compiler for refpolicy source modules, i.e. in .if/.te/.fc form?
That's in the plan. Jim has a tool that will compile .if/.te/.fc to CIL, but the current HLL infrastructure may need some changes before that can be supported. I think the main problem is that Jim's tool needs knowledge of all modules to be able to convert them to CIL, but the current HLL infrastructure compiles each module separately. We have various ideas on how we can update the HLL infrastructure to support this, but we've primarily been focused on getting the core CIL/HLL functionality complete and upstreamed before focusing on the more complicated HLL patterns.
Ok. Ultimately audit2allow -M i.e. sepolgen module compiler should be re-tooled to generate source modules, and we'll essentially need a workflow that replaces the old make -f
/usr/share/selinux/devel/Makefilemymodule.pp; semodule -i mymodule.pp.
Quoted 59 lines · Stephen Smalley
Quoted 53 lines · Stephen Smalley
Quoted 5 lines · Steve Lawrence
I think the only remaining issue is the one Dominick mentioned in his first email regarding file_contexts.homedirs. I don't think this is an actual bug, just the migration script migrating things that don't need to be migrated. Still investigating it. We should have an update sometime tomorrow.
So everything you reverted you restored in equivalent form?
Quoted 11 lines
Quoted 2 lines
What new functionality is included here that was not previously supported by the old policy toolchain?
In terms a user would see, the most visible change is support for CIL policies and HLLs, of which there's only one right now (pp2cil). There are also some new semanage.conf options (target-platform, compiler-dir, ignore-module-cache, store-root) but I imagine the vast majority of people could just use the defaults. Similarly, we've added --ignore-module-cache and --store-root to the semodule command. We've also moved the store to
/var/lib/selinux, but this is more behind the scenes and should really only affect distributions.What about new features/options of the user-facing commands? I know some features were copied from earlier source/CIL releases into the main selinux userspace (e.g. enabled/disabled modules), but aren't some things like module priorities new?
Quoted 11 lines
Though, there are two things we just realized have a different behavior.
1)
verify_modulesis now performed on the CIL modules, rather than pp (or HLL) modules. So if someone is usingverify_modules, things will probably break. I'm not sure if anyone uses this feature or how important it is that we maintain backwards compatibility.2)
verify_linkedis no longer called, since there isn't any concept of a linked base module with CILAside from that, I think all functionality should remain the same.
I'm not aware of anyone using anything other than verify kernel.
Quoted 12 lines
Quoted 2 lines
Any chance of getting a hll compiler for refpolicy source modules, i.e. in .if/.te/.fc form?
That's in the plan. Jim has a tool that will compile .if/.te/.fc to CIL, but the current HLL infrastructure may need some changes before that can be supported. I think the main problem is that Jim's tool needs knowledge of all modules to be able to convert them to CIL, but the current HLL infrastructure compiles each module separately. We have various ideas on how we can update the HLL infrastructure to support this, but we've primarily been focused on getting the core CIL/HLL functionality complete and upstreamed before focusing on the more complicated HLL patterns.
Quoted 4 lines
Ok. Ultimately audit2allow -M i.e. sepolgen module compiler should be re-tooled to generate source modules, and we'll essentially need a workflow that replaces the old make -f
/usr/share/selinux/devel/Makefilemymodule.pp; semodule -i mymodule.pp.
Quoted 8 lines
I guess one other possible concern might be storage:
$ du -sh /etc/selinux/targeted/modules /var/lib/selinux/ 5.4M /etc/selinux/targeted/modules 11M /var/lib/selinux/I'm guessing that is just the cost of storing each module in both binary and cil form?
Yep, we store both HLL and CIL. They are both compressed and CIL compresses decently since it's just text, but it's still a lot of text.
Quoted 2 lines
Is there an option to discard the .pp files altogether and only retain the cil files?
Not at the moment, but it wouldn't be hard to accomplish. Just need to delete all the hll files and change the contents of lang_ext to 'cil'. Something we could add if storage is an issue.
Quoted 72 lines · Steve Lawrence
Quoted 59 lines · Stephen Smalley
Quoted 53 lines · Stephen Smalley
Quoted 5 lines · Steve Lawrence
I think the only remaining issue is the one Dominick mentioned in his first email regarding file_contexts.homedirs. I don't think this is an actual bug, just the migration script migrating things that don't need to be migrated. Still investigating it. We should have an update sometime tomorrow.
So everything you reverted you restored in equivalent form?
Quoted 11 lines
Quoted 2 lines
What new functionality is included here that was not previously supported by the old policy toolchain?
In terms a user would see, the most visible change is support for CIL policies and HLLs, of which there's only one right now (pp2cil). There are also some new semanage.conf options (target-platform, compiler-dir, ignore-module-cache, store-root) but I imagine the vast majority of people could just use the defaults. Similarly, we've added --ignore-module-cache and --store-root to the semodule command. We've also moved the store to
/var/lib/selinux, but this is more behind the scenes and should really only affect distributions.What about new features/options of the user-facing commands? I know some features were copied from earlier source/CIL releases into the main selinux userspace (e.g. enabled/disabled modules), but aren't some things like module priorities new?
Quoted 11 lines
Though, there are two things we just realized have a different behavior.
1)
verify_modulesis now performed on the CIL modules, rather than pp (or HLL) modules. So if someone is usingverify_modules, things will probably break. I'm not sure if anyone uses this feature or how important it is that we maintain backwards compatibility.2)
verify_linkedis no longer called, since there isn't any concept of a linked base module with CILAside from that, I think all functionality should remain the same.
I'm not aware of anyone using anything other than verify kernel.
Quoted 12 lines
Quoted 2 lines
Any chance of getting a hll compiler for refpolicy source modules, i.e. in .if/.te/.fc form?
That's in the plan. Jim has a tool that will compile .if/.te/.fc to CIL, but the current HLL infrastructure may need some changes before that can be supported. I think the main problem is that Jim's tool needs knowledge of all modules to be able to convert them to CIL, but the current HLL infrastructure compiles each module separately. We have various ideas on how we can update the HLL infrastructure to support this, but we've primarily been focused on getting the core CIL/HLL functionality complete and upstreamed before focusing on the more complicated HLL patterns.
Quoted 4 lines
Ok. Ultimately audit2allow -M i.e. sepolgen module compiler should be re-tooled to generate source modules, and we'll essentially need a workflow that replaces the old make -f
/usr/share/selinux/devel/Makefilemymodule.pp; semodule -i mymodule.pp.Quoted 8 lines
I guess one other possible concern might be storage:
$ du -sh /etc/selinux/targeted/modules /var/lib/selinux/ 5.4M /etc/selinux/targeted/modules 11M /var/lib/selinux/I'm guessing that is just the cost of storing each module in both binary and cil form?
Yep, we store both HLL and CIL. They are both compressed and CIL compresses decently since it's just text, but it's still a lot of text.
Quoted 6 lines
Quoted 2 lines
Is there an option to discard the .pp files altogether and only retain the cil files?
Not at the moment, but it wouldn't be hard to accomplish. Just need to delete all the hll files and change the contents of
lang_extto 'cil'. Something we could add if storage is an issue.
That worked, albeit I had to learn that lang_ext must not include a newline or libsemanage won't accept it. Took it down to 5.8M. I suspect we could also stop retaining a copy of certain generated files like file_contexts although that is no different than the current code.
Not sure what benefit there is in retaining the pp files, since they carry no additional information AFAIK and they aren't human viewable or editable. Is there even an option for exporting modules from the policy store currently that would allow extracting them except via direct file access to the policy store?
More generally, if the user knows that the hll module is going to be saved elsewhere, then there is no reason to retain a copy in the policy store, so having the option of dropping the hll version, either for all modules or for specific modules, seems useful.
Quoted 81 lines · Stephen Smalley
Quoted 61 lines · Steve Lawrence
Quoted 52 lines · Stephen Smalley
Quoted 47 lines · Stephen Smalley
Quoted 5 lines · Steve Lawrence
I think the only remaining issue is the one Dominick mentioned in his first email regarding file_contexts.homedirs. I don't think this is an actual bug, just the migration script migrating things that don't need to be migrated. Still investigating it. We should have an update sometime tomorrow.
So everything you reverted you restored in equivalent form?
Quoted 10 lines
Quoted 2 lines
What new functionality is included here that was not previously supported by the old policy toolchain?
In terms a user would see, the most visible change is support for CIL policies and HLLs, of which there's only one right now (pp2cil). There are also some new semanage.conf options (target-platform, compiler-dir, ignore-module-cache, store-root) but I imagine the vast majority of people could just use the defaults. Similarly, we've added --ignore-module-cache and --store-root to the semodule command. We've also moved the store to
/var/lib/selinux, but this is more behind the scenes and should really only affect distributions.What about new features/options of the user-facing commands? I know some features were copied from earlier source/CIL releases into the main selinux userspace (e.g. enabled/disabled modules), but aren't some things like module priorities new?
Quoted 11 lines
Though, there are two things we just realized have a different behavior.
1)
verify_modulesis now performed on the CIL modules, rather than pp (or HLL) modules. So if someone is usingverify_modules, things will probably break. I'm not sure if anyone uses this feature or how important it is that we maintain backwards compatibility.2)
verify_linkedis no longer called, since there isn't any concept of a linked base module with CILAside from that, I think all functionality should remain the same.
I'm not aware of anyone using anything other than verify kernel.
Quoted 11 lines
Quoted 2 lines
Any chance of getting a hll compiler for refpolicy source modules, i.e. in .if/.te/.fc form?
That's in the plan. Jim has a tool that will compile .if/.te/.fc to CIL, but the current HLL infrastructure may need some changes before that can be supported. I think the main problem is that Jim's tool needs knowledge of all modules to be able to convert them to CIL, but the current HLL infrastructure compiles each module separately. We have various ideas on how we can update the HLL infrastructure to support this, but we've primarily been focused on getting the core CIL/HLL functionality complete and upstreamed before focusing on the more complicated HLL patterns.
Quoted 4 lines
Ok. Ultimately audit2allow -M i.e. sepolgen module compiler should be re-tooled to generate source modules, and we'll essentially need a workflow that replaces the old make -f
/usr/share/selinux/devel/Makefilemymodule.pp; semodule -i mymodule.pp.Quoted 8 lines
I guess one other possible concern might be storage:
$ du -sh /etc/selinux/targeted/modules /var/lib/selinux/ 5.4M /etc/selinux/targeted/modules 11M /var/lib/selinux/I'm guessing that is just the cost of storing each module in both binary and cil form?
Quoted 8 lines
Yep, we store both HLL and CIL. They are both compressed and CIL compresses decently since it's just text, but it's still a lot of text.
Quoted 2 lines
Is there an option to discard the .pp files altogether and only retain the cil files?
Not at the moment, but it wouldn't be hard to accomplish. Just need to delete all the hll files and change the contents of
lang_extto 'cil'. Something we could add if storage is an issue.That worked, albeit I had to learn that
lang_extmust not include a newline or libsemanage won't accept it. Took it down to 5.8M. I suspect we could also stop retaining a copy of certain generated files likefile_contextsalthough that is no different than the current code.Not sure what benefit there is in retaining the pp files, since they carry no additional information AFAIK and they aren't human viewable or editable. Is there even an option for exporting modules from the policy store currently that would allow extracting them except via direct file access to the policy store?
Quoted 11 lines
More generally, if the user knows that the hll module is going to be saved elsewhere, then there is no reason to retain a copy in the policy store, so having the option of dropping the hll version, either for all modules or for specific modules, seems useful.
_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].
I would also like to see the policy file itself compressed. I have some patches I have played with to
compress the kernel. The current libselinux on Fedora/Rawhide supports readding a compressed policy
file.
Quoted 81 lines · Stephen Smalley
Quoted 61 lines · Steve Lawrence
Quoted 52 lines · Stephen Smalley
Quoted 47 lines · Stephen Smalley
Quoted 5 lines · Steve Lawrence
I think the only remaining issue is the one Dominick mentioned in his first email regarding file_contexts.homedirs. I don't think this is an actual bug, just the migration script migrating things that don't need to be migrated. Still investigating it. We should have an update sometime tomorrow.
So everything you reverted you restored in equivalent form?
Quoted 10 lines
Quoted 2 lines
What new functionality is included here that was not previously supported by the old policy toolchain?
In terms a user would see, the most visible change is support for CIL policies and HLLs, of which there's only one right now (pp2cil). There are also some new semanage.conf options (target-platform, compiler-dir, ignore-module-cache, store-root) but I imagine the vast majority of people could just use the defaults. Similarly, we've added --ignore-module-cache and --store-root to the semodule command. We've also moved the store to
/var/lib/selinux, but this is more behind the scenes and should really only affect distributions.What about new features/options of the user-facing commands? I know some features were copied from earlier source/CIL releases into the main selinux userspace (e.g. enabled/disabled modules), but aren't some things like module priorities new?
Quoted 11 lines
Though, there are two things we just realized have a different behavior.
1)
verify_modulesis now performed on the CIL modules, rather than pp (or HLL) modules. So if someone is usingverify_modules, things will probably break. I'm not sure if anyone uses this feature or how important it is that we maintain backwards compatibility.2)
verify_linkedis no longer called, since there isn't any concept of a linked base module with CILAside from that, I think all functionality should remain the same.
I'm not aware of anyone using anything other than verify kernel.
Quoted 11 lines
Quoted 2 lines
Any chance of getting a hll compiler for refpolicy source modules, i.e. in .if/.te/.fc form?
That's in the plan. Jim has a tool that will compile .if/.te/.fc to CIL, but the current HLL infrastructure may need some changes before that can be supported. I think the main problem is that Jim's tool needs knowledge of all modules to be able to convert them to CIL, but the current HLL infrastructure compiles each module separately. We have various ideas on how we can update the HLL infrastructure to support this, but we've primarily been focused on getting the core CIL/HLL functionality complete and upstreamed before focusing on the more complicated HLL patterns.
Quoted 4 lines
Ok. Ultimately audit2allow -M i.e. sepolgen module compiler should be re-tooled to generate source modules, and we'll essentially need a workflow that replaces the old make -f
/usr/share/selinux/devel/Makefilemymodule.pp; semodule -i mymodule.pp.Quoted 8 lines
I guess one other possible concern might be storage:
$ du -sh /etc/selinux/targeted/modules /var/lib/selinux/ 5.4M /etc/selinux/targeted/modules 11M /var/lib/selinux/I'm guessing that is just the cost of storing each module in both binary and cil form?
Quoted 8 lines
Yep, we store both HLL and CIL. They are both compressed and CIL compresses decently since it's just text, but it's still a lot of text.
Quoted 2 lines
Is there an option to discard the .pp files altogether and only retain the cil files?
Not at the moment, but it wouldn't be hard to accomplish. Just need to delete all the hll files and change the contents of
lang_extto 'cil'. Something we could add if storage is an issue.That worked, albeit I had to learn that
lang_extmust not include a newline or libsemanage won't accept it. Took it down to 5.8M. I suspect we could also stop retaining a copy of certain generated files likefile_contextsalthough that is no different than the current code.Not sure what benefit there is in retaining the pp files, since they carry no additional information AFAIK and they aren't human viewable or editable. Is there even an option for exporting modules from the policy store currently that would allow extracting them except via direct file access to the policy store?
Quoted 11 lines
More generally, if the user knows that the hll module is going to be saved elsewhere, then there is no reason to retain a copy in the policy store, so having the option of dropping the hll version, either for all modules or for specific modules, seems useful.
_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].
BTW Moving the policy out of /etc is also great. I would like to see policy loaded from/var/lib/selinux/ if it exists and then look in /usr/lib/selinux/ if it does not. Then distributions could
ship their own policies, and if a user wanted to get back to Factory install he could just rm -rf /var/lib/selinux
Quoted 76 lines · Stephen Smalley
Quoted 75 lines · Steve Lawrence
Quoted 59 lines · Stephen Smalley
Quoted 53 lines · Stephen Smalley
Quoted 5 lines · Steve Lawrence
I think the only remaining issue is the one Dominick mentioned in his first email regarding file_contexts.homedirs. I don't think this is an actual bug, just the migration script migrating things that don't need to be migrated. Still investigating it. We should have an update sometime tomorrow.
So everything you reverted you restored in equivalent form?
Quoted 11 lines
Quoted 2 lines
What new functionality is included here that was not previously supported by the old policy toolchain?
In terms a user would see, the most visible change is support for CIL policies and HLLs, of which there's only one right now (pp2cil). There are also some new semanage.conf options (target-platform, compiler-dir, ignore-module-cache, store-root) but I imagine the vast majority of people could just use the defaults. Similarly, we've added --ignore-module-cache and --store-root to the semodule command. We've also moved the store to
/var/lib/selinux, but this is more behind the scenes and should really only affect distributions.What about new features/options of the user-facing commands? I know some features were copied from earlier source/CIL releases into the main selinux userspace (e.g. enabled/disabled modules), but aren't some things like module priorities new?
Quoted 11 lines
Though, there are two things we just realized have a different behavior.
1)
verify_modulesis now performed on the CIL modules, rather than pp (or HLL) modules. So if someone is usingverify_modules, things will probably break. I'm not sure if anyone uses this feature or how important it is that we maintain backwards compatibility.2)
verify_linkedis no longer called, since there isn't any concept of a linked base module with CILAside from that, I think all functionality should remain the same.
I'm not aware of anyone using anything other than verify kernel.
Quoted 12 lines
Quoted 2 lines
Any chance of getting a hll compiler for refpolicy source modules, i.e. in .if/.te/.fc form?
That's in the plan. Jim has a tool that will compile .if/.te/.fc to CIL, but the current HLL infrastructure may need some changes before that can be supported. I think the main problem is that Jim's tool needs knowledge of all modules to be able to convert them to CIL, but the current HLL infrastructure compiles each module separately. We have various ideas on how we can update the HLL infrastructure to support this, but we've primarily been focused on getting the core CIL/HLL functionality complete and upstreamed before focusing on the more complicated HLL patterns.
Quoted 4 lines
Ok. Ultimately audit2allow -M i.e. sepolgen module compiler should be re-tooled to generate source modules, and we'll essentially need a workflow that replaces the old make -f
/usr/share/selinux/devel/Makefilemymodule.pp; semodule -i mymodule.pp.Quoted 8 lines
I guess one other possible concern might be storage:
$ du -sh /etc/selinux/targeted/modules /var/lib/selinux/ 5.4M /etc/selinux/targeted/modules 11M /var/lib/selinux/I'm guessing that is just the cost of storing each module in both binary and cil form?
Yep, we store both HLL and CIL. They are both compressed and CIL compresses decently since it's just text, but it's still a lot of text.
Quoted 2 lines
Is there an option to discard the .pp files altogether and only retain the cil files?
Quoted 8 lines
Quoted 3 lines
Not at the moment, but it wouldn't be hard to accomplish. Just need to delete all the hll files and change the contents of
lang_extto 'cil'. Something we could add if storage is an issue.That worked, albeit I had to learn that
lang_extmust not include a newline or libsemanage won't accept it. Took it down to 5.8M. I suspect we could also stop retaining a copy of certain generated files likefile_contextsalthough that is no different than the current code.
I think the new policy store infrastructure actually doesn't store a copy of generated files, like file_contexts. It just doesn't appear that way because the migration script copies things from the old store that it doesn't need to. But they are never actually used. Once I verify this is correct, I'll have a patch that should fix the migration script.
Quoted 5 lines
Not sure what benefit there is in retaining the pp files, since they carry no additional information AFAIK and they aren't human viewable or editable. Is there even an option for exporting modules from the policy store currently that would allow extracting them except via direct file access to the policy store?
There isn't currently a way to extract policy from the store, but that has been a use case that has been discussed in the past. Something like the following could be useful:
semodule --priority 400 --extract foo # outputs to foo.<hll> edit foo.<hll>
semodule --priority 500 --install foo.<hll>
So there could be cases in the future where it could be convenient to keep the HLL files around.
Another option to reduce disk usage could be to disable caching of the CIL files (right now, we only have an option to ignore the cached files). This way, the user could still do the above and edit hll files without having to rely on them being accessible from somewhere else. Though, this would incur a penalty of having to recompile HLL files for every change (which in my tests, about doubles compilation time).
Quoted 4 lines
More generally, if the user knows that the hll module is going to be saved elsewhere, then there is no reason to retain a copy in the policy store, so having the option of dropping the hll version, either for all modules or for specific modules, seems useful.
Do you see this feature as necessary for this patchset to be upstreamed, or is this something we could add as a later update?
Quoted 13 lines · Stephen Smalley
Quoted 12 lines · Steve Lawrence
Quoted 1 line · Stephen Smalley
On 07/17/2014 03:10 PM, Stephen Smalley wrote:
Yep, we store both HLL and CIL. They are both compressed and CIL compresses decently since it's just text, but it's still a lot of text.
Quoted 2 lines
Is there an option to discard the .pp files altogether and only retain the cil files?
Not at the moment, but it wouldn't be hard to accomplish. Just need to delete all the hll files and change the contents of
lang_extto 'cil'. Something we could add if storage is an issue.
[...]
Quoted 5 lines
Not sure what benefit there is in retaining the pp files, since they carry no additional information AFAIK and they aren't human viewable or editable. Is there even an option for exporting modules from the policy store currently that would allow extracting them except via direct file access to the policy store?
If we eventually have an upstream policy query library, then it could be useful to export modules from the store for analysis tools. Then you could analyze the policy.29 but potentially have backtracing to the HLL policy file and ideally source line where possible (obviously not for .pp).
Signature · 3 lines
Chris PeBenito Tresys Technology, LLC www.tresys.com | oss.tresys.com
Quoted 10 lines · Steve Lawrence
There isn't currently a way to extract policy from the store, but that has been a use case that has been discussed in the past. Something like the following could be useful:
semodule --priority 400 --extract foo # outputs to foo.<hll> edit foo.<hll>
semodule --priority 500 --install foo.<hll>So there could be cases in the future where it could be convenient to keep the HLL files around.
Sure, for source modules. For pp files, though?
Quoted 6 lines
Another option to reduce disk usage could be to disable caching of the CIL files (right now, we only have an option to ignore the cached files). This way, the user could still do the above and edit hll files without having to rely on them being accessible from somewhere else. Though, this would incur a penalty of having to recompile HLL files for every change (which in my tests, about doubles compilation time).
Seems less useful than being able to disable storage of the HLL files. No penalty incurred, you just have to know that you won't need them again or that they will remain available externally.
Quoted 7 lines
Quoted 4 lines
More generally, if the user knows that the hll module is going to be saved elsewhere, then there is no reason to retain a copy in the policy store, so having the option of dropping the hll version, either for all modules or for specific modules, seems useful.
Do you see this feature as necessary for this patchset to be upstreamed, or is this something we could add as a later update?
Not absolutely required, just wondering if we might encounter issues with migration on some systems due to insufficient space. We'll actually have 3 copies of each module, 2 pp files (one still in /etc/selinux/targeted/modules, not deleted by the migration script) and 1 cil file. Plus all of the copying that occurs during the transaction and installation of the files (-> /var/lib/selinux/targeted/tmp, -> /var/lib/selinux/tmp/targeted?, -> /etc/selinux/targeted). Any idea what the max storage requirement for successful migration relative to the original size of the policy store?
Quoted 5 lines · Stephen Smalley
Quoted 4 lines · Steve Lawrence
There isn't currently a way to extract policy from the store, but that has been a use case that has been discussed in the past. Something like the following could be useful:
Quoted 9 lines
Quoted 6 lines
semodule --priority 400 --extract foo # outputs to foo.<hll> edit foo.<hll>
semodule --priority 500 --install foo.<hll>So there could be cases in the future where it could be convenient to keep the HLL files around.
Sure, for source modules. For pp files, though?
Yeah, not useful for pp files. But I'd like to see pp files eventually go away, with the source policies (which are likely much smaller) to be the primary HLL.
Though, as Chris pointed out, extracting policies from the store could potentially be useful for analysis.
Quoted 10 lines
Quoted 6 lines
Another option to reduce disk usage could be to disable caching of the CIL files (right now, we only have an option to ignore the cached files). This way, the user could still do the above and edit hll files without having to rely on them being accessible from somewhere else. Though, this would incur a penalty of having to recompile HLL files for every change (which in my tests, about doubles compilation time).
Seems less useful than being able to disable storage of the HLL files. No penalty incurred, you just have to know that you won't need them again or that they will remain available externally.
Agreed, just throwing it out as another option.
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
More generally, if the user knows that the hll module is going to be saved elsewhere, then there is no reason to retain a copy in the policy store, so having the option of dropping the hll version, either for all modules or for specific modules, seems useful.
Do you see this feature as necessary for this patchset to be upstreamed, or is this something we could add as a later update?
Quoted 9 lines
Not absolutely required, just wondering if we might encounter issues with migration on some systems due to insufficient space. We'll actually have 3 copies of each module, 2 pp files (one still in
/etc/selinux/targeted/modules, not deleted by the migration script) and 1 cil file. Plus all of the copying that occurs during the transaction and installation of the files (->/var/lib/selinux/targeted/tmp, ->/var/lib/selinux/tmp/targeted?, ->/etc/selinux/targeted). Any idea what the max storage requirement for successful migration relative to the original size of the policy store?
We could delete the old store post migration but pre-rebuild. So we'd only ever have two copies of the modules. We held off on doing this in case something went wrong. Maybe after the migration script is run through its paces we could be more confident and not require a backup. Or we could delete the old store after a successful migration, so you only take the extra storage hit on migration.
As far as max storage requirement, the current policy store is about 5MB. The CIL versions also required about 5MB total. So /var/lib/selinux needs about 10MB to store all the policies (CIL + pp), and grows to about 25MB during building. Makes sense since it makes a copy of the active store (doubling from 10MB to 20MB), then builds into the sandbox (~5MB). Then it deletes the sandbox and the old module store.
So you need about 5x the current policy to successfully migrate.
So we could probably save about 5MB if we deleted the old store after migration, and save another 10MB during the build process if pp modules were deleted after converted to CIL.
Quoted 11 lines · Dominick Grift
Quoted 6 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:<snip>
Quoted 8 lines
After associating user john with
staff_u, johns home directory is properly labeled (staff_uassociated with/home/john). However, what is strange here is that i cannot seestaff_uhome dir context specs in/var/lib/selinux/targeted/active/modules/file_contexts.homedirsAm i looking in the wrong place? How does SELinux know that
staff_uneeds to be associated with/home/john
In the current upatream, file_contexts.homedirs is autogenerated and created in /etc/selinux/targeted/modules/active/ before it is copied to /etc/selinux/targeted/contexts/files. This file is not removed from the store, so it actually exists in two places.
However, with the new source policy work, file_contexts.homedirs is generated in a temporary sandbox (not the policy store). The contents of the sandbox are copied to /etc/selinux, and then deleted at the end of the transaction. So the new source policy infrastructure no longer stores intermediate/final build files in the policy store.
However, the migration script copies all the files from the old store to the new store, even including autogenerated files that the new source policy infrastructure will never look at or touch. This is just a bug in the migration script. We've updated the migration script to only migrate the files that actually need to be migrated (mostly *.local files). This has been rebased/pushed to github #integration branch.
Aside from the discussions regarding disk requirements, I think this is the last known issue.
Quoted 32 lines · Steve Lawrence
Quoted 11 lines · Dominick Grift
Quoted 6 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:<snip>
Quoted 8 lines
After associating user john with
staff_u, johns home directory is properly labeled (staff_uassociated with/home/john). However, what is strange here is that i cannot seestaff_uhome dir context specs in/var/lib/selinux/targeted/active/modules/file_contexts.homedirsAm i looking in the wrong place? How does SELinux know that
staff_uneeds to be associated with/home/johnIn the current upatream, file_contexts.homedirs is autogenerated and created in
/etc/selinux/targeted/modules/active/before it is copied to/etc/selinux/targeted/contexts/files. This file is not removed from the store, so it actually exists in two places.However, with the new source policy work, file_contexts.homedirs is generated in a temporary sandbox (not the policy store). The contents of the sandbox are copied to
/etc/selinux, and then deleted at the end of the transaction. So the new source policy infrastructure no longer stores intermediate/final build files in the policy store.
Quoted 6 lines
However, the migration script copies all the files from the old store to the new store, even including autogenerated files that the new source policy infrastructure will never look at or touch. This is just a bug in the migration script. We've updated the migration script to only migrate the files that actually need to be migrated (mostly *.local files). This has been rebased/pushed to github #integration branch.
If I run semanage_migrate_etc_to_var.py -n on a clean (no /var/lib/selinux at all) system, the /var/lib/selinux/targeted/active directory contains a homedir_template and a netfilter_contexts file in addition to the modules (and commit_num). The first file is automatically extracted from all of the file contexts during build and the second is unused these days. If I then run semodule -B (or omit the -n option on migration), I further have file_contexts.template and users_extra files under active, both of which are also generated. I can delete all four files and regenerate all but netfilter_contexts via semodule -B.
Quoted 40 lines · Stephen Smalley
Quoted 32 lines · Steve Lawrence
Quoted 11 lines · Dominick Grift
Quoted 6 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:<snip>
Quoted 8 lines
After associating user john with
staff_u, johns home directory is properly labeled (staff_uassociated with/home/john). However, what is strange here is that i cannot seestaff_uhome dir context specs in/var/lib/selinux/targeted/active/modules/file_contexts.homedirsAm i looking in the wrong place? How does SELinux know that
staff_uneeds to be associated with/home/johnIn the current upatream, file_contexts.homedirs is autogenerated and created in
/etc/selinux/targeted/modules/active/before it is copied to/etc/selinux/targeted/contexts/files. This file is not removed from the store, so it actually exists in two places.However, with the new source policy work, file_contexts.homedirs is generated in a temporary sandbox (not the policy store). The contents of the sandbox are copied to
/etc/selinux, and then deleted at the end of the transaction. So the new source policy infrastructure no longer stores intermediate/final build files in the policy store.Quoted 6 lines
However, the migration script copies all the files from the old store to the new store, even including autogenerated files that the new source policy infrastructure will never look at or touch. This is just a bug in the migration script. We've updated the migration script to only migrate the files that actually need to be migrated (mostly *.local files). This has been rebased/pushed to github #integration branch.
Quoted 11 lines
If I run
semanage_migrate_etc_to_var.py-n on a clean (no/var/lib/selinuxat all) system, the/var/lib/selinux/targeted/activedirectory contains ahomedir_templateand anetfilter_contextsfile in addition to the modules (andcommit_num). The first file is automatically extracted from all of the file contexts during build and the second is unused these days. If I then run semodule -B (or omit the -n option on migration), I further have file_contexts.template andusers_extrafiles under active, both of which are also generated. I can delete all four files and regenerate all butnetfilter_contextsvia semodule -B.
This has been fixed. Just needed to remove a couple more paths from the migration script and add a couple of unlink()'s in direct_commit().
- Steve
Quoted 53 lines · Steve Lawrence
Quoted 40 lines · Stephen Smalley
Quoted 32 lines · Steve Lawrence
Quoted 11 lines · Dominick Grift
Quoted 6 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:<snip>
Quoted 8 lines
After associating user john with
staff_u, johns home directory is properly labeled (staff_uassociated with/home/john). However, what is strange here is that i cannot seestaff_uhome dir context specs in/var/lib/selinux/targeted/active/modules/file_contexts.homedirsAm i looking in the wrong place? How does SELinux know that
staff_uneeds to be associated with/home/johnIn the current upatream, file_contexts.homedirs is autogenerated and created in
/etc/selinux/targeted/modules/active/before it is copied to/etc/selinux/targeted/contexts/files. This file is not removed from the store, so it actually exists in two places.However, with the new source policy work, file_contexts.homedirs is generated in a temporary sandbox (not the policy store). The contents of the sandbox are copied to
/etc/selinux, and then deleted at the end of the transaction. So the new source policy infrastructure no longer stores intermediate/final build files in the policy store.Quoted 6 lines
However, the migration script copies all the files from the old store to the new store, even including autogenerated files that the new source policy infrastructure will never look at or touch. This is just a bug in the migration script. We've updated the migration script to only migrate the files that actually need to be migrated (mostly *.local files). This has been rebased/pushed to github #integration branch.
Quoted 11 lines
If I run
semanage_migrate_etc_to_var.py-n on a clean (no/var/lib/selinuxat all) system, the/var/lib/selinux/targeted/activedirectory contains ahomedir_templateand anetfilter_contextsfile in addition to the modules (andcommit_num). The first file is automatically extracted from all of the file contexts during build and the second is unused these days. If I then run semodule -B (or omit the -n option on migration), I further have file_contexts.template andusers_extrafiles under active, both of which are also generated. I can delete all four files and regenerate all butnetfilter_contextsvia semodule -B.
Quoted 2 lines
This has been fixed. Just needed to remove a couple more paths from the migration script and add a couple of unlink()'s in
direct_commit().
Thanks. I had a question though about the approach being used in the new libsemanage for populating /var/lib/selinux/tmp/targeted initially (not to be confused with /var/lib/selinux/targeted/tmp, which frankly I do find rather confusing even though I understand it now). libsemanage copies the entire /etc/selinux/targeted directory layout (but not all the files) under /var/lib/selinux/tmp/targeted, even directories that it will never use (including e.g. the old modules directory), and then copies the files it manages from /etc/selinux/targeted to the corresponding /var/lib/selinux/tmp/targeted location before generating the new policy. This raises a few questions in my mind:
- Is it a good idea to depend on an already existing and populated /etc/selinux/targeted directory tree?
- Why copy the entire directory structure rather than just creating the directories we know we will need?
- What exactly is the dependency here? If there is a mismatch between the built files in /etc/selinux/targeted and the /var/lib/selinux/targeted/active tree, can bad things happen? Is libsemanage depending on those prebuilt files being identical to what would be generated if it did a rebuild from /var/lib/selinux/targeted/active? If not, why does it need them at all?
It looks to me as if possibly the old libsemanage relied on having policy.kern locally available in the sandbox, then RH switched it to a symlink to the installed file (wrongly, I think, as this would seemingly break a revert to prior policy), and this made it also depend on the installed policy file. And it appears to assume that the directory structure at least already exists under /etc/selinux/targeted. But this seems to take it a step further. How do I bootstrap a policy install with no prior /etc/selinux/targeted directory?
Quoted 68 lines · Stephen Smalley
Quoted 53 lines · Steve Lawrence
Quoted 40 lines · Stephen Smalley
Quoted 32 lines · Steve Lawrence
Quoted 11 lines · Dominick Grift
Quoted 6 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:<snip>
Quoted 8 lines
After associating user john with
staff_u, johns home directory is properly labeled (staff_uassociated with/home/john). However, what is strange here is that i cannot seestaff_uhome dir context specs in/var/lib/selinux/targeted/active/modules/file_contexts.homedirsAm i looking in the wrong place? How does SELinux know that
staff_uneeds to be associated with/home/johnIn the current upatream, file_contexts.homedirs is autogenerated and created in
/etc/selinux/targeted/modules/active/before it is copied to/etc/selinux/targeted/contexts/files. This file is not removed from the store, so it actually exists in two places.However, with the new source policy work, file_contexts.homedirs is generated in a temporary sandbox (not the policy store). The contents of the sandbox are copied to
/etc/selinux, and then deleted at the end of the transaction. So the new source policy infrastructure no longer stores intermediate/final build files in the policy store.Quoted 6 lines
However, the migration script copies all the files from the old store to the new store, even including autogenerated files that the new source policy infrastructure will never look at or touch. This is just a bug in the migration script. We've updated the migration script to only migrate the files that actually need to be migrated (mostly *.local files). This has been rebased/pushed to github #integration branch.
Quoted 11 lines
If I run
semanage_migrate_etc_to_var.py-n on a clean (no/var/lib/selinuxat all) system, the/var/lib/selinux/targeted/activedirectory contains ahomedir_templateand anetfilter_contextsfile in addition to the modules (andcommit_num). The first file is automatically extracted from all of the file contexts during build and the second is unused these days. If I then run semodule -B (or omit the -n option on migration), I further have file_contexts.template andusers_extrafiles under active, both of which are also generated. I can delete all four files and regenerate all butnetfilter_contextsvia semodule -B.Quoted 2 lines
This has been fixed. Just needed to remove a couple more paths from the migration script and add a couple of unlink()'s in
direct_commit().Thanks. I had a question though about the approach being used in the new libsemanage for populating
/var/lib/selinux/tmp/targetedinitially (not to be confused with/var/lib/selinux/targeted/tmp, which frankly I do find rather confusing even though I understand it now). libsemanage copies the entire/etc/selinux/targeteddirectory layout (but not all the files) under/var/lib/selinux/tmp/targeted, even directories that it will never use (including e.g. the old modules directory), and then copies the files it manages from/etc/selinux/targetedto the corresponding/var/lib/selinux/tmp/targetedlocation before generating the new policy. This raises a few questions in my mind:
Quoted 2 lines
- Is it a good idea to depend on an already existing and populated
/etc/selinux/targeteddirectory tree?
Wouldn't hurt to just create the directories we need.
Quoted 2 lines
- Why copy the entire directory structure rather than just creating the directories we know we will need?
Yeah, seems unnecessary.
Quoted 8 lines
- What exactly is the dependency here? If there is a mismatch between the built files in
/etc/selinux/targetedand the/var/lib/selinux/targeted/activetree, can bad things happen? Is libsemanage depending on those prebuilt files being identical to what would be generated if it did a rebuild from/var/lib/selinux/targeted/active? If not, why does it need them at all?From what I can tell, I think the files in
/etc/selinux/targetedare
copied over for the cases where it doesn't rebuild policies (e.g. changes to local fcontexts, seusers, ports, etc), but needs the current policy files for validation. We'll look into how how drastic this change would be.
Another thing that I think is incorrect is how file_context.local is handle. That is stored in /etc/selinux/targeted/contexts/files, but it seems like that should just be stored in /var/lib/selinux/targeted/active/ just like other local modification files, and merged into the file_contexts file. Not sure the reasoning for keeping it separate.
Quoted 8 lines
It looks to me as if possibly the old libsemanage relied on having policy.kern locally available in the sandbox, then RH switched it to a symlink to the installed file (wrongly, I think, as this would seemingly break a revert to prior policy), and this made it also depend on the installed policy file. And it appears to assume that the directory structure at least already exists under
/etc/selinux/targeted. But this seems to take it a step further. How do I bootstrap a policy install with no prior/etc/selinux/targeteddirectory?
I think all you really need is the directory structure set up, but it should be a pretty simple fix so even that isn't required.
Quoted 11 lines · Steve Lawrence
Quoted 9 lines · Stephen Smalley
Quoted 4 lines · Steve Lawrence
Quoted 3 lines · Stephen Smalley
Quoted 2 lines · Dominick Grift
On Wed, 2014-07-16 at 11:11 -0400, Steve Lawrence wrote:
<snip>Any chance of getting a hll compiler for refpolicy source modules, i.e. in .if/.te/.fc form?
Quoted 9 lines
That's in the plan. Jim has a tool that will compile .if/.te/.fc to CIL, but the current HLL infrastructure may need some changes before that can be supported. I think the main problem is that Jim's tool needs knowledge of all modules to be able to convert them to CIL, but the current HLL infrastructure compiles each module separately. We have various ideas on how we can update the HLL infrastructure to support this, but we've primarily been focused on getting the core CIL/HLL functionality complete and upstreamed before focusing on the more complicated HLL patterns.
My tool currently does need to have knowledge of all modules, but I think that I can get it to work with the information in /usr/share/selinux/devel/include. At least as long as the module is not doing anything crazy with m4.
Signature · 2 lines
James Carter <[email protected]> National Security Agency
Quoted 98 lines · Steve Lawrence
Quoted 76 lines · Stephen Smalley
Quoted 75 lines · Steve Lawrence
Quoted 59 lines · Stephen Smalley
Quoted 53 lines · Stephen Smalley
Quoted 5 lines · Steve Lawrence
I think the only remaining issue is the one Dominick mentioned in his first email regarding file_contexts.homedirs. I don't think this is an actual bug, just the migration script migrating things that don't need to be migrated. Still investigating it. We should have an update sometime tomorrow.
So everything you reverted you restored in equivalent form?
Quoted 11 lines
Quoted 2 lines
What new functionality is included here that was not previously supported by the old policy toolchain?
In terms a user would see, the most visible change is support for CIL policies and HLLs, of which there's only one right now (pp2cil). There are also some new semanage.conf options (target-platform, compiler-dir, ignore-module-cache, store-root) but I imagine the vast majority of people could just use the defaults. Similarly, we've added --ignore-module-cache and --store-root to the semodule command. We've also moved the store to
/var/lib/selinux, but this is more behind the scenes and should really only affect distributions.What about new features/options of the user-facing commands? I know some features were copied from earlier source/CIL releases into the main selinux userspace (e.g. enabled/disabled modules), but aren't some things like module priorities new?
Quoted 11 lines
Though, there are two things we just realized have a different behavior.
1)
verify_modulesis now performed on the CIL modules, rather than pp (or HLL) modules. So if someone is usingverify_modules, things will probably break. I'm not sure if anyone uses this feature or how important it is that we maintain backwards compatibility.2)
verify_linkedis no longer called, since there isn't any concept of a linked base module with CILAside from that, I think all functionality should remain the same.
I'm not aware of anyone using anything other than verify kernel.
Quoted 12 lines
Quoted 2 lines
Any chance of getting a hll compiler for refpolicy source modules, i.e. in .if/.te/.fc form?
That's in the plan. Jim has a tool that will compile .if/.te/.fc to CIL, but the current HLL infrastructure may need some changes before that can be supported. I think the main problem is that Jim's tool needs knowledge of all modules to be able to convert them to CIL, but the current HLL infrastructure compiles each module separately. We have various ideas on how we can update the HLL infrastructure to support this, but we've primarily been focused on getting the core CIL/HLL functionality complete and upstreamed before focusing on the more complicated HLL patterns.
Quoted 4 lines
Ok. Ultimately audit2allow -M i.e. sepolgen module compiler should be re-tooled to generate source modules, and we'll essentially need a workflow that replaces the old make -f
/usr/share/selinux/devel/Makefilemymodule.pp; semodule -i mymodule.pp.Quoted 8 lines
I guess one other possible concern might be storage:
$ du -sh /etc/selinux/targeted/modules /var/lib/selinux/ 5.4M /etc/selinux/targeted/modules 11M /var/lib/selinux/I'm guessing that is just the cost of storing each module in both binary and cil form?
Yep, we store both HLL and CIL. They are both compressed and CIL compresses decently since it's just text, but it's still a lot of text.
Quoted 2 lines
Is there an option to discard the .pp files altogether and only retain the cil files?
Quoted 8 lines
Quoted 3 lines
Not at the moment, but it wouldn't be hard to accomplish. Just need to delete all the hll files and change the contents of
lang_extto 'cil'. Something we could add if storage is an issue.That worked, albeit I had to learn that
lang_extmust not include a newline or libsemanage won't accept it. Took it down to 5.8M. I suspect we could also stop retaining a copy of certain generated files likefile_contextsalthough that is no different than the current code.I think the new policy store infrastructure actually doesn't store a copy of generated files, like
file_contexts. It just doesn't appear that way because the migration script copies things from the old store that it doesn't need to. But they are never actually used. Once I verify this is correct, I'll have a patch that should fix the migration script.Quoted 5 lines
Not sure what benefit there is in retaining the pp files, since they carry no additional information AFAIK and they aren't human viewable or editable. Is there even an option for exporting modules from the policy store currently that would allow extracting them except via direct file access to the policy store?
Quoted 8 lines
There isn't currently a way to extract policy from the store, but that has been a use case that has been discussed in the past. Something like the following could be useful:
semodule --priority 400 --extract foo # outputs to foo.<hll> edit foo.<hll>
semodule --priority 500 --install foo.<hll>
This is something that we will definitely want to support. This is how I see people modifying the distro's policy.
A couple of other nice to have operations would be:
1) Extract all policy higher than a certain priority into a tarball, so that an admin can easily move their customizations to other machines.
2) Getting the diff between two priority levels of a module.
Of course, once you can extract the source policy these other operations aren't too hard to do.
Quoted 23 lines
So there could be cases in the future where it could be convenient to keep the HLL files around.
Another option to reduce disk usage could be to disable caching of the CIL files (right now, we only have an option to ignore the cached files). This way, the user could still do the above and edit hll files without having to rely on them being accessible from somewhere else. Though, this would incur a penalty of having to recompile HLL files for every change (which in my tests, about doubles compilation time).
Quoted 4 lines
More generally, if the user knows that the hll module is going to be saved elsewhere, then there is no reason to retain a copy in the policy store, so having the option of dropping the hll version, either for all modules or for specific modules, seems useful.
Do you see this feature as necessary for this patchset to be upstreamed, or is this something we could add as a later update?
_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].
Signature · 2 lines
James Carter <[email protected]> National Security Agency
Quoted 94 lines · Daniel J Walsh
Quoted 81 lines · Stephen Smalley
Quoted 61 lines · Steve Lawrence
Quoted 52 lines · Stephen Smalley
Quoted 47 lines · Stephen Smalley
Quoted 5 lines · Steve Lawrence
I think the only remaining issue is the one Dominick mentioned in his first email regarding file_contexts.homedirs. I don't think this is an actual bug, just the migration script migrating things that don't need to be migrated. Still investigating it. We should have an update sometime tomorrow.
So everything you reverted you restored in equivalent form?
Quoted 10 lines
Quoted 2 lines
What new functionality is included here that was not previously supported by the old policy toolchain?
In terms a user would see, the most visible change is support for CIL policies and HLLs, of which there's only one right now (pp2cil). There are also some new semanage.conf options (target-platform, compiler-dir, ignore-module-cache, store-root) but I imagine the vast majority of people could just use the defaults. Similarly, we've added --ignore-module-cache and --store-root to the semodule command. We've also moved the store to
/var/lib/selinux, but this is more behind the scenes and should really only affect distributions.What about new features/options of the user-facing commands? I know some features were copied from earlier source/CIL releases into the main selinux userspace (e.g. enabled/disabled modules), but aren't some things like module priorities new?
Quoted 11 lines
Though, there are two things we just realized have a different behavior.
1)
verify_modulesis now performed on the CIL modules, rather than pp (or HLL) modules. So if someone is usingverify_modules, things will probably break. I'm not sure if anyone uses this feature or how important it is that we maintain backwards compatibility.2)
verify_linkedis no longer called, since there isn't any concept of a linked base module with CILAside from that, I think all functionality should remain the same.
I'm not aware of anyone using anything other than verify kernel.
Quoted 11 lines
Quoted 2 lines
Any chance of getting a hll compiler for refpolicy source modules, i.e. in .if/.te/.fc form?
That's in the plan. Jim has a tool that will compile .if/.te/.fc to CIL, but the current HLL infrastructure may need some changes before that can be supported. I think the main problem is that Jim's tool needs knowledge of all modules to be able to convert them to CIL, but the current HLL infrastructure compiles each module separately. We have various ideas on how we can update the HLL infrastructure to support this, but we've primarily been focused on getting the core CIL/HLL functionality complete and upstreamed before focusing on the more complicated HLL patterns.
Quoted 4 lines
Ok. Ultimately audit2allow -M i.e. sepolgen module compiler should be re-tooled to generate source modules, and we'll essentially need a workflow that replaces the old make -f
/usr/share/selinux/devel/Makefilemymodule.pp; semodule -i mymodule.pp.Quoted 8 lines
I guess one other possible concern might be storage:
$ du -sh /etc/selinux/targeted/modules /var/lib/selinux/ 5.4M /etc/selinux/targeted/modules 11M /var/lib/selinux/I'm guessing that is just the cost of storing each module in both binary and cil form?
Quoted 8 lines
Yep, we store both HLL and CIL. They are both compressed and CIL compresses decently since it's just text, but it's still a lot of text.
Quoted 2 lines
Is there an option to discard the .pp files altogether and only retain the cil files?
Not at the moment, but it wouldn't be hard to accomplish. Just need to delete all the hll files and change the contents of
lang_extto 'cil'. Something we could add if storage is an issue.That worked, albeit I had to learn that
lang_extmust not include a newline or libsemanage won't accept it. Took it down to 5.8M. I suspect we could also stop retaining a copy of certain generated files likefile_contextsalthough that is no different than the current code.Not sure what benefit there is in retaining the pp files, since they carry no additional information AFAIK and they aren't human viewable or editable. Is there even an option for exporting modules from the policy store currently that would allow extracting them except via direct file access to the policy store?
Quoted 11 lines
More generally, if the user knows that the hll module is going to be saved elsewhere, then there is no reason to retain a copy in the policy store, so having the option of dropping the hll version, either for all modules or for specific modules, seems useful.
_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].
Quoted 6 lines
BTW Moving the policy out of /etc is also great. I would like to see policy loaded from
/var/lib/selinux/if it exists and then look in/usr/lib/selinux/if it does not. Then distributions could
ship their own policies, and if a user wanted to get back to Factory install he could just rm -rf/var/lib/selinux
At present, they still install the final policy files to /etc/selinux/targeted since that is where libselinux expects to find them for loading; only the policy module store managed by libsemanage is moved from /etc/selinux/targeted/modules to /var/lib/selinux/targeted. If you wanted to relocate even the final policy files, we'd have to update libselinux to also look under /var/lib/selinux. Also, there might be a problem with relocating to /var for the final policy files since it can be a separate partition and might not always be mounted when systemd tries to load policy.
In the case of Android, we have the initial set of policy files in / (part of the rootfs from the initramfs), and optionally you can place your own policy under /data/security. init always loads first from the policy files in the rootfs and then later reloads from the /data/security policy files if present after mounting /data. Factory reset wipes /data and restores to the original rootfs policy.
Quoted 110 lines · Stephen Smalley
Quoted 93 lines · Daniel J Walsh
Quoted 81 lines · Stephen Smalley
Quoted 61 lines · Steve Lawrence
Quoted 52 lines · Stephen Smalley
Quoted 47 lines · Stephen Smalley
Quoted 5 lines · Steve Lawrence
I think the only remaining issue is the one Dominick mentioned in his first email regarding file_contexts.homedirs. I don't think this is an actual bug, just the migration script migrating things that don't need to be migrated. Still investigating it. We should have an update sometime tomorrow.
So everything you reverted you restored in equivalent form?
Quoted 10 lines
Quoted 2 lines
What new functionality is included here that was not previously supported by the old policy toolchain?
In terms a user would see, the most visible change is support for CIL policies and HLLs, of which there's only one right now (pp2cil). There are also some new semanage.conf options (target-platform, compiler-dir, ignore-module-cache, store-root) but I imagine the vast majority of people could just use the defaults. Similarly, we've added --ignore-module-cache and --store-root to the semodule command. We've also moved the store to
/var/lib/selinux, but this is more behind the scenes and should really only affect distributions.What about new features/options of the user-facing commands? I know some features were copied from earlier source/CIL releases into the main selinux userspace (e.g. enabled/disabled modules), but aren't some things like module priorities new?
Quoted 11 lines
Though, there are two things we just realized have a different behavior.
1)
verify_modulesis now performed on the CIL modules, rather than pp (or HLL) modules. So if someone is usingverify_modules, things will probably break. I'm not sure if anyone uses this feature or how important it is that we maintain backwards compatibility.2)
verify_linkedis no longer called, since there isn't any concept of a linked base module with CILAside from that, I think all functionality should remain the same.
I'm not aware of anyone using anything other than verify kernel.
Quoted 11 lines
Quoted 2 lines
Any chance of getting a hll compiler for refpolicy source modules, i.e. in .if/.te/.fc form?
That's in the plan. Jim has a tool that will compile .if/.te/.fc to CIL, but the current HLL infrastructure may need some changes before that can be supported. I think the main problem is that Jim's tool needs knowledge of all modules to be able to convert them to CIL, but the current HLL infrastructure compiles each module separately. We have various ideas on how we can update the HLL infrastructure to support this, but we've primarily been focused on getting the core CIL/HLL functionality complete and upstreamed before focusing on the more complicated HLL patterns.
Quoted 4 lines
Ok. Ultimately audit2allow -M i.e. sepolgen module compiler should be re-tooled to generate source modules, and we'll essentially need a workflow that replaces the old make -f
/usr/share/selinux/devel/Makefilemymodule.pp; semodule -i mymodule.pp.Quoted 8 lines
I guess one other possible concern might be storage:
$ du -sh /etc/selinux/targeted/modules /var/lib/selinux/ 5.4M /etc/selinux/targeted/modules 11M /var/lib/selinux/I'm guessing that is just the cost of storing each module in both binary and cil form?
Quoted 8 lines
Yep, we store both HLL and CIL. They are both compressed and CIL compresses decently since it's just text, but it's still a lot of text.
Quoted 2 lines
Is there an option to discard the .pp files altogether and only retain the cil files?
Not at the moment, but it wouldn't be hard to accomplish. Just need to delete all the hll files and change the contents of
lang_extto 'cil'. Something we could add if storage is an issue.That worked, albeit I had to learn that
lang_extmust not include a newline or libsemanage won't accept it. Took it down to 5.8M. I suspect we could also stop retaining a copy of certain generated files likefile_contextsalthough that is no different than the current code.Not sure what benefit there is in retaining the pp files, since they carry no additional information AFAIK and they aren't human viewable or editable. Is there even an option for exporting modules from the policy store currently that would allow extracting them except via direct file access to the policy store?
Quoted 11 lines
More generally, if the user knows that the hll module is going to be saved elsewhere, then there is no reason to retain a copy in the policy store, so having the option of dropping the hll version, either for all modules or for specific modules, seems useful.
_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].Quoted 6 lines
BTW Moving the policy out of /etc is also great. I would like to see policy loaded from
/var/lib/selinux/if it exists and then look in/usr/lib/selinux/if it does not. Then distributions could
ship their own policies, and if a user wanted to get back to Factory install he could just rm -rf/var/lib/selinuxAt present, they still install the final policy files to
/etc/selinux/targetedsince that is where libselinux expects to find them for loading; only the policy module store managed by libsemanage is moved from/etc/selinux/targeted/modulesto/var/lib/selinux/targeted. If you wanted to relocate even the final policy files, we'd have to update libselinux to also look under/var/lib/selinux. Also, there might be a problem with relocating to /var for the final policy files since it can be a separate partition and might not always be mounted when systemd tries to load policy.
Quoted 13 lines
In the case of Android, we have the initial set of policy files in / (part of the rootfs from the initramfs), and optionally you can place your own policy under /data/security. init always loads first from the policy files in the rootfs and then later reloads from the /data/security policy files if present after mounting /data. Factory reset wipes /data and restores to the original rootfs policy.
_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].
Ok lets stick with /etc and /usr/lib/selinux. Distributions could ship policy and config in /usr/lib/selinux and then any customization of policy should continue to go into /etc/selinux. Then libselinux should look in /etc/selinux/ first and fail over to /usr/lib/selinux.
One of the things the systemd guys are working on is a "Reset" button where a user could remove /var and /etc and still boot with system defaults.
Quoted 72 lines · Steve Lawrence
Quoted 68 lines · Stephen Smalley
Quoted 53 lines · Steve Lawrence
Quoted 40 lines · Stephen Smalley
Quoted 32 lines · Steve Lawrence
Quoted 11 lines · Dominick Grift
Quoted 6 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:<snip>
Quoted 8 lines
After associating user john with
staff_u, johns home directory is properly labeled (staff_uassociated with/home/john). However, what is strange here is that i cannot seestaff_uhome dir context specs in/var/lib/selinux/targeted/active/modules/file_contexts.homedirsAm i looking in the wrong place? How does SELinux know that
staff_uneeds to be associated with/home/johnIn the current upatream, file_contexts.homedirs is autogenerated and created in
/etc/selinux/targeted/modules/active/before it is copied to/etc/selinux/targeted/contexts/files. This file is not removed from the store, so it actually exists in two places.However, with the new source policy work, file_contexts.homedirs is generated in a temporary sandbox (not the policy store). The contents of the sandbox are copied to
/etc/selinux, and then deleted at the end of the transaction. So the new source policy infrastructure no longer stores intermediate/final build files in the policy store.Quoted 6 lines
However, the migration script copies all the files from the old store to the new store, even including autogenerated files that the new source policy infrastructure will never look at or touch. This is just a bug in the migration script. We've updated the migration script to only migrate the files that actually need to be migrated (mostly *.local files). This has been rebased/pushed to github #integration branch.
Quoted 11 lines
If I run
semanage_migrate_etc_to_var.py-n on a clean (no/var/lib/selinuxat all) system, the/var/lib/selinux/targeted/activedirectory contains ahomedir_templateand anetfilter_contextsfile in addition to the modules (andcommit_num). The first file is automatically extracted from all of the file contexts during build and the second is unused these days. If I then run semodule -B (or omit the -n option on migration), I further have file_contexts.template andusers_extrafiles under active, both of which are also generated. I can delete all four files and regenerate all butnetfilter_contextsvia semodule -B.Quoted 2 lines
This has been fixed. Just needed to remove a couple more paths from the migration script and add a couple of unlink()'s in
direct_commit().Thanks. I had a question though about the approach being used in the new libsemanage for populating
/var/lib/selinux/tmp/targetedinitially (not to be confused with/var/lib/selinux/targeted/tmp, which frankly I do find rather confusing even though I understand it now). libsemanage copies the entire/etc/selinux/targeteddirectory layout (but not all the files) under/var/lib/selinux/tmp/targeted, even directories that it will never use (including e.g. the old modules directory), and then copies the files it manages from/etc/selinux/targetedto the corresponding/var/lib/selinux/tmp/targetedlocation before generating the new policy. This raises a few questions in my mind:Quoted 2 lines
- Is it a good idea to depend on an already existing and populated
/etc/selinux/targeteddirectory tree?
Quoted 7 lines
Wouldn't hurt to just create the directories we need.
Quoted 2 lines
- Why copy the entire directory structure rather than just creating the directories we know we will need?
Yeah, seems unnecessary.
Sorry for the delay in getting back to these issues. Took a little time to look into. We've fixed the creation of the directory structure. It now creates the required directories rather than copying the entire directory structure.
Quoted 7 lines
Quoted 6 lines
- What exactly is the dependency here? If there is a mismatch between the built files in
/etc/selinux/targetedand the/var/lib/selinux/targeted/activetree, can bad things happen? Is libsemanage depending on those prebuilt files being identical to what would be generated if it did a rebuild from/var/lib/selinux/targeted/active? If not, why does it need them at all?
Quoted 5 lines
From what I can tell, I think the files in
/etc/selinux/targetedare copied over for the cases where it doesn't rebuild policies (e.g. changes to local fcontexts, seusers, ports, etc), but needs the current policy files for validation. We'll look into how how drastic this change would be.
This is actually not a simple fix. I think we would either need to make changes to how dbase structures work (which isn't trivial considering all the function pointers). We could alternatively add symlinks in /var/lib/selinux/tmp/targeted that point to the correct locations in /etc/selinux/targeted, and if we need to change any files in /var/lib/selinux/tmp/targeted then we delete the symlinks and write the new content. Though, this seems kindof hacky to me.
Unless you have any other ideas, or the symlink seems reasonable, maybe we could hold of on this issue for now, and work on the properly solution once everything is merged?
Quoted 16 lines
Another thing that I think is incorrect is how file_context.local is handle. That is stored in
/etc/selinux/targeted/contexts/files, but it seems like that should just be stored in/var/lib/selinux/targeted/active/just like other local modification files, and merged into thefile_contextsfile. Not sure the reasoning for keeping it separate.Quoted 8 lines
It looks to me as if possibly the old libsemanage relied on having policy.kern locally available in the sandbox, then RH switched it to a symlink to the installed file (wrongly, I think, as this would seemingly break a revert to prior policy), and this made it also depend on the installed policy file. And it appears to assume that the directory structure at least already exists under
/etc/selinux/targeted. But this seems to take it a step further. How do I bootstrap a policy install with no prior/etc/selinux/targeteddirectory?
Quoted 3 lines
I think all you really need is the directory structure set up, but it should be a pretty simple fix so even that isn't required.
This has been fixed. The integration branch now creates all the directories it needs, so nothing should need to be done to bootstrap the system. In addition to these changes, we've also fixed the name of the semodule --ignore-module-cache option (it used to be --ignore_module_cache). We have rebased the #integration branch onto github/next (fixing conflicts with the recent boolean changes).
I think that fixes all the known issues, aside from the two that I think would best be dealt with after upstreaming the integration branch (the two issues being 1) copying files from /etc/selinux/targeted to /var/lib/selinux/tmp/targeted and 2) a way to delete hll files after converted to cil to save space if needed).
Unless there are any more questions/concerns, perhaps it's time to start talks about merging into upstream and what needs to be done to help distributions integrate the changes?
- Steve
Quoted 144 lines · Steve Lawrence
Quoted 72 lines · Steve Lawrence
Quoted 68 lines · Stephen Smalley
Quoted 53 lines · Steve Lawrence
Quoted 40 lines · Stephen Smalley
Quoted 32 lines · Steve Lawrence
Quoted 11 lines · Dominick Grift
Quoted 6 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:<snip>
Quoted 8 lines
After associating user john with
staff_u, johns home directory is properly labeled (staff_uassociated with/home/john). However, what is strange here is that i cannot seestaff_uhome dir context specs in/var/lib/selinux/targeted/active/modules/file_contexts.homedirsAm i looking in the wrong place? How does SELinux know that
staff_uneeds to be associated with/home/johnIn the current upatream, file_contexts.homedirs is autogenerated and created in
/etc/selinux/targeted/modules/active/before it is copied to/etc/selinux/targeted/contexts/files. This file is not removed from the store, so it actually exists in two places.However, with the new source policy work, file_contexts.homedirs is generated in a temporary sandbox (not the policy store). The contents of the sandbox are copied to
/etc/selinux, and then deleted at the end of the transaction. So the new source policy infrastructure no longer stores intermediate/final build files in the policy store.Quoted 6 lines
However, the migration script copies all the files from the old store to the new store, even including autogenerated files that the new source policy infrastructure will never look at or touch. This is just a bug in the migration script. We've updated the migration script to only migrate the files that actually need to be migrated (mostly *.local files). This has been rebased/pushed to github #integration branch.
Quoted 11 lines
If I run
semanage_migrate_etc_to_var.py-n on a clean (no/var/lib/selinuxat all) system, the/var/lib/selinux/targeted/activedirectory contains ahomedir_templateand anetfilter_contextsfile in addition to the modules (andcommit_num). The first file is automatically extracted from all of the file contexts during build and the second is unused these days. If I then run semodule -B (or omit the -n option on migration), I further have file_contexts.template andusers_extrafiles under active, both of which are also generated. I can delete all four files and regenerate all butnetfilter_contextsvia semodule -B.Quoted 2 lines
This has been fixed. Just needed to remove a couple more paths from the migration script and add a couple of unlink()'s in
direct_commit().Thanks. I had a question though about the approach being used in the new libsemanage for populating
/var/lib/selinux/tmp/targetedinitially (not to be confused with/var/lib/selinux/targeted/tmp, which frankly I do find rather confusing even though I understand it now). libsemanage copies the entire/etc/selinux/targeteddirectory layout (but not all the files) under/var/lib/selinux/tmp/targeted, even directories that it will never use (including e.g. the old modules directory), and then copies the files it manages from/etc/selinux/targetedto the corresponding/var/lib/selinux/tmp/targetedlocation before generating the new policy. This raises a few questions in my mind:Quoted 2 lines
- Is it a good idea to depend on an already existing and populated
/etc/selinux/targeteddirectory tree?Quoted 7 lines
Wouldn't hurt to just create the directories we need.
Quoted 2 lines
- Why copy the entire directory structure rather than just creating the directories we know we will need?
Yeah, seems unnecessary.
Sorry for the delay in getting back to these issues. Took a little time to look into. We've fixed the creation of the directory structure. It now creates the required directories rather than copying the entire directory structure.
Quoted 7 lines
Quoted 6 lines
- What exactly is the dependency here? If there is a mismatch between the built files in
/etc/selinux/targetedand the/var/lib/selinux/targeted/activetree, can bad things happen? Is libsemanage depending on those prebuilt files being identical to what would be generated if it did a rebuild from/var/lib/selinux/targeted/active? If not, why does it need them at all?Quoted 5 lines
From what I can tell, I think the files in
/etc/selinux/targetedare copied over for the cases where it doesn't rebuild policies (e.g. changes to local fcontexts, seusers, ports, etc), but needs the current policy files for validation. We'll look into how how drastic this change would be.This is actually not a simple fix. I think we would either need to make changes to how dbase structures work (which isn't trivial considering all the function pointers). We could alternatively add symlinks in
/var/lib/selinux/tmp/targetedthat point to the correct locations in/etc/selinux/targeted, and if we need to change any files in/var/lib/selinux/tmp/targetedthen we delete the symlinks and write the new content. Though, this seems kindof hacky to me.Unless you have any other ideas, or the symlink seems reasonable, maybe we could hold of on this issue for now, and work on the properly solution once everything is merged?
Quoted 16 lines
Another thing that I think is incorrect is how file_context.local is handle. That is stored in
/etc/selinux/targeted/contexts/files, but it seems like that should just be stored in/var/lib/selinux/targeted/active/just like other local modification files, and merged into thefile_contextsfile. Not sure the reasoning for keeping it separate.Quoted 8 lines
It looks to me as if possibly the old libsemanage relied on having policy.kern locally available in the sandbox, then RH switched it to a symlink to the installed file (wrongly, I think, as this would seemingly break a revert to prior policy), and this made it also depend on the installed policy file. And it appears to assume that the directory structure at least already exists under
/etc/selinux/targeted. But this seems to take it a step further. How do I bootstrap a policy install with no prior/etc/selinux/targeteddirectory?Quoted 3 lines
I think all you really need is the directory structure set up, but it should be a pretty simple fix so even that isn't required.
This has been fixed. The integration branch now creates all the directories it needs, so nothing should need to be done to bootstrap the system. In addition to these changes, we've also fixed the name of the semodule --ignore-module-cache option (it used to be --ignore_module_cache). We have rebased the #integration branch onto github/next (fixing conflicts with the recent boolean changes).
I think that fixes all the known issues, aside from the two that I think would best be dealt with after upstreaming the integration branch (the two issues being 1) copying files from
/etc/selinux/targetedto/var/lib/selinux/tmp/targetedand 2) a way to delete hll files after converted to cil to save space if needed).
Quoted 3 lines
Unless there are any more questions/concerns, perhaps it's time to start talks about merging into upstream and what needs to be done to help distributions integrate the changes?
So we need to link cil into the tree for building. I haven't tried it, but git subtree (not submodule) looks promising, both for adding cil to the tree and possibly to split each of the other subdirectories into its own repository if we want to do that.
If we are going to keep maintaining */{ChangeLog,VERSION}, then we should update them in all affected subdirectories (including the changes on #next as well as on #integration). If not, then we should get rid of them and decide what if any comparable files we want to add at top-level, e.g. NEWS. Need to capture all of the user-visible changes and migration instructions somewhere. I expect the distributions will continue to maintain separate packages for libsepol, checkpolicy, libselinux, libsemanage and policycoreutils, so we should try to keep things as simple as possible for them.
Quoted 145 lines · Stephen Smalley
Quoted 144 lines · Steve Lawrence
Quoted 72 lines · Steve Lawrence
Quoted 68 lines · Stephen Smalley
Quoted 53 lines · Steve Lawrence
Quoted 40 lines · Stephen Smalley
Quoted 32 lines · Steve Lawrence
Quoted 11 lines · Dominick Grift
Quoted 6 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:<snip>
Quoted 8 lines
After associating user john with
staff_u, johns home directory is properly labeled (staff_uassociated with/home/john). However, what is strange here is that i cannot seestaff_uhome dir context specs in/var/lib/selinux/targeted/active/modules/file_contexts.homedirsAm i looking in the wrong place? How does SELinux know that
staff_uneeds to be associated with/home/johnIn the current upatream, file_contexts.homedirs is autogenerated and created in
/etc/selinux/targeted/modules/active/before it is copied to/etc/selinux/targeted/contexts/files. This file is not removed from the store, so it actually exists in two places.However, with the new source policy work, file_contexts.homedirs is generated in a temporary sandbox (not the policy store). The contents of the sandbox are copied to
/etc/selinux, and then deleted at the end of the transaction. So the new source policy infrastructure no longer stores intermediate/final build files in the policy store.Quoted 6 lines
However, the migration script copies all the files from the old store to the new store, even including autogenerated files that the new source policy infrastructure will never look at or touch. This is just a bug in the migration script. We've updated the migration script to only migrate the files that actually need to be migrated (mostly *.local files). This has been rebased/pushed to github #integration branch.
Quoted 11 lines
If I run
semanage_migrate_etc_to_var.py-n on a clean (no/var/lib/selinuxat all) system, the/var/lib/selinux/targeted/activedirectory contains ahomedir_templateand anetfilter_contextsfile in addition to the modules (andcommit_num). The first file is automatically extracted from all of the file contexts during build and the second is unused these days. If I then run semodule -B (or omit the -n option on migration), I further have file_contexts.template andusers_extrafiles under active, both of which are also generated. I can delete all four files and regenerate all butnetfilter_contextsvia semodule -B.Quoted 2 lines
This has been fixed. Just needed to remove a couple more paths from the migration script and add a couple of unlink()'s in
direct_commit().Thanks. I had a question though about the approach being used in the new libsemanage for populating
/var/lib/selinux/tmp/targetedinitially (not to be confused with/var/lib/selinux/targeted/tmp, which frankly I do find rather confusing even though I understand it now). libsemanage copies the entire/etc/selinux/targeteddirectory layout (but not all the files) under/var/lib/selinux/tmp/targeted, even directories that it will never use (including e.g. the old modules directory), and then copies the files it manages from/etc/selinux/targetedto the corresponding/var/lib/selinux/tmp/targetedlocation before generating the new policy. This raises a few questions in my mind:Quoted 2 lines
- Is it a good idea to depend on an already existing and populated
/etc/selinux/targeteddirectory tree?Quoted 7 lines
Wouldn't hurt to just create the directories we need.
Quoted 2 lines
- Why copy the entire directory structure rather than just creating the directories we know we will need?
Yeah, seems unnecessary.
Sorry for the delay in getting back to these issues. Took a little time to look into. We've fixed the creation of the directory structure. It now creates the required directories rather than copying the entire directory structure.
Quoted 7 lines
Quoted 6 lines
- What exactly is the dependency here? If there is a mismatch between the built files in
/etc/selinux/targetedand the/var/lib/selinux/targeted/activetree, can bad things happen? Is libsemanage depending on those prebuilt files being identical to what would be generated if it did a rebuild from/var/lib/selinux/targeted/active? If not, why does it need them at all?Quoted 5 lines
From what I can tell, I think the files in
/etc/selinux/targetedare copied over for the cases where it doesn't rebuild policies (e.g. changes to local fcontexts, seusers, ports, etc), but needs the current policy files for validation. We'll look into how how drastic this change would be.This is actually not a simple fix. I think we would either need to make changes to how dbase structures work (which isn't trivial considering all the function pointers). We could alternatively add symlinks in
/var/lib/selinux/tmp/targetedthat point to the correct locations in/etc/selinux/targeted, and if we need to change any files in/var/lib/selinux/tmp/targetedthen we delete the symlinks and write the new content. Though, this seems kindof hacky to me.Unless you have any other ideas, or the symlink seems reasonable, maybe we could hold of on this issue for now, and work on the properly solution once everything is merged?
Quoted 16 lines
Another thing that I think is incorrect is how file_context.local is handle. That is stored in
/etc/selinux/targeted/contexts/files, but it seems like that should just be stored in/var/lib/selinux/targeted/active/just like other local modification files, and merged into thefile_contextsfile. Not sure the reasoning for keeping it separate.Quoted 8 lines
It looks to me as if possibly the old libsemanage relied on having policy.kern locally available in the sandbox, then RH switched it to a symlink to the installed file (wrongly, I think, as this would seemingly break a revert to prior policy), and this made it also depend on the installed policy file. And it appears to assume that the directory structure at least already exists under
/etc/selinux/targeted. But this seems to take it a step further. How do I bootstrap a policy install with no prior/etc/selinux/targeteddirectory?Quoted 3 lines
I think all you really need is the directory structure set up, but it should be a pretty simple fix so even that isn't required.
This has been fixed. The integration branch now creates all the directories it needs, so nothing should need to be done to bootstrap the system. In addition to these changes, we've also fixed the name of the semodule --ignore-module-cache option (it used to be --ignore_module_cache). We have rebased the #integration branch onto github/next (fixing conflicts with the recent boolean changes).
I think that fixes all the known issues, aside from the two that I think would best be dealt with after upstreaming the integration branch (the two issues being 1) copying files from
/etc/selinux/targetedto/var/lib/selinux/tmp/targetedand 2) a way to delete hll files after converted to cil to save space if needed).
Quoted 8 lines
Quoted 3 lines
Unless there are any more questions/concerns, perhaps it's time to start talks about merging into upstream and what needs to be done to help distributions integrate the changes?
So we need to link cil into the tree for building. I haven't tried it, but git subtree (not submodule) looks promising, both for adding cil to the tree and possibly to split each of the other subdirectories into its own repository if we want to do that.
I have tested merging the cil.git into selinux.git using git subtree, and it works fine. It does make it a little messy when looking at the history, since it contains histories of both selinux and cil, but git log and other tools can filter out unwanted directories pretty easily.
A while ago I did look into splitting the subdirectories into separate repos with subtree, and it didn't work as nicely as I would have liked. It resulted in a lot of branches and tags that had nothing to do with the subdirectory. I'm sure it could be fixed (and I didn't spend too much time on it), but it might require a little bit of work.
Quoted 9 lines
If we are going to keep maintaining */{ChangeLog,VERSION}, then we should update them in all affected subdirectories (including the changes on #next as well as on #integration). If not, then we should get rid of them and decide what if any comparable files we want to add at top-level, e.g. NEWS. Need to capture all of the user-visible changes and migration instructions somewhere. I expect the distributions will continue to maintain separate packages for libsepol, checkpolicy, libselinux, libsemanage and policycoreutils, so we should try to keep things as simple as possible for them.
We'll add some patches to update the ChangeLog/VERSIONs for affected subdirs, and create a wiki page that talks about migration and the new CIL changes.
Quoted 154 lines · Stephen Smalley
Quoted 144 lines · Steve Lawrence
Quoted 72 lines · Steve Lawrence
Quoted 68 lines · Stephen Smalley
Quoted 53 lines · Steve Lawrence
Quoted 40 lines · Stephen Smalley
Quoted 32 lines · Steve Lawrence
Quoted 11 lines · Dominick Grift
Quoted 6 lines · Steve Lawrence
In January, we sent an RFC [1] to update userspace to integrate CIL
[2] and source policy. And in April, we sent an updated RFC [3] which added support for high level languages and a tool to convert policy package (pp) files to CIL. After getting some good feedback, we have made some more changes, mostly to maintain ABI compatibility. The major changes made since the last patchset are:<snip>
Quoted 8 lines
After associating user john with
staff_u, johns home directory is properly labeled (staff_uassociated with/home/john). However, what is strange here is that i cannot seestaff_uhome dir context specs in/var/lib/selinux/targeted/active/modules/file_contexts.homedirsAm i looking in the wrong place? How does SELinux know that
staff_uneeds to be associated with/home/johnIn the current upatream, file_contexts.homedirs is autogenerated and created in
/etc/selinux/targeted/modules/active/before it is copied to/etc/selinux/targeted/contexts/files. This file is not removed from the store, so it actually exists in two places.However, with the new source policy work, file_contexts.homedirs is generated in a temporary sandbox (not the policy store). The contents of the sandbox are copied to
/etc/selinux, and then deleted at the end of the transaction. So the new source policy infrastructure no longer stores intermediate/final build files in the policy store.Quoted 6 lines
However, the migration script copies all the files from the old store to the new store, even including autogenerated files that the new source policy infrastructure will never look at or touch. This is just a bug in the migration script. We've updated the migration script to only migrate the files that actually need to be migrated (mostly *.local files). This has been rebased/pushed to github #integration branch.
Quoted 11 lines
If I run
semanage_migrate_etc_to_var.py-n on a clean (no/var/lib/selinuxat all) system, the/var/lib/selinux/targeted/activedirectory contains ahomedir_templateand anetfilter_contextsfile in addition to the modules (andcommit_num). The first file is automatically extracted from all of the file contexts during build and the second is unused these days. If I then run semodule -B (or omit the -n option on migration), I further have file_contexts.template andusers_extrafiles under active, both of which are also generated. I can delete all four files and regenerate all butnetfilter_contextsvia semodule -B.Quoted 2 lines
This has been fixed. Just needed to remove a couple more paths from the migration script and add a couple of unlink()'s in
direct_commit().Thanks. I had a question though about the approach being used in the new libsemanage for populating
/var/lib/selinux/tmp/targetedinitially (not to be confused with/var/lib/selinux/targeted/tmp, which frankly I do find rather confusing even though I understand it now). libsemanage copies the entire/etc/selinux/targeteddirectory layout (but not all the files) under/var/lib/selinux/tmp/targeted, even directories that it will never use (including e.g. the old modules directory), and then copies the files it manages from/etc/selinux/targetedto the corresponding/var/lib/selinux/tmp/targetedlocation before generating the new policy. This raises a few questions in my mind:Quoted 2 lines
- Is it a good idea to depend on an already existing and populated
/etc/selinux/targeteddirectory tree?Quoted 7 lines
Wouldn't hurt to just create the directories we need.
Quoted 2 lines
- Why copy the entire directory structure rather than just creating the directories we know we will need?
Yeah, seems unnecessary.
Sorry for the delay in getting back to these issues. Took a little time to look into. We've fixed the creation of the directory structure. It now creates the required directories rather than copying the entire directory structure.
Quoted 7 lines
Quoted 6 lines
- What exactly is the dependency here? If there is a mismatch between the built files in
/etc/selinux/targetedand the/var/lib/selinux/targeted/activetree, can bad things happen? Is libsemanage depending on those prebuilt files being identical to what would be generated if it did a rebuild from/var/lib/selinux/targeted/active? If not, why does it need them at all?Quoted 5 lines
From what I can tell, I think the files in
/etc/selinux/targetedare copied over for the cases where it doesn't rebuild policies (e.g. changes to local fcontexts, seusers, ports, etc), but needs the current policy files for validation. We'll look into how how drastic this change would be.This is actually not a simple fix. I think we would either need to make changes to how dbase structures work (which isn't trivial considering all the function pointers). We could alternatively add symlinks in
/var/lib/selinux/tmp/targetedthat point to the correct locations in/etc/selinux/targeted, and if we need to change any files in/var/lib/selinux/tmp/targetedthen we delete the symlinks and write the new content. Though, this seems kindof hacky to me.Unless you have any other ideas, or the symlink seems reasonable, maybe we could hold of on this issue for now, and work on the properly solution once everything is merged?
Quoted 16 lines
Another thing that I think is incorrect is how file_context.local is handle. That is stored in
/etc/selinux/targeted/contexts/files, but it seems like that should just be stored in/var/lib/selinux/targeted/active/just like other local modification files, and merged into thefile_contextsfile. Not sure the reasoning for keeping it separate.Quoted 8 lines
It looks to me as if possibly the old libsemanage relied on having policy.kern locally available in the sandbox, then RH switched it to a symlink to the installed file (wrongly, I think, as this would seemingly break a revert to prior policy), and this made it also depend on the installed policy file. And it appears to assume that the directory structure at least already exists under
/etc/selinux/targeted. But this seems to take it a step further. How do I bootstrap a policy install with no prior/etc/selinux/targeteddirectory?Quoted 3 lines
I think all you really need is the directory structure set up, but it should be a pretty simple fix so even that isn't required.
This has been fixed. The integration branch now creates all the directories it needs, so nothing should need to be done to bootstrap the system. In addition to these changes, we've also fixed the name of the semodule --ignore-module-cache option (it used to be --ignore_module_cache). We have rebased the #integration branch onto github/next (fixing conflicts with the recent boolean changes).
I think that fixes all the known issues, aside from the two that I think would best be dealt with after upstreaming the integration branch (the two issues being 1) copying files from
/etc/selinux/targetedto/var/lib/selinux/tmp/targetedand 2) a way to delete hll files after converted to cil to save space if needed).Quoted 3 lines
Unless there are any more questions/concerns, perhaps it's time to start talks about merging into upstream and what needs to be done to help distributions integrate the changes?
So we need to link cil into the tree for building. I haven't tried it, but git subtree (not submodule) looks promising, both for adding cil to the tree and possibly to split each of the other subdirectories into its own repository if we want to do that.
Quoted 10 lines
If we are going to keep maintaining */{ChangeLog,VERSION}, then we should update them in all affected subdirectories (including the changes on #next as well as on #integration). If not, then we should get rid of them and decide what if any comparable files we want to add at top-level, e.g. NEWS. Need to capture all of the user-visible changes and migration instructions somewhere. I expect the distributions will continue to maintain separate packages for libsepol, checkpolicy, libselinux, libsemanage and policycoreutils, so we should try to keep things as simple as possible for them.
I've just pushed an updated integration branch that has the following changes:
- Rename the migration script to semanage_migrate_store
- Add a Makefile to install semanage_migrate_store into /usr/libexec/selinux/. This didn't seem like a tool used often enough to install into /usr/bin
- Used git subtree to merge CIL into the selinux repo (squashed so as to not muddy the selinux repo history)
- Updated the Changelogs to include the changes made for the source policy/CIL integration changes
- Bumped libsemanage, libsemanage, and policycoreutils version numbers
There have also been a few bugs fixed in CIL recently, which are included in the subtree merge.
We've also added two github wiki pages to describe the HLL infrastructure [1] and how to migrate from the old store to the new store [2].
[1]
https://github.com/SELinuxProject/selinux/wiki/High-Level-Language-Infrastructure
[2] https://github.com/SELinuxProject/selinux/wiki/Policy-Store-Migration
I think that's the last remaining issues.
- Steve