summaryrefslogtreecommitdiff
path: root/selinux
Commit message (Collapse)AuthorAgeFilesLines
* selinux: Add missing permissions for ovs-kmod-ctl.Yi-Hung Wei2020-09-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | On RHEL 8, a SELinux policy is missing when ovs-kmod-ctl use modprobe to load kernel modules. This patch adds the missing permissions based on /var/log/audit/audit.log Example log of the AVC violations: type=AVC msg=audit(1599075387.136:65): avc: denied { read } for pid=1472 comm="modprobe" name="modules.alias.bin" dev="dm-0" ino=586629 scontext=system_u:system_r:openvswitch_load_module_t:s0 tcontext=system_u:object_r:modules_dep_t:s0 tclass=file permissive=0 type=AVC msg=audit(1599085253.148:45): avc: denied { open } for pid=1355 comm="modprobe" path="/usr/lib/modules/4.18.0-193.el8.x86_64/modules.dep.bin" dev="dm-0" ino=624258 scontext=system_u:system_r:openvswitch_load_module_t:s0 tcontext=unconfined_u:object_r:modules_dep_t:s0 tclass=file permissive=0 VMWare-BZ: #2633569 Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Acked-by: Greg Rose <gvrose8192@gmail.com> Acked-by: Ansis Atteka <aatteka@ovn.org> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* selinux: update for netlink socket typesAaron Conole2019-04-211-0/+8
| | | | | | | | These are used for interfacing with conntrack, as well as by some DPDK PMDs Signed-off-by: Aaron Conole <aconole@redhat.com> Acked-by: Ansis Atteka <aatteka@ovn.org>
* selinux: Add missing permissions for ovs-kmod-ctlYi-Hung Wei2019-01-181-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Starting from OVS 2.10, ovs-vswitchd may fail to run after system reboot since it fails to load ovs kernel module. It is because the conntrack zone limit feature introduced in OVS 2.10 now depends on nf_conntrack_ipv4/6 kernel module, and the SELinux prevents it to load the two kernel modules. Example log of the AVC violations: type=AVC msg=audit(1546903594.735:29): avc: denied { execute_no_trans } for pid=820 comm="modprobe" path="/usr/bin/bash" dev="dm-0" ino=50337111 scontext=system_u:system_r:openvswitch_load_module_t:s0 tcontext=system_u:object_r:shell_exec_t:s0 tclass=file type=AVC msg=audit(1546903594.791:30): avc: denied { module_request } for pid=819 comm="modprobe" kmod="nf_conntrack-2" scontext=system_u:system_r:openvswitch_load_module_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=system This patch adds the missing permissions for modprobe command in ovs-kmod-ctl so that the aforementioned issue is resolved. VMWare-BZ: #2257534 Acked-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* selinux: more changes to support newer hugetlbfs restrictionsTimothy Redaelli2018-07-311-1/+1
| | | | | | | | | | The new 'map' action is needed for 'hugetlbfs_t:file' too. CC: Aaron Conole <aconole@redhat.com> Fixes: d2675a146130 ("selinux: changes to support newer hugetlbfs restrictions") Signed-off-by: Timothy Redaelli <tredaelli@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Aaron Conole <aconole@redhat.com>
* selinux: changes to support newer hugetlbfs restrictionsAaron Conole2018-07-291-3/+6
| | | | | | | | | | | | | | | Newer selinux base policies now split out 'map' actions, as well as adding more explicit checks for hugetlbfs objects. Where previously these weren't required, recent changes have flagged the allocation of hugepages and subsequent clearing. This means that the hugepage storage information for the DPDK .rte_config, and clearing actions copying from /dev/zero will trigger selinux denials. This commit allows openvswitch to have more permissions for the hugetlbfs allocation and use. Signed-off-by: Aaron Conole <aconole@redhat.com> Acked-by: Ansis Atteka <aatteka@ovn.org>
* selinux: introduce domain transitioned kmod helperAaron Conole2018-06-173-1/+7
| | | | | | | | | | | | | | | This commit uses the previously defined selinux label to transition from the openvswitch_t to openvswitch_load_module_t domain by executing ovs-kmod-ctl that is labelled with openvswitch_load_module_exec_t type. Note that unless the selinux relabel operation is invoked, the script will not be labelled. This merely instructs the selinux tools that ovs-kmod-ctl should have a label applied. Acked-by: Ansis Atteka <aatteka@ovn.org> Acked-by: Timothy Redaelli <tredaelli@redhat.com> Signed-off-by: Aaron Conole <aconole@redhat.com>
* selinux: tag the custom policy versionAaron Conole2018-06-171-1/+3
| | | | | | | | | | | Since the policy is an intermediate file, it can inherit the policy module version from release version. Also include an SPDX identifier. Suggested-by: Ansis Atteka <aatteka@ovn.org> Acked-by: Ansis Atteka <aatteka@ovn.org> Signed-off-by: Aaron Conole <aconole@redhat.com>
* selinux: allow openvswitch_t net_broadcast and net_rawAaron Conole2018-06-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | The ovs-vswitchd daemon requires both CAP_NET_RAW and CAP_NET_BROADCAST, but these are generally policy prevented by selinux. This allows these capabilities to be retained by the openvswitch_t domain. example: type=AVC msg=audit(1527876508.109:3043): avc: denied { net_broadcast } for pid=5368 comm="ovs-vswitchd" capability=11 scontext=system_u:system_r:openvswitch_t:s0 tcontext=system_u:system_r:openvswitch_t:s0 tclass=capability permissive=0 type=AVC msg=audit(1527876508.109:3043): avc: denied { net_raw } for pid=5368 comm="ovs-vswitchd" capability=11 scontext=system_u:system_r:openvswitch_t:s0 tcontext=system_u:system_r:openvswitch_t:s0 tclass=capability permissive=0 Acked-by: Ansis Atteka <aatteka@ovn.org> Signed-off-by: Aaron Conole <aconole@redhat.com>
* selinux: create a transition type for module loadingAaron Conole2018-06-171-5/+78
| | | | | | | | | | | | | | | Defines a type 'openvswitch_load_module_t' used exclusively for loading modules. This means that the 'openvswitch_t' domain won't require access to the module loading facility - such access can only happen after transitioning through the 'openvswitch_load_module_exec_t' transition context. A future commit will instruct the selinux policy on how to label the appropriate script with extended attributes to make use of this new domain. Acked-by: Ansis Atteka <aatteka@ovn.org> Acked-by: Timothy Redaelli <tredaelli@redhat.com> Signed-off-by: Aaron Conole <aconole@redhat.com>
* selinux: drop autogenerated filesAaron Conole2018-02-281-0/+6
| | | | | | | | When running a make clean, it is desirable for the autogenerated files to be removed. Signed-off-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* selinux: include the svirt_t typeAaron Conole2018-02-271-0/+1
| | | | | | | | | | | | The dpdk policy adds support for interacting with libvirt, but failed to include the appropriate svirt_t type. This results in an error like: openvswitch-custom.te:53:ERROR 'unknown type svirt_t' at token ';' on line 1060: Reported-by: Guoshuai Li <ligs@dtdream.com> Signed-off-by: Aaron Conole <aconole@redhat.com> Acked-by: Ansis Atteka <aatteka@ovn.org>
* selinux: allow dpdkvhostuserclient sockets with newer libvirtAaron Conole2018-02-231-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | Newer libvirt and openstack versions will now label the unix socket as an `svirt_tmpfs_t` object. This means that in order to support deploying with the recommended configuration (using a dpdkvhostuserclient socket), additional permissions need to be installed as part of the selinux policy. An example of some of the AVC violations: type=AVC msg=audit(1518752799.102:978): avc: denied { write } for pid=14368 comm="ovs-vswitchd" name="vhost0" dev="dm-0" ino=94 scontext=system_u:system_r:openvswitch_t:s0 tcontext=system_u:object_r:svirt_tmp_t:s0 tclass=sock_file type=AVC msg=audit(1518816172.126:1318): avc: denied { connectto } for pid=32717 comm="ovs-vswitchd" path="/tmp/vhost0" scontext=system_u:system_r:openvswitch_t:s0 tcontext=system_u:system_r:svirt_t:s0:c106,c530 tclass=unix_stream_socket Signed-off-by: Aaron Conole <aconole@redhat.com> Acked-by: Ansis Atteka <aatteka@ovn.org>
* selinux: add a new target to build the policyAaron Conole2018-02-231-0/+5
| | | | | | | | | | | | | | | | | | The selinux policy currently builds manually, as a process that either the user or distribution maintainer undertakes. That process consists of: 1. Convert the intermediary files into their file form through 'make' statements at the top level. 2. Change to the selinux directory and issue the selinux "make -f" directive. This commit introduces a new target 'selinux-policy' which builds the openvswitch-custom policy files. Signed-off-by: Aaron Conole <aconole@redhat.com> Acked-by: Ansis Atteka <aatteka@ovn.org>
* selinux.rst: point to the correct fileAaron Conole2017-09-011-0/+1
| | | | | | | | | | | | | | | | | | The selinux documentation mentions to check the selinux/openvswitch.te file for any permissions that might need to be added. However, the commit 7bc1aae71e89 ("rhel: make the selinux policy intermediate") moved this file to be generated from intermediate file selinux/openvswitch.te.in instead. Correct the documentation, so that users won't be trying to edit a generated file. Also, add a gitignore for the autogenerated file. Fixes: 7bc1aae71e89 ("rhel: make the selinux policy intermediate") Reported-by: Ansis Atteka <aatteka@ovn.org> Signed-off-by: Aaron Conole <aconole@redhat.com> Acked-by: Ansis Atteka <aatteka@ovn.org>
* selinux: move chr_file to non-dpdk as wellAaron Conole2017-09-011-1/+1
| | | | | | | | | | | | A last-minute change to the selinux policy caught by testing incorrectly omitted moving a definition from non-dpdk to dpdk. This moves the chr_file definition to a non-dpdk enabled permission, which should allow non-dpdk enabled builds to work. Fixes: 84d272330506 ("selinux: update policy to reflect non-root and dpdk support") Signed-off-by: Aaron Conole <aconole@redhat.com> Acked-by: Ansis Atteka <aatteka@ovn.org>
* selinux: update policy to reflect non-root and dpdk supportAaron Conole2017-08-311-1/+39
| | | | | | | | | | | | 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. Acked-by: Flavio Leitner <fbl@sysclose.org> Acked-by: Ansis Atteka <aatteka@ovn.org> Signed-off-by: Aaron Conole <aconole@redhat.com> Tested-by: Jean Hsiao <jhsiao@redhat.com>
* rhel: make the selinux policy intermediateAaron Conole2017-08-312-1/+1
| | | | | | | | | | | This will be used by an upcoming commit to have @begin_ and @end_ dpdk blocks to keep dpdk specific policy decisions only active when dpdk is used. Acked-by: Flavio Leitner <fbl@sysclose.org> Acked-by: Ansis Atteka <aatteka@ovn.org> Signed-off-by: Aaron Conole <aconole@redhat.com> Tested-by: Jean Hsiao <jhsiao@redhat.com>
* selinux: Allow ovs-ctl force-reload-kmod.Joe Stringer2016-07-261-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When invoking ovs-ctl force-reload-kmod via '/etc/init.d/openvswitch force-reload-kmod', spurious errors would output related to 'hostname' and 'ip', and the system's selinux audit log would complain about some of the invocations such as those listed at the end of this commit message. This patch loosens restrictions for openvswitch_t (used for ovs-ctl, as well as all of the OVS daemons) to allow it to execute 'hostname' and 'ip' commands, and also to execute temporary files created as openvswitch_tmp_t. This allows force-reload-kmod to run correctly. Example audit logs: type=AVC msg=audit(1468515192.912:16720): avc: denied { getattr } for pid=11687 comm="ovs-ctl" path="/usr/bin/hostname" dev="dm-1" ino=33557805 scontext=system_u:system_r:openvswitch_t:s0 tcontext=system_u:object_r:hostname_exec_t:s0 tclass=file type=AVC msg=audit(1468519445.766:16829): avc: denied { getattr } for pid=13920 comm="ovs-save" path="/usr/sbin/ip" dev="dm-1" ino=67572988 scontext=unconfined_u:system_r:openvswitch_t:s0 tcontext=system_u:object_r:ifconfig_exec_t:s0 tclass=file type=AVC msg=audit(1468519445.890:16833): avc: denied { execute } for pid=13849 comm="ovs-ctl" name="tmp.jdEGHntG3Z" dev="dm-1" ino=106876762 scontext=unconfined_u:system_r:openvswitch_t:s0 tcontext=unconfined_u:object_r:openvswitch_tmp_t:s0 tclass=file VMware-BZ: #1692972 Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Flavio Leitner <fbl@sysclose.org>
* rhel: provide our own SELinux custom policy packageAnsis Atteka2016-02-252-0/+18
CentOS, RHEL and Fedora distributions ship with their own Open vSwitch SELinux policy that is too strict and prevents Open vSwitch to work normally out of the box. As a solution, this patch introduces a new package which will "loosen" up "openvswitch_t" SELinux domain so that Open vSwitch could operate normally. Intended use-cases of this package are: 1. to allow users to install newer Open vSwitch on already released Fedora, RHEL and CentOS distributions where the default Open vSwitch SELinux policy that shipped with the corresponding Linux distribution is not up to date and did not anticipate that a newer Open vSwitch version might need to invoke new system calls or need to access certain system resources that it did not before; And 2. to provide alternative means through which Open vSwitch developers can proactively fix SELinux related policy issues without waiting for corresponding Linux distribution maintainers to update their central Open vSwitch SELinux policy. This patch was tested on Fedora 23 and CentOS 7. I verified that now on Fedora 23 Open vSwitch can create a NetLink socket; and that I did not see following error messages: vlog|INFO|opened log file /var/log/openvswitch/ovs-vswitchd.log ovs_numa|INFO|Discovered 2 CPU cores on NUMA node 0 ovs_numa|INFO|Discovered 1 NUMA nodes and 2 CPU cores reconnect|INFO|unix:/var/run/openvswitch/db.sock: connecting... reconnect|INFO|unix:/var/run/openvswitch/db.sock: connected netlink_socket|ERR|fcntl: Permission denied dpif_netlink|ERR|Generic Netlink family 'ovs_datapath' does not exist. The Open vSwitch kernel module is p robably not loaded. dpif|WARN|failed to enumerate system datapaths: Permission denied dpif|WARN|failed to create datapath ovs-system: Permission denied I did not test all Open vSwitch features so there still could be some OVS configuration that would get "Permission denied" errors. Since, Open vSwitch daemons on Ubuntu 15.10 by default run under "unconfined" SELinux domain, then there is no need to create a similar debian package for Ubuntu, because it works on default Ubuntu installation. Signed-off-by: Ansis Atteka <aatteka@nicira.com> Acked-by: Flavio Leitner <fbl@sysclose.com>