1 #include <linux/capability.h> 2 3 #define COMMON_FILE_SOCK_PERMS "ioctl", "read", "write", "create", \ 4 "getattr", "setattr", "lock", "relabelfrom", "relabelto", "append", "map" 5 6 #define COMMON_FILE_PERMS COMMON_FILE_SOCK_PERMS, "unlink", "link", \ 7 "rename", "execute", "quotaon", "mounton", "audit_access", \ 8 "open", "execmod" 9 10 #define COMMON_SOCK_PERMS COMMON_FILE_SOCK_PERMS, "bind", "connect", \ 11 "listen", "accept", "getopt", "setopt", "shutdown", "recvfrom", \ 12 "sendto", "name_bind" 13 14 #define COMMON_IPC_PERMS "create", "destroy", "getattr", "setattr", "read", \ 15 "write", "associate", "unix_read", "unix_write" 16 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" 25 26 #define COMMON_CAP2_PERMS "mac_override", "mac_admin", "syslog", \ 27 "wake_alarm", "block_suspend", "audit_read" 28 29 #if CAP_LAST_CAP > CAP_AUDIT_READ 30 #error New capability defined, please update COMMON_CAP2_PERMS. 31 #endif 32 33 /* 34 * Note: The name for any socket class should be suffixed by "socket", 35 * and doesn't contain more than one substr of "socket". 36 */ 37 struct security_class_mapping secclass_map[] = { 38 { "security", 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 } }, 43 { "process", 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 } }, 51 { "system", 52 { "ipc_info", "syslog_read", "syslog_mod", 53 "syslog_console", "module_request", "module_load", NULL } }, 54 { "capability", 55 { COMMON_CAP_PERMS, NULL } }, 56 { "filesystem", 57 { "mount", "remount", "unmount", "getattr", 58 "relabelfrom", "relabelto", "associate", "quotamod", 59 "quotaget", NULL } }, 60 { "file", 61 { COMMON_FILE_PERMS, 62 "execute_no_trans", "entrypoint", NULL } }, 63 { "dir", 64 { COMMON_FILE_PERMS, "add_name", "remove_name", 65 "reparent", "search", "rmdir", NULL } }, 66 { "fd", { "use", NULL } }, 67 { "lnk_file", 68 { COMMON_FILE_PERMS, NULL } }, 69 { "chr_file", 70 { COMMON_FILE_PERMS, NULL } }, 71 { "blk_file", 72 { COMMON_FILE_PERMS, NULL } }, 73 { "sock_file", 74 { COMMON_FILE_PERMS, NULL } }, 75 { "fifo_file", 76 { COMMON_FILE_PERMS, NULL } }, 77 { "socket", 78 { COMMON_SOCK_PERMS, NULL } }, 79 { "tcp_socket", 80 { COMMON_SOCK_PERMS, 81 "node_bind", "name_connect", 82 NULL } }, 83 { "udp_socket", 84 { COMMON_SOCK_PERMS, 85 "node_bind", NULL } }, 86 { "rawip_socket", 87 { COMMON_SOCK_PERMS, 88 "node_bind", NULL } }, 89 { "node", 90 { "recvfrom", "sendto", NULL } }, 91 { "netif", 92 { "ingress", "egress", NULL } }, 93 { "netlink_socket", 94 { COMMON_SOCK_PERMS, NULL } }, 95 { "packet_socket", 96 { COMMON_SOCK_PERMS, NULL } }, 97 { "key_socket", 98 { COMMON_SOCK_PERMS, NULL } }, 99 { "unix_stream_socket", 100 { COMMON_SOCK_PERMS, "connectto", NULL } }, 101 { "unix_dgram_socket", 102 { COMMON_SOCK_PERMS, NULL } }, 103 { "sem", 104 { COMMON_IPC_PERMS, NULL } }, 105 { "msg", { "send", "receive", NULL } }, 106 { "msgq", 107 { COMMON_IPC_PERMS, "enqueue", NULL } }, 108 { "shm", 109 { COMMON_IPC_PERMS, "lock", NULL } }, 110 { "ipc", 111 { COMMON_IPC_PERMS, NULL } }, 112 { "netlink_route_socket", 113 { COMMON_SOCK_PERMS, 114 "nlmsg_read", "nlmsg_write", NULL } }, 115 { "netlink_tcpdiag_socket", 116 { COMMON_SOCK_PERMS, 117 "nlmsg_read", "nlmsg_write", NULL } }, 118 { "netlink_nflog_socket", 119 { COMMON_SOCK_PERMS, NULL } }, 120 { "netlink_xfrm_socket", 121 { COMMON_SOCK_PERMS, 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", 128 { COMMON_SOCK_PERMS, 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 } }, 139 { "association", 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 } }, 153 { "packet", 154 { "send", "recv", "relabelto", "forward_in", "forward_out", NULL } }, 155 { "key", 156 { "view", "read", "write", "search", "link", "setattr", "create", 157 NULL } }, 158 { "dccp_socket", 159 { COMMON_SOCK_PERMS, 160 "node_bind", "name_connect", NULL } }, 161 { "memprotect", { "mmap_zero", NULL } }, 162 { "peer", { "recv", NULL } }, 163 { "capability2", 164 { COMMON_CAP2_PERMS, NULL } }, 165 { "kernel_service", { "use_as_override", "create_files_as", NULL } }, 166 { "tun_socket", 167 { COMMON_SOCK_PERMS, "attach_queue", NULL } }, 168 { "binder", { "impersonate", "call", "set_context_mgr", "transfer", 169 NULL } }, 170 { "cap_userns", 171 { COMMON_CAP_PERMS, NULL } }, 172 { "cap2_userns", 173 { COMMON_CAP2_PERMS, NULL } }, 174 { "sctp_socket", 175 { COMMON_SOCK_PERMS, 176 "node_bind", NULL } }, 177 { "icmp_socket", 178 { COMMON_SOCK_PERMS, 179 "node_bind", NULL } }, 180 { "ax25_socket", 181 { COMMON_SOCK_PERMS, NULL } }, 182 { "ipx_socket", 183 { COMMON_SOCK_PERMS, NULL } }, 184 { "netrom_socket", 185 { COMMON_SOCK_PERMS, NULL } }, 186 { "atmpvc_socket", 187 { COMMON_SOCK_PERMS, NULL } }, 188 { "x25_socket", 189 { COMMON_SOCK_PERMS, NULL } }, 190 { "rose_socket", 191 { COMMON_SOCK_PERMS, NULL } }, 192 { "decnet_socket", 193 { COMMON_SOCK_PERMS, NULL } }, 194 { "atmsvc_socket", 195 { COMMON_SOCK_PERMS, NULL } }, 196 { "rds_socket", 197 { COMMON_SOCK_PERMS, NULL } }, 198 { "irda_socket", 199 { COMMON_SOCK_PERMS, NULL } }, 200 { "pppox_socket", 201 { COMMON_SOCK_PERMS, NULL } }, 202 { "llc_socket", 203 { COMMON_SOCK_PERMS, NULL } }, 204 { "can_socket", 205 { COMMON_SOCK_PERMS, NULL } }, 206 { "tipc_socket", 207 { COMMON_SOCK_PERMS, NULL } }, 208 { "bluetooth_socket", 209 { COMMON_SOCK_PERMS, NULL } }, 210 { "iucv_socket", 211 { COMMON_SOCK_PERMS, NULL } }, 212 { "rxrpc_socket", 213 { COMMON_SOCK_PERMS, NULL } }, 214 { "isdn_socket", 215 { COMMON_SOCK_PERMS, NULL } }, 216 { "phonet_socket", 217 { COMMON_SOCK_PERMS, NULL } }, 218 { "ieee802154_socket", 219 { COMMON_SOCK_PERMS, NULL } }, 220 { "caif_socket", 221 { COMMON_SOCK_PERMS, NULL } }, 222 { "alg_socket", 223 { COMMON_SOCK_PERMS, NULL } }, 224 { "nfc_socket", 225 { COMMON_SOCK_PERMS, NULL } }, 226 { "vsock_socket", 227 { COMMON_SOCK_PERMS, NULL } }, 228 { "kcm_socket", 229 { COMMON_SOCK_PERMS, NULL } }, 230 { "qipcrtr_socket", 231 { COMMON_SOCK_PERMS, NULL } }, 232 { "smc_socket", 233 { COMMON_SOCK_PERMS, NULL } }, 234 { "infiniband_pkey", 235 { "access", NULL } }, 236 { "infiniband_endport", 237 { "manage_subnet", NULL } }, 238 { NULL } 239 }; 240 241 #if PF_MAX > 44 242 #error New address family defined, please update secclass_map. 243 #endif 244