github.com/rita33cool1/iot-system-gateway@v0.0.0-20200911033302-e65bde238cc5/docker-engine/contrib/selinux-fedora-24/docker-engine-selinux/docker.te (about) 1 policy_module(docker, 1.0.0) 2 3 ######################################## 4 # 5 # Declarations 6 # 7 8 ## <desc> 9 ## <p> 10 ## Determine whether docker can 11 ## connect to all TCP ports. 12 ## </p> 13 ## </desc> 14 gen_tunable(docker_connect_any, false) 15 16 type docker_t; 17 type docker_exec_t; 18 init_daemon_domain(docker_t, docker_exec_t) 19 domain_subj_id_change_exemption(docker_t) 20 domain_role_change_exemption(docker_t) 21 22 type spc_t; 23 domain_type(spc_t) 24 role system_r types spc_t; 25 26 type docker_auth_t; 27 type docker_auth_exec_t; 28 init_daemon_domain(docker_auth_t, docker_auth_exec_t) 29 30 type spc_var_run_t; 31 files_pid_file(spc_var_run_t) 32 33 type docker_var_lib_t; 34 files_type(docker_var_lib_t) 35 36 type docker_home_t; 37 userdom_user_home_content(docker_home_t) 38 39 type docker_config_t; 40 files_config_file(docker_config_t) 41 42 type docker_lock_t; 43 files_lock_file(docker_lock_t) 44 45 type docker_log_t; 46 logging_log_file(docker_log_t) 47 48 type docker_tmp_t; 49 files_tmp_file(docker_tmp_t) 50 51 type docker_tmpfs_t; 52 files_tmpfs_file(docker_tmpfs_t) 53 54 type docker_var_run_t; 55 files_pid_file(docker_var_run_t) 56 57 type docker_plugin_var_run_t; 58 files_pid_file(docker_plugin_var_run_t) 59 60 type docker_unit_file_t; 61 systemd_unit_file(docker_unit_file_t) 62 63 type docker_devpts_t; 64 term_pty(docker_devpts_t) 65 66 type docker_share_t; 67 files_type(docker_share_t) 68 69 ######################################## 70 # 71 # docker local policy 72 # 73 allow docker_t self:capability { chown kill fowner fsetid mknod net_admin net_bind_service net_raw setfcap }; 74 allow docker_t self:tun_socket relabelto; 75 allow docker_t self:process { getattr signal_perms setrlimit setfscreate }; 76 allow docker_t self:fifo_file rw_fifo_file_perms; 77 allow docker_t self:unix_stream_socket create_stream_socket_perms; 78 allow docker_t self:tcp_socket create_stream_socket_perms; 79 allow docker_t self:udp_socket create_socket_perms; 80 allow docker_t self:capability2 block_suspend; 81 82 docker_auth_stream_connect(docker_t) 83 84 manage_files_pattern(docker_t, docker_home_t, docker_home_t) 85 manage_dirs_pattern(docker_t, docker_home_t, docker_home_t) 86 manage_lnk_files_pattern(docker_t, docker_home_t, docker_home_t) 87 userdom_admin_home_dir_filetrans(docker_t, docker_home_t, dir, ".docker") 88 89 manage_dirs_pattern(docker_t, docker_config_t, docker_config_t) 90 manage_files_pattern(docker_t, docker_config_t, docker_config_t) 91 files_etc_filetrans(docker_t, docker_config_t, dir, "docker") 92 93 manage_dirs_pattern(docker_t, docker_lock_t, docker_lock_t) 94 manage_files_pattern(docker_t, docker_lock_t, docker_lock_t) 95 files_lock_filetrans(docker_t, docker_lock_t, { dir file }, "lxc") 96 97 manage_dirs_pattern(docker_t, docker_log_t, docker_log_t) 98 manage_files_pattern(docker_t, docker_log_t, docker_log_t) 99 manage_lnk_files_pattern(docker_t, docker_log_t, docker_log_t) 100 logging_log_filetrans(docker_t, docker_log_t, { dir file lnk_file }) 101 allow docker_t docker_log_t:dir_file_class_set { relabelfrom relabelto }; 102 103 manage_dirs_pattern(docker_t, docker_tmp_t, docker_tmp_t) 104 manage_files_pattern(docker_t, docker_tmp_t, docker_tmp_t) 105 manage_lnk_files_pattern(docker_t, docker_tmp_t, docker_tmp_t) 106 files_tmp_filetrans(docker_t, docker_tmp_t, { dir file lnk_file }) 107 108 manage_dirs_pattern(docker_t, docker_tmpfs_t, docker_tmpfs_t) 109 manage_files_pattern(docker_t, docker_tmpfs_t, docker_tmpfs_t) 110 manage_lnk_files_pattern(docker_t, docker_tmpfs_t, docker_tmpfs_t) 111 manage_fifo_files_pattern(docker_t, docker_tmpfs_t, docker_tmpfs_t) 112 manage_chr_files_pattern(docker_t, docker_tmpfs_t, docker_tmpfs_t) 113 manage_blk_files_pattern(docker_t, docker_tmpfs_t, docker_tmpfs_t) 114 allow docker_t docker_tmpfs_t:dir relabelfrom; 115 can_exec(docker_t, docker_tmpfs_t) 116 fs_tmpfs_filetrans(docker_t, docker_tmpfs_t, { dir file }) 117 allow docker_t docker_tmpfs_t:chr_file mounton; 118 119 manage_dirs_pattern(docker_t, docker_share_t, docker_share_t) 120 manage_files_pattern(docker_t, docker_share_t, docker_share_t) 121 manage_lnk_files_pattern(docker_t, docker_share_t, docker_share_t) 122 allow docker_t docker_share_t:dir_file_class_set { relabelfrom relabelto }; 123 124 can_exec(docker_t, docker_share_t) 125 #docker_filetrans_named_content(docker_t) 126 127 manage_dirs_pattern(docker_t, docker_var_lib_t, docker_var_lib_t) 128 manage_chr_files_pattern(docker_t, docker_var_lib_t, docker_var_lib_t) 129 manage_blk_files_pattern(docker_t, docker_var_lib_t, docker_var_lib_t) 130 manage_files_pattern(docker_t, docker_var_lib_t, docker_var_lib_t) 131 manage_lnk_files_pattern(docker_t, docker_var_lib_t, docker_var_lib_t) 132 allow docker_t docker_var_lib_t:dir_file_class_set { relabelfrom relabelto }; 133 files_var_lib_filetrans(docker_t, docker_var_lib_t, { dir file lnk_file }) 134 135 manage_dirs_pattern(docker_t, docker_var_run_t, docker_var_run_t) 136 manage_files_pattern(docker_t, docker_var_run_t, docker_var_run_t) 137 manage_sock_files_pattern(docker_t, docker_var_run_t, docker_var_run_t) 138 manage_lnk_files_pattern(docker_t, docker_var_run_t, docker_var_run_t) 139 files_pid_filetrans(docker_t, docker_var_run_t, { dir file lnk_file sock_file }) 140 141 allow docker_t docker_devpts_t:chr_file { relabelfrom rw_chr_file_perms setattr_chr_file_perms }; 142 term_create_pty(docker_t, docker_devpts_t) 143 144 kernel_read_system_state(docker_t) 145 kernel_read_network_state(docker_t) 146 kernel_read_all_sysctls(docker_t) 147 kernel_rw_net_sysctls(docker_t) 148 kernel_setsched(docker_t) 149 kernel_read_all_proc(docker_t) 150 151 domain_use_interactive_fds(docker_t) 152 domain_dontaudit_read_all_domains_state(docker_t) 153 154 corecmd_exec_bin(docker_t) 155 corecmd_exec_shell(docker_t) 156 157 corenet_tcp_bind_generic_node(docker_t) 158 corenet_tcp_sendrecv_generic_if(docker_t) 159 corenet_tcp_sendrecv_generic_node(docker_t) 160 corenet_tcp_sendrecv_generic_port(docker_t) 161 corenet_tcp_bind_all_ports(docker_t) 162 corenet_tcp_connect_http_port(docker_t) 163 corenet_tcp_connect_commplex_main_port(docker_t) 164 corenet_udp_sendrecv_generic_if(docker_t) 165 corenet_udp_sendrecv_generic_node(docker_t) 166 corenet_udp_sendrecv_all_ports(docker_t) 167 corenet_udp_bind_generic_node(docker_t) 168 corenet_udp_bind_all_ports(docker_t) 169 170 files_read_config_files(docker_t) 171 files_dontaudit_getattr_all_dirs(docker_t) 172 files_dontaudit_getattr_all_files(docker_t) 173 174 fs_read_cgroup_files(docker_t) 175 fs_read_tmpfs_symlinks(docker_t) 176 fs_search_all(docker_t) 177 fs_getattr_all_fs(docker_t) 178 179 storage_raw_rw_fixed_disk(docker_t) 180 181 auth_use_nsswitch(docker_t) 182 auth_dontaudit_getattr_shadow(docker_t) 183 184 init_read_state(docker_t) 185 init_status(docker_t) 186 187 logging_send_audit_msgs(docker_t) 188 logging_send_syslog_msg(docker_t) 189 190 miscfiles_read_localization(docker_t) 191 192 mount_domtrans(docker_t) 193 194 seutil_read_default_contexts(docker_t) 195 seutil_read_config(docker_t) 196 197 sysnet_dns_name_resolve(docker_t) 198 sysnet_exec_ifconfig(docker_t) 199 200 optional_policy(` 201 rpm_exec(docker_t) 202 rpm_read_db(docker_t) 203 rpm_exec(docker_t) 204 ') 205 206 optional_policy(` 207 fstools_domtrans(docker_t) 208 ') 209 210 optional_policy(` 211 iptables_domtrans(docker_t) 212 ') 213 214 optional_policy(` 215 openvswitch_stream_connect(docker_t) 216 ') 217 218 # 219 # lxc rules 220 # 221 222 allow docker_t self:capability { dac_override setgid setpcap setuid sys_admin sys_boot sys_chroot sys_ptrace }; 223 224 allow docker_t self:process { getcap setcap setexec setpgid setsched signal_perms }; 225 226 allow docker_t self:netlink_route_socket rw_netlink_socket_perms;; 227 allow docker_t self:netlink_audit_socket create_netlink_socket_perms; 228 allow docker_t self:unix_dgram_socket { create_socket_perms sendto }; 229 allow docker_t self:unix_stream_socket { create_stream_socket_perms connectto }; 230 231 allow docker_t docker_var_lib_t:dir mounton; 232 allow docker_t docker_var_lib_t:chr_file mounton; 233 can_exec(docker_t, docker_var_lib_t) 234 235 kernel_dontaudit_setsched(docker_t) 236 kernel_get_sysvipc_info(docker_t) 237 kernel_request_load_module(docker_t) 238 kernel_mounton_messages(docker_t) 239 kernel_mounton_all_proc(docker_t) 240 kernel_mounton_all_sysctls(docker_t) 241 kernel_unlabeled_entry_type(spc_t) 242 kernel_unlabeled_domtrans(docker_t, spc_t) 243 244 dev_getattr_all(docker_t) 245 dev_getattr_sysfs_fs(docker_t) 246 dev_read_urand(docker_t) 247 dev_read_lvm_control(docker_t) 248 dev_rw_sysfs(docker_t) 249 dev_rw_loop_control(docker_t) 250 dev_rw_lvm_control(docker_t) 251 252 files_getattr_isid_type_dirs(docker_t) 253 files_manage_isid_type_dirs(docker_t) 254 files_manage_isid_type_files(docker_t) 255 files_manage_isid_type_symlinks(docker_t) 256 files_manage_isid_type_chr_files(docker_t) 257 files_manage_isid_type_blk_files(docker_t) 258 files_exec_isid_files(docker_t) 259 files_mounton_isid(docker_t) 260 files_mounton_non_security(docker_t) 261 files_mounton_isid_type_chr_file(docker_t) 262 263 fs_mount_all_fs(docker_t) 264 fs_unmount_all_fs(docker_t) 265 fs_remount_all_fs(docker_t) 266 files_mounton_isid(docker_t) 267 fs_manage_cgroup_dirs(docker_t) 268 fs_manage_cgroup_files(docker_t) 269 fs_relabelfrom_xattr_fs(docker_t) 270 fs_relabelfrom_tmpfs(docker_t) 271 fs_read_tmpfs_symlinks(docker_t) 272 fs_list_hugetlbfs(docker_t) 273 274 term_use_generic_ptys(docker_t) 275 term_use_ptmx(docker_t) 276 term_getattr_pty_fs(docker_t) 277 term_relabel_pty_fs(docker_t) 278 term_mounton_unallocated_ttys(docker_t) 279 280 modutils_domtrans_insmod(docker_t) 281 282 systemd_status_all_unit_files(docker_t) 283 systemd_start_systemd_services(docker_t) 284 285 userdom_stream_connect(docker_t) 286 userdom_search_user_home_content(docker_t) 287 userdom_read_all_users_state(docker_t) 288 userdom_relabel_user_home_files(docker_t) 289 userdom_relabel_user_tmp_files(docker_t) 290 userdom_relabel_user_tmp_dirs(docker_t) 291 292 optional_policy(` 293 gpm_getattr_gpmctl(docker_t) 294 ') 295 296 optional_policy(` 297 dbus_system_bus_client(docker_t) 298 init_dbus_chat(docker_t) 299 init_start_transient_unit(docker_t) 300 301 optional_policy(` 302 systemd_dbus_chat_logind(docker_t) 303 systemd_dbus_chat_machined(docker_t) 304 ') 305 306 optional_policy(` 307 firewalld_dbus_chat(docker_t) 308 ') 309 ') 310 311 optional_policy(` 312 udev_read_db(docker_t) 313 ') 314 315 optional_policy(` 316 unconfined_domain(docker_t) 317 unconfined_typebounds(docker_t) 318 ') 319 320 optional_policy(` 321 virt_read_config(docker_t) 322 virt_exec(docker_t) 323 virt_stream_connect(docker_t) 324 virt_stream_connect_sandbox(docker_t) 325 virt_exec_sandbox_files(docker_t) 326 virt_manage_sandbox_files(docker_t) 327 virt_relabel_sandbox_filesystem(docker_t) 328 # for lxc 329 virt_transition_svirt_sandbox(docker_t, system_r) 330 virt_mounton_sandbox_file(docker_t) 331 # virt_attach_sandbox_tun_iface(docker_t) 332 allow docker_t svirt_sandbox_domain:tun_socket relabelfrom; 333 virt_sandbox_entrypoint(docker_t) 334 ') 335 336 tunable_policy(`docker_connect_any',` 337 corenet_tcp_connect_all_ports(docker_t) 338 corenet_sendrecv_all_packets(docker_t) 339 corenet_tcp_sendrecv_all_ports(docker_t) 340 ') 341 342 ######################################## 343 # 344 # spc local policy 345 # 346 allow spc_t { docker_var_lib_t docker_share_t }:file entrypoint; 347 role system_r types spc_t; 348 349 domtrans_pattern(docker_t, docker_share_t, spc_t) 350 domtrans_pattern(docker_t, docker_var_lib_t, spc_t) 351 allow docker_t spc_t:process { setsched signal_perms }; 352 ps_process_pattern(docker_t, spc_t) 353 allow docker_t spc_t:socket_class_set { relabelto relabelfrom }; 354 filetrans_pattern(docker_t, docker_var_lib_t, docker_share_t, dir, "overlay") 355 356 optional_policy(` 357 systemd_dbus_chat_machined(spc_t) 358 ') 359 360 optional_policy(` 361 dbus_chat_system_bus(spc_t) 362 ') 363 364 optional_policy(` 365 unconfined_domain_noaudit(spc_t) 366 ') 367 368 optional_policy(` 369 virt_transition_svirt_sandbox(spc_t, system_r) 370 virt_sandbox_entrypoint(spc_t) 371 ') 372 373 ######################################## 374 # 375 # docker_auth local policy 376 # 377 allow docker_auth_t self:fifo_file rw_fifo_file_perms; 378 allow docker_auth_t self:unix_stream_socket create_stream_socket_perms; 379 dontaudit docker_auth_t self:capability net_admin; 380 381 docker_stream_connect(docker_auth_t) 382 383 manage_dirs_pattern(docker_auth_t, docker_plugin_var_run_t, docker_plugin_var_run_t) 384 manage_files_pattern(docker_auth_t, docker_plugin_var_run_t, docker_plugin_var_run_t) 385 manage_sock_files_pattern(docker_auth_t, docker_plugin_var_run_t, docker_plugin_var_run_t) 386 manage_lnk_files_pattern(docker_auth_t, docker_plugin_var_run_t, docker_plugin_var_run_t) 387 files_pid_filetrans(docker_auth_t, docker_plugin_var_run_t, { dir file lnk_file sock_file }) 388 389 domain_use_interactive_fds(docker_auth_t) 390 391 kernel_read_net_sysctls(docker_auth_t) 392 393 auth_use_nsswitch(docker_auth_t) 394 395 files_read_etc_files(docker_auth_t) 396 397 miscfiles_read_localization(docker_auth_t) 398 399 sysnet_dns_name_resolve(docker_auth_t)