diff mbox

[ovs-dev,3/3] selinux: update policy to reflect non-root and dpdk support

Message ID 20170816200452.9748-4-aconole@redhat.com
State Superseded
Headers show

Commit Message

Aaron Conole Aug. 16, 2017, 8:04 p.m. UTC
The selinux policy that exists in the repository did not specify access to
all of the resources needed for Open vSwitch to properly function with
an enforcing selinux policy.  This update allows Open vSwitch to operate
with selinux set to Enforcing mode, even while running as a non-root user.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Tested-by: Jean Hsiao <jhsiao@redhat.com>
---
 selinux/openvswitch-custom.te.in | 38 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/selinux/openvswitch-custom.te.in b/selinux/openvswitch-custom.te.in
index 47ddb56..9f3ba20 100644
--- a/selinux/openvswitch-custom.te.in
+++ b/selinux/openvswitch-custom.te.in
@@ -2,15 +2,51 @@  module openvswitch-custom 1.0.1;
 
 require {
         type openvswitch_t;
+        type openvswitch_rw_t;
         type openvswitch_tmp_t;
+        type openvswitch_var_run_t;
+
         type ifconfig_exec_t;
         type hostname_exec_t;
+        type tun_tap_device_t;
+
+@begin_dpdk@
+        type hugetlbfs_t;
+        type kernel_t;
+        type vfio_device_t;
+@end_dpdk@
+
+        class capability { dac_override audit_write };
+        class dir { write remove_name add_name lock read };
+        class file { write getattr read open execute execute_no_trans create unlink };
+        class netlink_audit_socket { create nlmsg_relay audit_write read write };
         class netlink_socket { setopt getopt create connect getattr write read };
-        class file { write getattr read open execute execute_no_trans };
+        class unix_stream_socket { write getattr read connectto connect setopt getopt sendto accept bind recvfrom acceptfrom };
+
+@begin_dpdk@
+        class chr_file { write getattr read open ioctl };
+        class tun_socket { relabelfrom relabelto };
+@end_dpdk@
 }
 
 #============= openvswitch_t ==============
+allow openvswitch_t self:capability { dac_override audit_write };
+allow openvswitch_t self:netlink_audit_socket { create nlmsg_relay audit_write read write };
 allow openvswitch_t self:netlink_socket { setopt getopt create connect getattr write read };
+
 allow openvswitch_t hostname_exec_t:file { read getattr open execute execute_no_trans };
 allow openvswitch_t ifconfig_exec_t:file { read getattr open execute execute_no_trans };
+
+allow openvswitch_t openvswitch_rw_t:dir { write remove_name add_name lock read };
+allow openvswitch_t openvswitch_rw_t:file { write getattr read open execute execute_no_trans create unlink };
 allow openvswitch_t openvswitch_tmp_t:file { execute execute_no_trans };
+allow openvswitch_t openvswitch_tmp_t:unix_stream_socket { write getattr read connectto connect setopt getopt sendto accept bind recvfrom acceptfrom };
+
+@begin_dpdk@
+allow openvswitch_t hugetlbfs_t:dir { write remove_name add_name lock read };
+allow openvswitch_t hugetlbfs_t:file { create unlink };
+allow openvswitch_t kernel_t:unix_stream_socket { write getattr read connectto connect setopt getopt sendto accept bind recvfrom acceptfrom };
+allow openvswitch_t self:tun_socket { relabelfrom relabelto };
+allow openvswitch_t tun_tap_device_t:chr_file { read write getattr open ioctl };
+allow openvswitch_t vfio_device_t:chr_file { read write open ioctl getattr };
+@end_dpdk@