1 |
commit: 3805de84f208d3e85057eab898de864af6128558 |
2 |
Author: Nicolas Iooss <nicolas.iooss <AT> m4x <DOT> org> |
3 |
AuthorDate: Sat Oct 18 13:30:21 2014 +0000 |
4 |
Commit: Sven Vermeulen <swift <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Oct 31 15:26:27 2014 +0000 |
6 |
URL: http://sources.gentoo.org/gitweb/?p=proj/hardened-refpolicy.git;a=commit;h=3805de84 |
7 |
|
8 |
Allow iw to create generic netlink sockets |
9 |
|
10 |
iw uses generic netlink socket to configure WiFi properties. For |
11 |
example, "strace iw dev wlan0 set power_save on" outputs: |
12 |
|
13 |
socket(PF_NETLINK, SOCK_RAW|SOCK_CLOEXEC, NETLINK_GENERIC) = 3 |
14 |
setsockopt(3, SOL_SOCKET, SO_SNDBUF, [32768], 4) = 0 |
15 |
setsockopt(3, SOL_SOCKET, SO_RCVBUF, [32768], 4) = 0 |
16 |
bind(3, {sa_family=AF_NETLINK, pid=7836, groups=00000000}, 12) = 0 |
17 |
|
18 |
Some AVC denials are reported in audit.log: |
19 |
|
20 |
type=AVC msg=audit(1408829044.820:486): avc: denied { create } for |
21 |
pid=5950 comm="iw" scontext=system_u:system_r:ifconfig_t |
22 |
tcontext=system_u:system_r:ifconfig_t tclass=netlink_socket |
23 |
permissive=1 |
24 |
type=AVC msg=audit(1408829044.820:487): avc: denied { setopt } for |
25 |
pid=5950 comm="iw" scontext=system_u:system_r:ifconfig_t |
26 |
tcontext=system_u:system_r:ifconfig_t tclass=netlink_socket |
27 |
permissive=1 |
28 |
type=AVC msg=audit(1408829044.820:488): avc: denied { bind } for |
29 |
pid=5950 comm="iw" scontext=system_u:system_r:ifconfig_t |
30 |
tcontext=system_u:system_r:ifconfig_t tclass=netlink_socket |
31 |
permissive=1 |
32 |
type=AVC msg=audit(1408829044.820:489): avc: denied { getattr } |
33 |
for pid=5950 comm="iw" scontext=system_u:system_r:ifconfig_t |
34 |
tcontext=system_u:system_r:ifconfig_t tclass=netlink_socket |
35 |
permissive=1 |
36 |
type=AVC msg=audit(1408829044.820:490): avc: denied { write } for |
37 |
pid=5950 comm="iw" scontext=system_u:system_r:ifconfig_t |
38 |
tcontext=system_u:system_r:ifconfig_t tclass=netlink_socket |
39 |
permissive=1 |
40 |
|
41 |
Allowing ifconfig_t to create generic netlink sockets fixes this. |
42 |
|
43 |
(On a side note, the AVC denials were caused by TLP, a tool which |
44 |
applies "laptop configuration" when switching between AC and battery |
45 |
with the help of a udev script) |
46 |
|
47 |
--- |
48 |
policy/modules/system/sysnetwork.te | 1 + |
49 |
1 file changed, 1 insertion(+) |
50 |
|
51 |
diff --git a/policy/modules/system/sysnetwork.te b/policy/modules/system/sysnetwork.te |
52 |
index cb0922d..b95de37 100644 |
53 |
--- a/policy/modules/system/sysnetwork.te |
54 |
+++ b/policy/modules/system/sysnetwork.te |
55 |
@@ -276,6 +276,7 @@ allow ifconfig_t self:msg { send receive }; |
56 |
allow ifconfig_t self:udp_socket create_socket_perms; |
57 |
# for /sbin/ip |
58 |
allow ifconfig_t self:packet_socket create_socket_perms; |
59 |
+allow ifconfig_t self:netlink_socket create_socket_perms; |
60 |
allow ifconfig_t self:netlink_route_socket create_netlink_socket_perms; |
61 |
allow ifconfig_t self:netlink_xfrm_socket { create_netlink_socket_perms nlmsg_read }; |
62 |
allow ifconfig_t self:tcp_socket { create ioctl }; |