summaryrefslogtreecommitdiff
path: root/selinux
Commit message (Collapse)AuthorAgeFilesLines
* 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>