1 #include <linux/capability.h>
3 #define COMMON_FILE_SOCK_PERMS "ioctl", "read", "write", "create", \
4 "getattr", "setattr", "lock", "relabelfrom", "relabelto", "append", "map"
6 #define COMMON_FILE_PERMS COMMON_FILE_SOCK_PERMS, "unlink", "link", \
7 "rename", "execute", "quotaon", "mounton", "audit_access", \
10 #define COMMON_SOCK_PERMS COMMON_FILE_SOCK_PERMS, "bind", "connect", \
11 "listen", "accept", "getopt", "setopt", "shutdown", "recvfrom", \
14 #define COMMON_IPC_PERMS "create", "destroy", "getattr", "setattr", "read", \
15 "write", "associate", "unix_read", "unix_write"
17 #define COMMON_CAP_PERMS "chown", "dac_override", "dac_read_search", \
18 "fowner", "fsetid", "kill", "setgid", "setuid", "setpcap", \
19 "linux_immutable", "net_bind_service", "net_broadcast", \
20 "net_admin", "net_raw", "ipc_lock", "ipc_owner", "sys_module", \
21 "sys_rawio", "sys_chroot", "sys_ptrace", "sys_pacct", "sys_admin", \
22 "sys_boot", "sys_nice", "sys_resource", "sys_time", \
23 "sys_tty_config", "mknod", "lease", "audit_write", \
24 "audit_control", "setfcap"
26 #define COMMON_CAP2_PERMS "mac_override", "mac_admin", "syslog", \
27 "wake_alarm", "block_suspend", "audit_read"
29 #if CAP_LAST_CAP > CAP_AUDIT_READ
30 #error New capability defined, please update COMMON_CAP2_PERMS.
34 * Note: The name for any socket class should be suffixed by "socket",
35 * and doesn't contain more than one substr of "socket".
37 struct security_class_mapping secclass_map
[] = {
39 { "compute_av", "compute_create", "compute_member",
40 "check_context", "load_policy", "compute_relabel",
41 "compute_user", "setenforce", "setbool", "setsecparam",
42 "setcheckreqprot", "read_policy", "validate_trans", NULL
} },
44 { "fork", "transition", "sigchld", "sigkill",
45 "sigstop", "signull", "signal", "ptrace", "getsched", "setsched",
46 "getsession", "getpgid", "setpgid", "getcap", "setcap", "share",
47 "getattr", "setexec", "setfscreate", "noatsecure", "siginh",
48 "setrlimit", "rlimitinh", "dyntransition", "setcurrent",
49 "execmem", "execstack", "execheap", "setkeycreate",
50 "setsockcreate", "getrlimit", NULL
} },
52 { "ipc_info", "syslog_read", "syslog_mod",
53 "syslog_console", "module_request", "module_load", NULL
} },
55 { COMMON_CAP_PERMS
, NULL
} },
57 { "mount", "remount", "unmount", "getattr",
58 "relabelfrom", "relabelto", "associate", "quotamod",
62 "execute_no_trans", "entrypoint", NULL
} },
64 { COMMON_FILE_PERMS
, "add_name", "remove_name",
65 "reparent", "search", "rmdir", NULL
} },
66 { "fd", { "use", NULL
} },
68 { COMMON_FILE_PERMS
, NULL
} },
70 { COMMON_FILE_PERMS
, NULL
} },
72 { COMMON_FILE_PERMS
, NULL
} },
74 { COMMON_FILE_PERMS
, NULL
} },
76 { COMMON_FILE_PERMS
, NULL
} },
78 { COMMON_SOCK_PERMS
, NULL
} },
81 "node_bind", "name_connect",
85 "node_bind", NULL
} },
88 "node_bind", NULL
} },
90 { "recvfrom", "sendto", NULL
} },
92 { "ingress", "egress", NULL
} },
94 { COMMON_SOCK_PERMS
, NULL
} },
96 { COMMON_SOCK_PERMS
, NULL
} },
98 { COMMON_SOCK_PERMS
, NULL
} },
99 { "unix_stream_socket",
100 { COMMON_SOCK_PERMS
, "connectto", NULL
} },
101 { "unix_dgram_socket",
102 { COMMON_SOCK_PERMS
, NULL
} },
104 { COMMON_IPC_PERMS
, NULL
} },
105 { "msg", { "send", "receive", NULL
} },
107 { COMMON_IPC_PERMS
, "enqueue", NULL
} },
109 { COMMON_IPC_PERMS
, "lock", NULL
} },
111 { COMMON_IPC_PERMS
, NULL
} },
112 { "netlink_route_socket",
114 "nlmsg_read", "nlmsg_write", NULL
} },
115 { "netlink_tcpdiag_socket",
117 "nlmsg_read", "nlmsg_write", NULL
} },
118 { "netlink_nflog_socket",
119 { COMMON_SOCK_PERMS
, NULL
} },
120 { "netlink_xfrm_socket",
122 "nlmsg_read", "nlmsg_write", NULL
} },
123 { "netlink_selinux_socket",
124 { COMMON_SOCK_PERMS
, NULL
} },
125 { "netlink_iscsi_socket",
126 { COMMON_SOCK_PERMS
, NULL
} },
127 { "netlink_audit_socket",
129 "nlmsg_read", "nlmsg_write", "nlmsg_relay", "nlmsg_readpriv",
130 "nlmsg_tty_audit", NULL
} },
131 { "netlink_fib_lookup_socket",
132 { COMMON_SOCK_PERMS
, NULL
} },
133 { "netlink_connector_socket",
134 { COMMON_SOCK_PERMS
, NULL
} },
135 { "netlink_netfilter_socket",
136 { COMMON_SOCK_PERMS
, NULL
} },
137 { "netlink_dnrt_socket",
138 { COMMON_SOCK_PERMS
, NULL
} },
140 { "sendto", "recvfrom", "setcontext", "polmatch", NULL
} },
141 { "netlink_kobject_uevent_socket",
142 { COMMON_SOCK_PERMS
, NULL
} },
143 { "netlink_generic_socket",
144 { COMMON_SOCK_PERMS
, NULL
} },
145 { "netlink_scsitransport_socket",
146 { COMMON_SOCK_PERMS
, NULL
} },
147 { "netlink_rdma_socket",
148 { COMMON_SOCK_PERMS
, NULL
} },
149 { "netlink_crypto_socket",
150 { COMMON_SOCK_PERMS
, NULL
} },
151 { "appletalk_socket",
152 { COMMON_SOCK_PERMS
, NULL
} },
154 { "send", "recv", "relabelto", "forward_in", "forward_out", NULL
} },
156 { "view", "read", "write", "search", "link", "setattr", "create",
160 "node_bind", "name_connect", NULL
} },
161 { "memprotect", { "mmap_zero", NULL
} },
162 { "peer", { "recv", NULL
} },
164 { COMMON_CAP2_PERMS
, NULL
} },
165 { "kernel_service", { "use_as_override", "create_files_as", NULL
} },
167 { COMMON_SOCK_PERMS
, "attach_queue", NULL
} },
168 { "binder", { "impersonate", "call", "set_context_mgr", "transfer",
171 { COMMON_CAP_PERMS
, NULL
} },
173 { COMMON_CAP2_PERMS
, NULL
} },
176 "node_bind", NULL
} },
179 "node_bind", NULL
} },
181 { COMMON_SOCK_PERMS
, NULL
} },
183 { COMMON_SOCK_PERMS
, NULL
} },
185 { COMMON_SOCK_PERMS
, NULL
} },
187 { COMMON_SOCK_PERMS
, NULL
} },
189 { COMMON_SOCK_PERMS
, NULL
} },
191 { COMMON_SOCK_PERMS
, NULL
} },
193 { COMMON_SOCK_PERMS
, NULL
} },
195 { COMMON_SOCK_PERMS
, NULL
} },
197 { COMMON_SOCK_PERMS
, NULL
} },
199 { COMMON_SOCK_PERMS
, NULL
} },
201 { COMMON_SOCK_PERMS
, NULL
} },
203 { COMMON_SOCK_PERMS
, NULL
} },
205 { COMMON_SOCK_PERMS
, NULL
} },
207 { COMMON_SOCK_PERMS
, NULL
} },
208 { "bluetooth_socket",
209 { COMMON_SOCK_PERMS
, NULL
} },
211 { COMMON_SOCK_PERMS
, NULL
} },
213 { COMMON_SOCK_PERMS
, NULL
} },
215 { COMMON_SOCK_PERMS
, NULL
} },
217 { COMMON_SOCK_PERMS
, NULL
} },
218 { "ieee802154_socket",
219 { COMMON_SOCK_PERMS
, NULL
} },
221 { COMMON_SOCK_PERMS
, NULL
} },
223 { COMMON_SOCK_PERMS
, NULL
} },
225 { COMMON_SOCK_PERMS
, NULL
} },
227 { COMMON_SOCK_PERMS
, NULL
} },
229 { COMMON_SOCK_PERMS
, NULL
} },
231 { COMMON_SOCK_PERMS
, NULL
} },
233 { COMMON_SOCK_PERMS
, NULL
} },
235 { "access", NULL
} },
236 { "infiniband_endport",
237 { "manage_subnet", NULL
} },
242 #error New address family defined, please update secclass_map.