From 945fb567666809dc87db295ebb53a668aecd731c Mon Sep 17 00:00:00 2001
From: Stephen Smalley <sds@tycho.nsa.gov>
Date: Tue, 29 Oct 2013 14:42:36 -0400
Subject: [PATCH] Confine hostapd, but leave it permissive for now.

Change-Id: I23a2c568e9fdd51c6c09c6c80a7ce9f2b5bd4966
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
---
 hostapd.te | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/hostapd.te b/hostapd.te
index 79db3c37b..a934384df 100644
--- a/hostapd.te
+++ b/hostapd.te
@@ -1,6 +1,22 @@
+# userspace wifi access points
 type hostapd, domain;
+permissive hostapd;
 type hostapd_exec, exec_type, file_type;
 
-init_daemon_domain(hostapd)
-net_domain(hostapd)
-unconfined_domain(hostapd)
+allow hostapd self:capability { net_admin net_raw setuid setgid };
+allow hostapd self:netlink_socket create_socket_perms;
+allow hostapd self:packet_socket { create write read };
+allow hostapd self:netlink_route_socket { bind create write nlmsg_write read };
+allow hostapd self:udp_socket { create ioctl };
+
+allow hostapd wifi_data_file:file rw_file_perms;
+allow hostapd wifi_data_file:dir create_dir_perms;
+allow hostapd wifi_data_file:sock_file { create setattr write unlink };
+
+allow hostapd netd:fd use;
+allow hostapd netd:udp_socket { read write };
+allow hostapd netd:netlink_kobject_uevent_socket { read write };
+allow hostapd netd:netlink_nflog_socket { read write };
+allow hostapd netd:netlink_route_socket { read write };
+allow hostapd netd:unix_stream_socket { read write };
+allow hostapd netd:fifo_file { read write };
-- 
GitLab