binary policy patch tools
Attached is a rather large patch file that Dave Caplan and I developed. We were asked by a customer to create a tool that would allow one to change a binary policy, on a running system, without the presence of the policy source files. This patch is the culmination of that effort. The changes are to the selinux/module/checkpolicy and lsm-2.4/security/selinux/ss directories, as well as some minor policy directory changes. We did not address the lsm-2.5 directory, nor the changes Steve is actively working for checkpolicy in the future...this patch will have to be reworked into those changes at some point. This patch was diff'ed from the sourceforge CVS tree as of this morning.
By way of a short summary of what we did, below is an extract from the readme file included in the patch. Steve, to help you understand our changes, I'll privately send you a summary of changes and additions we made. I actively solicit additionally testing of these tools as they ended up more complicated than we expected. Thanks Frank
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Background and Motivation
-------------------------
In general, if you wanted to maintain small variations for a given policy, you would be better served maintaining these variations in the policy source files and re-compiling new binary policies with the variation you need. However, there are circumstances where it is necessary to be able to change small aspects of a binary policy on a running system without the policy source files.
As an illustration, imagine a mobile computing environment where you wished to change access to certain communication devices depending on environmental circumstances. For example, if the device is in a docking station, allow access to the ethernet device, but not otherwise. Or where a proximity detector is used to determine whether an authorized user is at the device, and if so, provide greater access (e.g., access to input devices) than if a user is not nearby. In some cases such issues could be handled within the policy itself (always preferable), but there are times when you need the ability to dynamically change the policy, at run time, without the infrastructure available to change the source files and re-compile the policy.
This is the motivation behind the binary patch tools. These tools allow you to specify one or more variations from a base policy, and compile the patch into a form that can then be applied to the base policy in a running system. To achieve this goal, a policy patch language was developed that allows you to write policy changes and compile them (in the context of the base policy) using checkpatch'. Checkpatch is directly analogous to checkpolicy'. The compiled patch can then be applied to the binary policy on the running system using `polpatch'. Only polpatch is necessary on the running system, along with the binary patch files, in order to change the installed policy.