diff --git a/policy/modules/kernel/corenetwork.te.in b/policy/modules/kernel/corenetwork.te.in index 24ffdc1..2cec5d3 100644 --- a/policy/modules/kernel/corenetwork.te.in +++ b/policy/modules/kernel/corenetwork.te.in @@ -1,5 +1,5 @@ -policy_module(corenetwork, 1.2.19) +policy_module(corenetwork, 1.2.20) ######################################## # @@ -121,6 +121,7 @@ network_port(ldap, tcp,389,s0, udp,389,s0, tcp,636,s0, udp,636,s0, tcp,3268,s0) type lrrd_port_t, port_type; dnl network_port(lrrd_port_t) # no defined portcon network_port(lmtp, tcp,24,s0, udp,24,s0) network_port(mail, tcp,2000,s0) +network_port(memcache, tcp,11211,s0, udp,11211,s0) network_port(mmcc, tcp,5050,s0, udp,5050,s0) network_port(monopd, tcp,1234,s0) network_port(msnp, tcp,1863,s0, udp,1863,s0) diff --git a/policy/modules/kernel/selinux.if b/policy/modules/kernel/selinux.if index b75d251..c931e1e 100644 --- a/policy/modules/kernel/selinux.if +++ b/policy/modules/kernel/selinux.if @@ -362,6 +362,27 @@ interface(`selinux_validate_context',` ######################################## ## +## Do not audit attempts to validate security contexts. +## +## +## +## Domain to not audit. +## +## +## +# +interface(`selinux_dontaudit_validate_context',` + gen_require(` + type security_t; + ') + + dontaudit $1 security_t:dir list_dir_perms; + dontaudit $1 security_t:file { getattr read write }; + dontaudit $1 security_t:security check_context; +') + +######################################## +## ## Allows caller to compute an access vector. ## ## diff --git a/policy/modules/kernel/selinux.te b/policy/modules/kernel/selinux.te index 4293296..671f598 100644 --- a/policy/modules/kernel/selinux.te +++ b/policy/modules/kernel/selinux.te @@ -1,5 +1,5 @@ -policy_module(selinux, 1.6.0) +policy_module(selinux, 1.6.1) ######################################## # diff --git a/policy/modules/services/bitlbee.te b/policy/modules/services/bitlbee.te index 748608f..11816d0 100644 --- a/policy/modules/services/bitlbee.te +++ b/policy/modules/services/bitlbee.te @@ -1,5 +1,5 @@ -policy_module(bitlbee, 1.0.1) +policy_module(bitlbee, 1.0.2) ######################################## # @@ -65,6 +65,9 @@ corenet_tcp_sendrecv_mmcc_port(bitlbee_t) # and to MSNP (MSN Messenger) servers: corenet_tcp_connect_msnp_port(bitlbee_t) corenet_tcp_sendrecv_msnp_port(bitlbee_t) +# MSN can use passport auth, which is over http: +corenet_tcp_connect_http_port(bitlbee_t) +corenet_tcp_sendrecv_http_port(bitlbee_t) dev_read_rand(bitlbee_t) dev_read_urand(bitlbee_t) diff --git a/policy/modules/services/kerberos.fc b/policy/modules/services/kerberos.fc index 10b302e..4a5974b 100644 --- a/policy/modules/services/kerberos.fc +++ b/policy/modules/services/kerberos.fc @@ -5,14 +5,24 @@ /etc/krb5kdc/kadm5\.keytab -- gen_context(system_u:object_r:krb5_keytab_t,s0) /etc/krb5kdc/principal.* gen_context(system_u:object_r:krb5kdc_principal_t,s0) +/etc/rc\.d/init\.d/kadmind -- gen_context(system_u:object_r:kerberos_initrc_exec_t,s0) +/etc/rc\.d/init\.d/kpropd -- gen_context(system_u:object_r:kerberos_initrc_exec_t,s0) +/etc/rc\.d/init\.d/krb524d -- gen_context(system_u:object_r:kerberos_initrc_exec_t,s0) +/etc/rc\.d/init\.d/krb5kdc -- gen_context(system_u:object_r:kerberos_initrc_exec_t,s0) + /usr/(local/)?(kerberos/)?sbin/krb5kdc -- gen_context(system_u:object_r:krb5kdc_exec_t,s0) /usr/(local/)?(kerberos/)?sbin/kadmind -- gen_context(system_u:object_r:kadmind_exec_t,s0) +/usr/kerberos/sbin/kadmin\.local -- gen_context(system_u:object_r:kadmind_exec_t,s0) /usr/local/var/krb5kdc(/.*)? gen_context(system_u:object_r:krb5kdc_conf_t,s0) /usr/local/var/krb5kdc/principal.* gen_context(system_u:object_r:krb5kdc_principal_t,s0) /var/kerberos/krb5kdc(/.*)? gen_context(system_u:object_r:krb5kdc_conf_t,s0) +/var/kerberos/krb5kdc/from_master.* gen_context(system_u:object_r:krb5kdc_lock_t,s0) /var/kerberos/krb5kdc/principal.* gen_context(system_u:object_r:krb5kdc_principal_t,s0) +/var/kerberos/krb5kdc/principal\.ok gen_context(system_u:object_r:krb5kdc_lock_t,s0) /var/log/krb5kdc\.log gen_context(system_u:object_r:krb5kdc_log_t,s0) /var/log/kadmin(d)?\.log gen_context(system_u:object_r:kadmind_log_t,s0) + +/var/tmp/host_0 -- gen_context(system_u:object_r:krb5_host_rcache_t,s0) diff --git a/policy/modules/services/kerberos.if b/policy/modules/services/kerberos.if index 8f11718..b7492cf 100644 --- a/policy/modules/services/kerberos.if +++ b/policy/modules/services/kerberos.if @@ -23,6 +23,42 @@ ######################################## ## +## Execute kadmind in the current domain +## +## +## +## Domain allowed access. +## +## +# +interface(`kerberos_exec_kadmind',` + gen_require(` + type kadmind_exec_t; + ') + + can_exec($1, kadmind_exec_t) +') + +######################################## +## +## Execute a domain transition to run kpropd. +## +## +## +## Domain allowed to transition. +## +## +# +interface(`kerberos_domtrans_kpropd',` + gen_require(` + type kpropd_t, kpropd_exec_t; + ') + + domtrans_pattern($1, kpropd_exec_t, kpropd_t) +') + +######################################## +## ## Use kerberos services ## ## @@ -42,6 +78,11 @@ interface(`kerberos_use',` dontaudit $1 krb5kdc_conf_t:dir list_dir_perms; dontaudit $1 krb5kdc_conf_t:file rw_file_perms; + #kerberos libraries are attempting to set the correct file context + dontaudit $1 self:process setfscreate; + selinux_dontaudit_validate_context($1) + seutil_dontaudit_read_file_contexts($1) + tunable_policy(`allow_kerberos',` allow $1 self:tcp_socket create_socket_perms; allow $1 self:udp_socket create_socket_perms; @@ -60,9 +101,6 @@ interface(`kerberos_use',` corenet_tcp_connect_ocsp_port($1) corenet_sendrecv_kerberos_client_packets($1) corenet_sendrecv_ocsp_client_packets($1) - - sysnet_read_config($1) - sysnet_dns_name_resolve($1) ') optional_policy(` @@ -153,6 +191,31 @@ interface(`kerberos_read_keytab',` ######################################## ## +## Create a derived type for kerberos keytab +## +## +## +## The prefix to be used for deriving type names. +## +## +## +## +## Domain allowed access. +## +## +# +template(`kerberos_keytab_template',` + type $1_keytab_t; + files_type($1_keytab_t) + + allow $2 $1_keytab_t:file read_file_perms; + + kerberos_read_keytab($2) + kerberos_use($2) +') + +######################################## +## ## Read the kerberos kdc configuration file (/etc/krb5kdc.conf). ## ## @@ -168,6 +231,129 @@ interface(`kerberos_read_kdc_config',` ') files_search_etc($1) - allow $1 krb5kdc_conf_t:file read_file_perms; + read_files_pattern($1, krb5kdc_conf_t, krb5kdc_conf_t) +') + +######################################## +## +## Read the kerberos kdc configuration file (/etc/krb5kdc.conf). +## +## +## +## Domain allowed access. +## +## +## +# +interface(`kerberos_manage_host_rcache',` + gen_require(` + type krb5_host_rcache_t; + ') + + # creates files as system_u no matter what the selinux user + # cjp: should be in the below tunable but typeattribute + # does not work in conditionals + domain_obj_id_change_exemption($1) + + tunable_policy(`allow_kerberos',` + allow $1 self:process setfscreate; + + selinux_validate_context($1) + + seutil_read_file_contexts($1) + + allow $1 krb5_host_rcache_t:file manage_file_perms; + files_search_tmp($1) + ') +') + +######################################## +## +## Connect to krb524 service +## +## +## +## Domain allowed access. +## +## +# +interface(`kerberos_connect_524',` + tunable_policy(`allow_kerberos',` + allow $1 self:udp_socket create_socket_perms; + + corenet_all_recvfrom_unlabeled($1) + corenet_udp_sendrecv_generic_if($1) + corenet_udp_sendrecv_all_nodes($1) + corenet_udp_sendrecv_kerberos_master_port($1) + corenet_sendrecv_kerberos_master_client_packets($1) + ') +') + +######################################## +## +## All of the rules required to administrate +## an kerberos environment +## +## +## +## Domain allowed access. +## +## +## +## +## The role to be allowed to manage the kerberos domain. +## +## +## +# +interface(`kerberos_admin',` + gen_require(` + type kadmind_t, krb5kdc_t, kerberos_initrc_exec_t; + type kadmind_log_t, kadmind_tmp_t, kadmind_var_run_t; + type krb5_conf_t, krb5_keytab_t, krb5kdc_conf_t; + type krb5kdc_principal_t, krb5kdc_tmp_t; + type krb5kdc_var_run_t, krb5_host_rcache_t; + type kadmind_spool_t, kadmind_var_lib_t, kpropd_t; + ') + + allow $1 kadmind_t:process { ptrace signal_perms }; + ps_process_pattern($1, kadmind_t) + + allow $1 krb5kdc_t:process { ptrace signal_perms }; + ps_process_pattern($1, krb5kdc_t) + + allow $1 kpropd_t:process { ptrace signal_perms }; + ps_process_pattern($1, kpropd_t) + + init_labeled_script_domtrans($1, kerberos_initrc_exec_t) + domain_system_change_exemption($1) + role_transition $2 kerberos_initrc_exec_t system_r; + allow $2 system_r; + + logging_list_logs($1) + admin_pattern($1, kadmind_log_t) + + files_list_spool($1) + admin_pattern($1, kadmind_spool_t) + + files_list_tmp($1) + admin_pattern($1, kadmind_tmp_t) + + files_list_var_lib($1) + admin_pattern($1, kadmind_var_lib_t) + + files_list_pids($1) + admin_pattern($1, kadmind_var_run_t) + + admin_pattern($1, krb5_conf_t) + + admin_pattern($1, krb5_host_rcache_t) + + admin_pattern($1, krb5_keytab_t) + + admin_pattern($1, krb5kdc_principal_t) + + admin_pattern($1, krb5kdc_tmp_t) + admin_pattern($1, krb5kdc_var_run_t) ') diff --git a/policy/modules/services/kerberos.te b/policy/modules/services/kerberos.te index 9f5725f..8457d75 100644 --- a/policy/modules/services/kerberos.te +++ b/policy/modules/services/kerberos.te @@ -1,5 +1,5 @@ -policy_module(kerberos, 1.7.0) +policy_module(kerberos, 1.7.1) ######################################## # @@ -16,6 +16,7 @@ gen_tunable(allow_kerberos, false) type kadmind_t; type kadmind_exec_t; init_daemon_domain(kadmind_t, kadmind_exec_t) +domain_obj_id_change_exemption(kadmind_t) type kadmind_log_t; logging_log_file(kadmind_log_t) @@ -26,9 +27,19 @@ files_tmp_file(kadmind_tmp_t) type kadmind_var_run_t; files_pid_file(kadmind_var_run_t) +type kerberos_initrc_exec_t; +init_script_file(kerberos_initrc_exec_t) + +type kpropd_t; +type kpropd_exec_t; +init_daemon_domain(kpropd_t, kpropd_exec_t) + type krb5_conf_t; files_type(krb5_conf_t) +type krb5_host_rcache_t; +files_tmp_file(krb5_host_rcache_t) + # types for general configuration files in /etc type krb5_keytab_t; files_security_file(krb5_keytab_t) @@ -37,6 +48,9 @@ files_security_file(krb5_keytab_t) type krb5kdc_conf_t; files_type(krb5kdc_conf_t) +type krb5kdc_lock_t; +files_type(krb5kdc_lock_t) + # types for KDC principal file(s) type krb5kdc_principal_t; files_type(krb5kdc_principal_t) @@ -44,6 +58,7 @@ files_type(krb5kdc_principal_t) type krb5kdc_t; type krb5kdc_exec_t; init_daemon_domain(krb5kdc_t, krb5kdc_exec_t) +domain_obj_id_change_exemption(krb5kdc_t) type krb5kdc_log_t; logging_log_file(krb5kdc_log_t) @@ -62,7 +77,7 @@ files_pid_file(krb5kdc_var_run_t) # Use capabilities. Surplus capabilities may be allowed. allow kadmind_t self:capability { setuid setgid chown fowner dac_override sys_nice }; dontaudit kadmind_t self:capability sys_tty_config; -allow kadmind_t self:process signal_perms; +allow kadmind_t self:process { setfscreate signal_perms }; allow kadmind_t self:netlink_route_socket r_netlink_socket_perms; allow kadmind_t self:unix_dgram_socket { connect create write }; allow kadmind_t self:tcp_socket connected_stream_socket_perms; @@ -77,7 +92,10 @@ dontaudit kadmind_t krb5_conf_t:file write; read_files_pattern(kadmind_t, krb5kdc_conf_t, krb5kdc_conf_t) dontaudit kadmind_t krb5kdc_conf_t:file { write setattr }; -allow kadmind_t krb5kdc_principal_t:file { getattr lock read write setattr }; +allow kadmind_t krb5kdc_lock_t:file { rw_file_perms setattr }; + +allow kadmind_t krb5kdc_principal_t:file manage_file_perms; +filetrans_pattern(kadmind_t, krb5kdc_conf_t, krb5kdc_principal_t, file) can_exec(kadmind_t, kadmind_exec_t) @@ -91,6 +109,7 @@ files_pid_filetrans(kadmind_t, kadmind_var_run_t, file) kernel_read_kernel_sysctls(kadmind_t) kernel_list_proc(kadmind_t) kernel_read_proc_symlinks(kadmind_t) +kernel_read_system_state(kadmind_t) corenet_all_recvfrom_unlabeled(kadmind_t) corenet_all_recvfrom_netlabel(kadmind_t) @@ -118,6 +137,11 @@ fs_search_auto_mountpoints(kadmind_t) domain_use_interactive_fds(kadmind_t) files_read_etc_files(kadmind_t) +files_read_usr_symlinks(kadmind_t) +files_read_usr_files(kadmind_t) +files_read_var_files(kadmind_t) + +selinux_validate_context(kadmind_t) libs_use_ld_so(kadmind_t) libs_use_shared_libs(kadmind_t) @@ -126,7 +150,10 @@ logging_send_syslog_msg(kadmind_t) miscfiles_read_localization(kadmind_t) +seutil_read_file_contexts(kadmind_t) + sysnet_read_config(kadmind_t) +sysnet_use_ldap(kadmind_t) userdom_dontaudit_use_unpriv_user_fds(kadmind_t) @@ -152,7 +179,7 @@ optional_policy(` # Use capabilities. Surplus capabilities may be allowed. allow krb5kdc_t self:capability { setuid setgid net_admin chown fowner dac_override sys_nice }; dontaudit krb5kdc_t self:capability sys_tty_config; -allow krb5kdc_t self:process { setsched getsched signal_perms }; +allow krb5kdc_t self:process { setfscreate setsched getsched signal_perms }; allow krb5kdc_t self:netlink_route_socket r_netlink_socket_perms; allow krb5kdc_t self:tcp_socket create_stream_socket_perms; allow krb5kdc_t self:udp_socket create_socket_perms; @@ -166,6 +193,8 @@ can_exec(krb5kdc_t, krb5kdc_exec_t) read_files_pattern(krb5kdc_t, krb5kdc_conf_t, krb5kdc_conf_t) dontaudit krb5kdc_t krb5kdc_conf_t:file write; +allow krb5kdc_t krb5kdc_lock_t:file { rw_file_perms setattr }; + allow krb5kdc_t krb5kdc_log_t:file manage_file_perms; logging_log_filetrans(krb5kdc_t, krb5kdc_log_t, file) @@ -216,6 +245,8 @@ files_read_etc_files(krb5kdc_t) files_read_usr_symlinks(krb5kdc_t) files_read_var_files(krb5kdc_t) +selinux_validate_context(krb5kdc_t) + libs_use_ld_so(krb5kdc_t) libs_use_shared_libs(krb5kdc_t) @@ -223,7 +254,10 @@ logging_send_syslog_msg(krb5kdc_t) miscfiles_read_localization(krb5kdc_t) +seutil_read_file_contexts(krb5kdc_t) + sysnet_read_config(krb5kdc_t) +sysnet_use_ldap(krb5kdc_t) userdom_dontaudit_use_unpriv_user_fds(krb5kdc_t) @@ -240,3 +274,43 @@ optional_policy(` optional_policy(` udev_read_db(krb5kdc_t) ') + +######################################## +# +# kpropd local policy +# + +allow kpropd_t self:capability net_bind_service; +allow kpropd_t self:fifo_file rw_file_perms; +allow kpropd_t self:unix_stream_socket create_stream_socket_perms; +allow kpropd_t self:tcp_socket create_stream_socket_perms; + +allow kpropd_t krb5_host_rcache_t:file rw_file_perms; + +allow kpropd_t krb5_keytab_t:file read_file_perms; + +manage_files_pattern(kpropd_t, krb5kdc_conf_t, krb5kdc_principal_t) + +corecmd_exec_bin(kpropd_t) + +corenet_all_recvfrom_unlabeled(kpropd_t) +corenet_tcp_sendrecv_all_if(kpropd_t) +corenet_tcp_sendrecv_all_nodes(kpropd_t) +corenet_tcp_sendrecv_all_ports(kpropd_t) +corenet_tcp_bind_all_nodes(kpropd_t) + +dev_read_urand(kpropd_t) + +files_read_etc_files(kpropd_t) +files_search_tmp(kpropd_t) + +libs_use_ld_so(kpropd_t) +libs_use_shared_libs(kpropd_t) + +logging_send_syslog_msg(kpropd_t) + +miscfiles_read_localization(kpropd_t) + +sysnet_dns_name_resolve(kpropd_t) + +kerberos_use(kpropd_t) diff --git a/policy/modules/services/memcached.te b/policy/modules/services/memcached.te index cf3a8f0..1726752 100644 --- a/policy/modules/services/memcached.te +++ b/policy/modules/services/memcached.te @@ -35,6 +35,8 @@ corenet_tcp_sendrecv_all_if(memcached_t) corenet_tcp_sendrecv_all_nodes(memcached_t) corenet_tcp_sendrecv_all_ports(memcached_t) corenet_tcp_bind_all_nodes(memcached_t) +corenet_tcp_bind_memcache_port(memcached_t) +corenet_udp_bind_memcache_port(memcached_t) manage_dirs_pattern(memcached_t, memcached_var_run_t, memcached_var_run_t) manage_files_pattern(memcached_t, memcached_var_run_t, memcached_var_run_t) diff --git a/policy/modules/system/selinuxutil.if b/policy/modules/system/selinuxutil.if index 9db901c..e142824 100644 --- a/policy/modules/system/selinuxutil.if +++ b/policy/modules/system/selinuxutil.if @@ -809,6 +809,26 @@ interface(`seutil_read_file_contexts',` ######################################## ## +## Do not audit attempts to read the file_contexts files. +## +## +## +## Domain allowed access. +## +## +## +# +interface(`seutil_dontaudit_read_file_contexts',` + gen_require(` + type selinux_config_t, default_context_t, file_context_t; + ') + + dontaudit $1 { selinux_config_t default_context_t file_context_t }:dir search_dir_perms; + dontaudit $1 file_context_t:file read_file_perms; +') + +######################################## +## ## Read and write the file_contexts files. ## ## diff --git a/policy/modules/system/selinuxutil.te b/policy/modules/system/selinuxutil.te index a17d3aa..acceb13 100644 --- a/policy/modules/system/selinuxutil.te +++ b/policy/modules/system/selinuxutil.te @@ -1,5 +1,5 @@ -policy_module(selinuxutil, 1.10.0) +policy_module(selinuxutil, 1.10.1) gen_require(` bool secure_mode;