summaryrefslogtreecommitdiffstats
path: root/security/selinux
diff options
context:
space:
mode:
authorStephen Smalley <sds@tycho.nsa.gov>2015-06-04 16:22:16 -0400
committerPaul Moore <pmoore@redhat.com>2015-06-04 16:22:16 -0400
commit6c6d2e9bde1c1c87a7ead806f8f5e2181d41a652 (patch)
treea06013e3a14864931b63fcf323b73d4822053957 /security/selinux
parent9e7c8f8c62c1e1cda203b5bfaba4575b141e42e7 (diff)
selinux: update netlink socket classes
Update the set of SELinux netlink socket class definitions to match the set of netlink protocols implemented by the kernel. The ip_queue implementation for the NETLINK_FIREWALL and NETLINK_IP6_FW protocols was removed in d16cf20e2f2f13411eece7f7fb72c17d141c4a84, so we can remove the corresponding class definitions as this is dead code. Add new classes for NETLINK_ISCSI, NETLINK_FIB_LOOKUP, NETLINK_CONNECTOR, NETLINK_NETFILTER, NETLINK_GENERIC, NETLINK_SCSITRANSPORT, NETLINK_RDMA, and NETLINK_CRYPTO so that we can distinguish among sockets created for each of these protocols. This change does not define the finer-grained nlsmsg_read/write permissions or map specific nlmsg_type values to those permissions in the SELinux nlmsgtab; if finer-grained control of these sockets is desired/required, that can be added as a follow-on change. We do not define a SELinux class for NETLINK_ECRYPTFS as the implementation was removed in 624ae5284516870657505103ada531c64dba2a9a. Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov> Signed-off-by: Paul Moore <pmoore@redhat.com>
Diffstat (limited to 'security/selinux')
-rw-r--r--security/selinux/hooks.c20
-rw-r--r--security/selinux/include/classmap.h22
2 files changed, 32 insertions, 10 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 8abbd548ece9..cf2cc0dca9b7 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1188,8 +1188,6 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
1188 switch (protocol) { 1188 switch (protocol) {
1189 case NETLINK_ROUTE: 1189 case NETLINK_ROUTE:
1190 return SECCLASS_NETLINK_ROUTE_SOCKET; 1190 return SECCLASS_NETLINK_ROUTE_SOCKET;
1191 case NETLINK_FIREWALL:
1192 return SECCLASS_NETLINK_FIREWALL_SOCKET;
1193 case NETLINK_SOCK_DIAG: 1191 case NETLINK_SOCK_DIAG:
1194 return SECCLASS_NETLINK_TCPDIAG_SOCKET; 1192 return SECCLASS_NETLINK_TCPDIAG_SOCKET;
1195 case NETLINK_NFLOG: 1193 case NETLINK_NFLOG:
@@ -1198,14 +1196,28 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
1198 return SECCLASS_NETLINK_XFRM_SOCKET; 1196 return SECCLASS_NETLINK_XFRM_SOCKET;
1199 case NETLINK_SELINUX: 1197 case NETLINK_SELINUX:
1200 return SECCLASS_NETLINK_SELINUX_SOCKET; 1198 return SECCLASS_NETLINK_SELINUX_SOCKET;
1199 case NETLINK_ISCSI:
1200 return SECCLASS_NETLINK_ISCSI_SOCKET;
1201 case NETLINK_AUDIT: 1201 case NETLINK_AUDIT:
1202 return SECCLASS_NETLINK_AUDIT_SOCKET; 1202 return SECCLASS_NETLINK_AUDIT_SOCKET;
1203 case NETLINK_IP6_FW: 1203 case NETLINK_FIB_LOOKUP:
1204 return SECCLASS_NETLINK_IP6FW_SOCKET; 1204 return SECCLASS_NETLINK_FIB_LOOKUP_SOCKET;
1205 case NETLINK_CONNECTOR:
1206 return SECCLASS_NETLINK_CONNECTOR_SOCKET;
1207 case NETLINK_NETFILTER:
1208 return SECCLASS_NETLINK_NETFILTER_SOCKET;
1205 case NETLINK_DNRTMSG: 1209 case NETLINK_DNRTMSG:
1206 return SECCLASS_NETLINK_DNRT_SOCKET; 1210 return SECCLASS_NETLINK_DNRT_SOCKET;
1207 case NETLINK_KOBJECT_UEVENT: 1211 case NETLINK_KOBJECT_UEVENT:
1208 return SECCLASS_NETLINK_KOBJECT_UEVENT_SOCKET; 1212 return SECCLASS_NETLINK_KOBJECT_UEVENT_SOCKET;
1213 case NETLINK_GENERIC:
1214 return SECCLASS_NETLINK_GENERIC_SOCKET;
1215 case NETLINK_SCSITRANSPORT:
1216 return SECCLASS_NETLINK_SCSITRANSPORT_SOCKET;
1217 case NETLINK_RDMA:
1218 return SECCLASS_NETLINK_RDMA_SOCKET;
1219 case NETLINK_CRYPTO:
1220 return SECCLASS_NETLINK_CRYPTO_SOCKET;
1209 default: 1221 default:
1210 return SECCLASS_NETLINK_SOCKET; 1222 return SECCLASS_NETLINK_SOCKET;
1211 } 1223 }
diff --git a/security/selinux/include/classmap.h b/security/selinux/include/classmap.h
index eccd61b3de8a..1d8b924cc134 100644
--- a/security/selinux/include/classmap.h
+++ b/security/selinux/include/classmap.h
@@ -107,9 +107,6 @@ struct security_class_mapping secclass_map[] = {
107 { "netlink_route_socket", 107 { "netlink_route_socket",
108 { COMMON_SOCK_PERMS, 108 { COMMON_SOCK_PERMS,
109 "nlmsg_read", "nlmsg_write", NULL } }, 109 "nlmsg_read", "nlmsg_write", NULL } },
110 { "netlink_firewall_socket",
111 { COMMON_SOCK_PERMS,
112 "nlmsg_read", "nlmsg_write", NULL } },
113 { "netlink_tcpdiag_socket", 110 { "netlink_tcpdiag_socket",
114 { COMMON_SOCK_PERMS, 111 { COMMON_SOCK_PERMS,
115 "nlmsg_read", "nlmsg_write", NULL } }, 112 "nlmsg_read", "nlmsg_write", NULL } },
@@ -120,19 +117,32 @@ struct security_class_mapping secclass_map[] = {
120 "nlmsg_read", "nlmsg_write", NULL } }, 117 "nlmsg_read", "nlmsg_write", NULL } },
121 { "netlink_selinux_socket", 118 { "netlink_selinux_socket",
122 { COMMON_SOCK_PERMS, NULL } }, 119 { COMMON_SOCK_PERMS, NULL } },
120 { "netlink_iscsi_socket",
121 { COMMON_SOCK_PERMS, NULL } },
123 { "netlink_audit_socket", 122 { "netlink_audit_socket",
124 { COMMON_SOCK_PERMS, 123 { COMMON_SOCK_PERMS,
125 "nlmsg_read", "nlmsg_write", "nlmsg_relay", "nlmsg_readpriv", 124 "nlmsg_read", "nlmsg_write", "nlmsg_relay", "nlmsg_readpriv",
126 "nlmsg_tty_audit", NULL } }, 125 "nlmsg_tty_audit", NULL } },
127 { "netlink_ip6fw_socket", 126 { "netlink_fib_lookup_socket",
128 { COMMON_SOCK_PERMS, 127 { COMMON_SOCK_PERMS, NULL } },
129 "nlmsg_read", "nlmsg_write", NULL } }, 128 { "netlink_connector_socket",
129 { COMMON_SOCK_PERMS, NULL } },
130 { "netlink_netfilter_socket",
131 { COMMON_SOCK_PERMS, NULL } },
130 { "netlink_dnrt_socket", 132 { "netlink_dnrt_socket",
131 { COMMON_SOCK_PERMS, NULL } }, 133 { COMMON_SOCK_PERMS, NULL } },
132 { "association", 134 { "association",
133 { "sendto", "recvfrom", "setcontext", "polmatch", NULL } }, 135 { "sendto", "recvfrom", "setcontext", "polmatch", NULL } },
134 { "netlink_kobject_uevent_socket", 136 { "netlink_kobject_uevent_socket",
135 { COMMON_SOCK_PERMS, NULL } }, 137 { COMMON_SOCK_PERMS, NULL } },
138 { "netlink_generic_socket",
139 { COMMON_SOCK_PERMS, NULL } },
140 { "netlink_scsitransport_socket",
141 { COMMON_SOCK_PERMS, NULL } },
142 { "netlink_rdma_socket",
143 { COMMON_SOCK_PERMS, NULL } },
144 { "netlink_crypto_socket",
145 { COMMON_SOCK_PERMS, NULL } },
136 { "appletalk_socket", 146 { "appletalk_socket",
137 { COMMON_SOCK_PERMS, NULL } }, 147 { COMMON_SOCK_PERMS, NULL } },
138 { "packet", 148 { "packet",