-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SELinux rules overlap #885
Comments
There are rules that may only be due to swtpm. We have these rules here now: swtpm/src/selinux/swtpm_svirt.te Lines 23 to 33 in 350b6a5
What I find in the file you are referring to above are the following rules:
There's not much overlap from what I can see but I would say that swtpm's SELinux rules are an addition to these rules. Maybe the swtpm project should not maintain an SELinux policy anymore but all rules should be in the upstream policy and rules clearly marked showing which ones are being added due to swtpm. |
In the swtpm module, there should only be rules allowing permissions to swtpm_t, or in some cases to IPC from swtpm_t. Everything else should go to other modules or selinux-policy. Unfortunately, we cannot just copy the rules to selinux-policy without understanding why, that would make the policy pointless. Can you point us to the original problems or bug reports? One of the examples can be allowing a transition from virtqemud_t to swtpm_t instead of allowing permissions to the original domain. Additionally, interfaces should be used when types from other modules are needed. |
If it comes to 'trusting the rules' I have to say that I do not have documentation for the rules to justify each one of them. The easiest way to recreate the rules would be to uninstall the swtpm selinux package and (hopefully) it will lead to denials that after exercising all the necessary interactions with libvirt and virt-install (in system and user modes) will lead to the same rules again. I also have some notes on this page about which directories to remove so that all rules are captured because of the creation of a directory that only occurs if swtpm had not been installed before:
Here's a list of the recent SELinux related Buzillas I can come up with:
Some of the rules depend on the configuration of libvirt and may not be easy to reproduce. In fact I initially had problems reproducing any of the issues that people saw after installation of F40 while I had done an upgrade from F39 to get to the same SELinux policy version. |
@zpytela on fc40, if I remove swtpm_libvirt and swtpm_svirt modules and run the test from https://github.com/stefanberger/swtpm/wiki/SELinux-Policy-Development I get the following policy:
Do you want me to look at patching selinux-policy? thanks |
Please note F40 is far behind the current dvelopment which happens in rawhide. Can you run the test for a rawhide system? In the meantime, I will look at the test. |
@zpytela on rawhide:
|
It looks like the intention is to merge swtpm-related SELinux rules into the upstream reference policy. I suppose the upstream SELinux reference policy will carry them forward and update them? |
How do we want to proceed with this? |
Closing this issue. If we want to proceed with this in some way, we can reopen. |
well, I think we should clean this.. if @zpytela could guide us on how to proceed, I can work on it. |
Hi,
There is overlap between the rules provided by swtpm & selinux-policy, which makes managment unnecessarily complicated.
The swtpm.if interface present in both isn't much of a problem, afaict: selinux will check interfaces are already defined. But which one will come first?
Sometime it's more complicated, for example:
fedora-selinux/selinux-policy@6c412b2
introduced
allow svirt_t virtqemud_t:fifo_file read;
when swtpm didallow svirt_t virtqemud_t:fifo_file write;
already.My understanding is that selinux-policy provides libvirt policies, and swtpm shouldn't have them.
The text was updated successfully, but these errors were encountered: