@@ -269,10 +269,19 @@ attribute httpd_script_domains;
269269attribute_role httpd_helper_roles;
270270roleattribute system_r httpd_helper_roles;
271271
272+ attribute_role httpd_ctl_roles;
273+ roleattribute system_r httpd_ctl_roles;
274+
272275type httpd_t;
273276type httpd_exec_t;
274277init_daemon_domain(httpd_t, httpd_exec_t)
275278
279+ type httpd_ctl_t;
280+ type httpd_ctl_exec_t;
281+ application_domain(httpd_ctl_t, httpd_ctl_exec_t)
282+ allow httpd_ctl_t httpd_exec_t:file entrypoint;
283+ role httpd_ctl_roles types httpd_ctl_t;
284+
276285type httpd_cache_t;
277286files_type(httpd_cache_t)
278287
@@ -903,6 +912,157 @@ optional_policy(`
903912 sympa_read_var_files(httpd_t)
904913')
905914
915+ # #######################################
916+ #
917+ # httpd_ctl local policy
918+ #
919+
920+ allow httpd_ctl_t self:capability { chown kill };
921+ # dac_override is required to read files owned by www-data, e.g., error.log
922+ allow httpd_ctl_t self:capability dac_override;
923+ dontaudit httpd_ctl_t self:capability net_admin;
924+ allow httpd_ctl_t httpd_t:process { getattr getcap getpgid getrlimit getsched getsession noatsecure rlimitinh setcap setkeycreate setpgid setsched setsockcreate share siginh signal_perms };
925+ userdom_use_inherited_user_terminals(httpd_ctl_t)
926+
927+ manage_dirs_pattern(httpd_ctl_t, httpd_cache_t, httpd_cache_t)
928+ mmap_manage_files_pattern(httpd_ctl_t, httpd_cache_t, httpd_cache_t)
929+ manage_lnk_files_pattern(httpd_ctl_t, httpd_cache_t, httpd_cache_t)
930+ files_var_filetrans(httpd_ctl_t, httpd_cache_t, dir)
931+
932+ allow httpd_ctl_t httpd_config_t:dir list_dir_perms;
933+ read_files_pattern(httpd_ctl_t, httpd_config_t, httpd_config_t)
934+ read_lnk_files_pattern(httpd_ctl_t, httpd_config_t, httpd_config_t)
935+
936+ allow httpd_ctl_t httpd_htaccess_type:file read_file_perms;
937+
938+ allow httpd_ctl_t httpd_ro_content:dir list_dir_perms;
939+ allow httpd_ctl_t httpd_ro_content:file { map read_file_perms };
940+ allow httpd_ctl_t httpd_ro_content:lnk_file read_lnk_file_perms;
941+
942+ allow httpd_ctl_t httpd_keytab_t:file read_file_perms;
943+
944+ allow httpd_ctl_t httpd_lock_t:dir manage_dir_perms;
945+ allow httpd_ctl_t httpd_lock_t:file manage_file_perms;
946+ files_lock_filetrans(httpd_ctl_t, httpd_lock_t, { file dir })
947+
948+ manage_dirs_pattern(httpd_ctl_t, httpd_log_t, httpd_log_t)
949+ append_files_pattern(httpd_ctl_t, httpd_log_t, httpd_log_t)
950+ create_files_pattern(httpd_ctl_t, httpd_log_t, httpd_log_t)
951+ read_files_pattern(httpd_ctl_t, httpd_log_t, httpd_log_t)
952+ setattr_files_pattern(httpd_ctl_t, httpd_log_t, httpd_log_t)
953+ read_lnk_files_pattern(httpd_ctl_t, httpd_log_t, httpd_log_t)
954+ logging_log_filetrans(httpd_ctl_t, httpd_log_t, file)
955+
956+ allow httpd_ctl_t httpd_modules_t:dir list_dir_perms;
957+ mmap_exec_files_pattern(httpd_ctl_t, httpd_modules_t, httpd_modules_t)
958+ read_files_pattern(httpd_ctl_t, httpd_modules_t, httpd_modules_t)
959+ read_lnk_files_pattern(httpd_ctl_t, httpd_modules_t, httpd_modules_t)
960+
961+ allow httpd_ctl_t httpd_rotatelogs_t:process signal_perms;
962+
963+ manage_dirs_pattern(httpd_ctl_t, httpd_squirrelmail_t, httpd_squirrelmail_t)
964+ mmap_manage_files_pattern(httpd_ctl_t, httpd_squirrelmail_t, httpd_squirrelmail_t)
965+ manage_lnk_files_pattern(httpd_ctl_t, httpd_squirrelmail_t, httpd_squirrelmail_t)
966+
967+ allow httpd_ctl_t httpd_suexec_exec_t:file read_file_perms;
968+
969+ allow httpd_ctl_t httpd_sys_script_t:unix_stream_socket connectto;
970+ allow httpd_ctl_t httpd_sys_script_t:process signull;
971+
972+
973+ manage_dirs_pattern(httpd_ctl_t, httpd_tmp_t, httpd_tmp_t)
974+ manage_files_pattern(httpd_ctl_t, httpd_tmp_t, httpd_tmp_t)
975+ allow httpd_ctl_t httpd_tmp_t:file map;
976+ manage_sock_files_pattern(httpd_ctl_t, httpd_tmp_t, httpd_tmp_t)
977+ manage_lnk_files_pattern(httpd_ctl_t, httpd_tmp_t, httpd_tmp_t)
978+ files_tmp_filetrans(httpd_ctl_t, httpd_tmp_t, { file dir lnk_file sock_file })
979+ userdom_user_tmp_filetrans(httpd_ctl_t, httpd_tmp_t, dir)
980+
981+ manage_dirs_pattern(httpd_ctl_t, httpd_tmpfs_t, httpd_tmpfs_t)
982+ manage_files_pattern(httpd_ctl_t, httpd_tmpfs_t, httpd_tmpfs_t)
983+ manage_lnk_files_pattern(httpd_ctl_t, httpd_tmpfs_t, httpd_tmpfs_t)
984+ manage_fifo_files_pattern(httpd_ctl_t, httpd_tmpfs_t, httpd_tmpfs_t)
985+ manage_sock_files_pattern(httpd_ctl_t, httpd_tmpfs_t, httpd_tmpfs_t)
986+ fs_tmpfs_filetrans(httpd_ctl_t, httpd_tmpfs_t, { dir file lnk_file sock_file fifo_file })
987+
988+ manage_dirs_pattern(httpd_ctl_t, httpd_var_lib_t, httpd_var_lib_t)
989+ mmap_manage_files_pattern(httpd_ctl_t, httpd_var_lib_t, httpd_var_lib_t)
990+ manage_lnk_files_pattern(httpd_ctl_t, httpd_var_lib_t, httpd_var_lib_t)
991+ files_var_lib_filetrans(httpd_ctl_t, httpd_var_lib_t, { dir file })
992+
993+ setattr_dirs_pattern(httpd_ctl_t, httpd_runtime_t, httpd_runtime_t)
994+ manage_dirs_pattern(httpd_ctl_t, httpd_runtime_t, httpd_runtime_t)
995+ manage_files_pattern(httpd_ctl_t, httpd_runtime_t, httpd_runtime_t)
996+ manage_sock_files_pattern(httpd_ctl_t, httpd_runtime_t, httpd_runtime_t)
997+ files_runtime_filetrans(httpd_ctl_t, httpd_runtime_t, { file sock_file dir })
998+
999+ manage_dirs_pattern(httpd_ctl_t, squirrelmail_spool_t, squirrelmail_spool_t)
1000+ manage_files_pattern(httpd_ctl_t, squirrelmail_spool_t, squirrelmail_spool_t)
1001+ manage_lnk_files_pattern(httpd_ctl_t, squirrelmail_spool_t, squirrelmail_spool_t)
1002+
1003+ can_exec(httpd_ctl_t, httpd_exec_t)
1004+
1005+ kernel_read_kernel_sysctls(httpd_ctl_t)
1006+ kernel_read_vm_sysctls(httpd_ctl_t)
1007+ kernel_read_vm_overcommit_sysctl(httpd_ctl_t)
1008+ kernel_read_network_state(httpd_ctl_t)
1009+ kernel_read_system_state(httpd_ctl_t)
1010+ kernel_search_network_sysctl(httpd_ctl_t)
1011+
1012+ # nginx -t checks that it can bind to ports
1013+ corenet_tcp_bind_generic_node(httpd_ctl_t)
1014+ corenet_tcp_bind_http_port(httpd_ctl_t)
1015+ corenet_tcp_bind_http_cache_port(httpd_ctl_t)
1016+ optional_policy(`
1017+ tunable_policy(`httpd_mod_auth_ntlm_winbind',`
1018+ samba_domtrans_winbind_helper(httpd_ctl_t)
1019+ ')
1020+ ')
1021+ tunable_policy(`httpd_enable_ftp_server',`
1022+ corenet_tcp_bind_ftp_port(httpd_ctl_t)
1023+ ')
1024+
1025+ dev_read_sysfs(httpd_ctl_t)
1026+ dev_read_rand(httpd_ctl_t)
1027+ dev_read_urand(httpd_ctl_t)
1028+ dev_rwx_zero(httpd_ctl_t)
1029+
1030+ domain_use_interactive_fds(httpd_ctl_t)
1031+
1032+ fs_getattr_all_fs(httpd_ctl_t)
1033+ fs_search_auto_mountpoints(httpd_ctl_t)
1034+
1035+ fs_read_iso9660 _files(httpd_ctl_t)
1036+
1037+ files_dontaudit_getattr_all_runtime_files(httpd_ctl_t)
1038+ files_read_usr_files(httpd_ctl_t)
1039+ files_map_usr_files(httpd_ctl_t)
1040+ files_list_mnt(httpd_ctl_t)
1041+ files_search_spool(httpd_ctl_t)
1042+ files_read_var_symlinks(httpd_ctl_t)
1043+ files_read_var_lib_files(httpd_ctl_t)
1044+ files_search_home(httpd_ctl_t)
1045+ files_getattr_home_dir(httpd_ctl_t)
1046+ files_read_etc_runtime_files(httpd_ctl_t)
1047+ files_read_var_lib_symlinks(httpd_ctl_t)
1048+ files_map_etc_files(httpd_ctl_t)
1049+
1050+ auth_use_nsswitch(httpd_ctl_t)
1051+
1052+ init_rw_inherited_script_tmp_files(httpd_ctl_t)
1053+
1054+ libs_exec_lib_files(httpd_ctl_t)
1055+
1056+ logging_send_syslog_msg(httpd_ctl_t)
1057+
1058+ miscfiles_read_localization(httpd_ctl_t)
1059+ miscfiles_read_fonts(httpd_ctl_t)
1060+ miscfiles_read_public_files(httpd_ctl_t)
1061+ miscfiles_read_generic_certs(httpd_ctl_t)
1062+ miscfiles_read_generic_tls_privkey(httpd_ctl_t)
1063+ miscfiles_read_tetex_data(httpd_ctl_t)
1064+
1065+ seutil_dontaudit_search_config(httpd_ctl_t)
9061066
9071067# #######################################
9081068#
0 commit comments