diff --git a/refpolicy/Changelog b/refpolicy/Changelog index cb547a7..b9f6f19 100644 --- a/refpolicy/Changelog +++ b/refpolicy/Changelog @@ -3,7 +3,7 @@ - Added policies: comsat dbus - dhcpd + dhcp squid * Fri Aug 26 2005 Chris PeBenito - 20050826 diff --git a/refpolicy/policy/modules/services/dhcp.fc b/refpolicy/policy/modules/services/dhcp.fc new file mode 100644 index 0000000..dd68495 --- /dev/null +++ b/refpolicy/policy/modules/services/dhcp.fc @@ -0,0 +1,6 @@ + +/usr/sbin/dhcpd.* -- context_template(system_u:object_r:dhcpd_exec_t,s0) + +/var/lib/dhcp(3)?/dhcpd\.leases.* -- context_template(system_u:object_r:dhcpd_state_t,s0) + +/var/run/dhcpd\.pid -d context_template(system_u:object_r:dhcpd_var_run_t,s0) diff --git a/refpolicy/policy/modules/services/dhcp.if b/refpolicy/policy/modules/services/dhcp.if new file mode 100644 index 0000000..4a40fbc --- /dev/null +++ b/refpolicy/policy/modules/services/dhcp.if @@ -0,0 +1,20 @@ +## Dynamic host configuration protocol (DHCP) server + +######################################## +## +## Set the attributes of the DCHP +## server state files. +## +## +## Domain allowed access. +## +# +interface(`dhcpd_setattr_state_files',` + gen_require(` + type dhcpd_state_t; + class file setattr; + ') + + sysnet_search_dhcp_state($1) + allow $1 dhcpd_state_t:file setattr; +') diff --git a/refpolicy/policy/modules/services/dhcp.te b/refpolicy/policy/modules/services/dhcp.te new file mode 100644 index 0000000..bb2be4e --- /dev/null +++ b/refpolicy/policy/modules/services/dhcp.te @@ -0,0 +1,136 @@ + +policy_module(dhcp,1.0) + +######################################## +# +# Declarations +# + +type dhcpd_t; +type dhcpd_exec_t; +init_daemon_domain(dhcpd_t,dhcpd_exec_t) + +type dhcpd_state_t; +files_type(dhcpd_state_t) + +type dhcpd_tmp_t; +files_tmp_file(dhcpd_tmp_t) + +type dhcpd_var_run_t; +files_pid_file(dhcpd_var_run_t) + +######################################## +# +# Local policy +# + +dontaudit dhcpd_t self:capability { net_admin sys_tty_config }; +allow dhcpd_t self:fifo_file { read write getattr }; +allow dhcpd_t self:unix_dgram_socket create_socket_perms; +allow dhcpd_t self:unix_stream_socket create_socket_perms; +allow dhcpd_t self:netlink_route_socket r_netlink_socket_perms; +allow dhcpd_t self:tcp_socket create_stream_socket_perms; +allow dhcpd_t self:udp_socket create_socket_perms; +# Allow dhcpd_t to use packet sockets +allow dhcpd_t self:packet_socket create_socket_perms; +allow dhcpd_t self:rawip_socket create_socket_perms; + +can_exec(dhcpd_t,dhcpd_exec_t) + +allow dhcpd_t dhcpd_state_t:file create_file_perms; +sysnet_create_dhcp_state(dhcpd_t,dhcpd_state_t) + +allow dhcpd_t dhcpd_tmp_t:dir create_dir_perms; +allow dhcpd_t dhcpd_tmp_t:file create_file_perms; +files_create_tmp_files(dhcpd_t, dhcpd_tmp_t, { file dir }) + +allow dhcpd_t dhcpd_var_run_t:file create_file_perms; +files_create_pid(dhcpd_t,dhcpd_var_run_t) + +kernel_read_system_state(dhcpd_t) +kernel_read_kernel_sysctl(dhcpd_t) + +corenet_tcp_sendrecv_all_if(dhcpd_t) +corenet_udp_sendrecv_all_if(dhcpd_t) +corenet_raw_sendrecv_all_if(dhcpd_t) +corenet_tcp_sendrecv_all_nodes(dhcpd_t) +corenet_udp_sendrecv_all_nodes(dhcpd_t) +corenet_raw_sendrecv_all_nodes(dhcpd_t) +corenet_tcp_sendrecv_all_ports(dhcpd_t) +corenet_udp_sendrecv_all_ports(dhcpd_t) +corenet_tcp_bind_all_nodes(dhcpd_t) +corenet_udp_bind_all_nodes(dhcpd_t) +corenet_udp_bind_dhcpd_port(dhcpd_t) +corenet_udp_bind_pxe_port(dhcpd_t) + +dev_read_sysfs(dhcpd_t) +dev_read_rand(dhcpd_t) +dev_read_urand(dhcpd_t) + +fs_getattr_all_fs(dhcpd_t) +fs_search_auto_mountpoints(dhcpd_t) + +term_dontaudit_use_console(dhcpd_t) + +corecmd_exec_bin(dhcpd_t) +corecmd_exec_sbin(dhcpd_t) + +domain_use_wide_inherit_fd(dhcpd_t) + +files_read_etc_files(dhcpd_t) +files_read_usr_files(dhcpd_t) +files_read_etc_runtime_files(dhcpd_t) +files_search_var_lib(dhcpd_t) + +init_use_fd(dhcpd_t) +init_use_script_pty(dhcpd_t) + +libs_use_ld_so(dhcpd_t) +libs_use_shared_libs(dhcpd_t) + +logging_send_syslog_msg(dhcpd_t) + +miscfiles_read_localization(dhcpd_t) + +sysnet_read_config(dhcpd_t) +sysnet_read_dhcp_config(dhcpd_t) + +userdom_dontaudit_use_unpriv_user_fd(dhcpd_t) +userdom_dontaudit_search_sysadm_home_dir(dhcpd_t) + +ifdef(`distro_gentoo',` + allow dhcpd_t self:capability { chown dac_override setgid setuid sys_chroot }; +') + +ifdef(`targeted_policy',` + term_dontaudit_use_unallocated_tty(dhcpd_t) + term_dontaudit_use_generic_pty(dhcpd_t) + files_dontaudit_read_root_file(dhcpd_t) +') + +optional_policy(`bind.te',` + # used for dynamic DNS + bind_read_dnssec_keys(dhcpd_t) +') + +optional_policy(`mount.te',` + mount_send_nfs_client_request(dhcpd_t) +') + +optional_policy(`nis.te',` + nis_use_ypbind(dhcpd_t) +') + +optional_policy(`selinuxutil.te',` + seutil_sigchld_newrole(dhcpd_t) +') + +optional_policy(`udev.te',` + udev_read_db(dhcpd_t) +') + +ifdef(`TODO',` +optional_policy(`rhgb.te',` + rhgb_domain(dhcpd_t) +') +') dnl end TODO diff --git a/refpolicy/policy/modules/services/dhcpd.fc b/refpolicy/policy/modules/services/dhcpd.fc deleted file mode 100644 index dd68495..0000000 --- a/refpolicy/policy/modules/services/dhcpd.fc +++ /dev/null @@ -1,6 +0,0 @@ - -/usr/sbin/dhcpd.* -- context_template(system_u:object_r:dhcpd_exec_t,s0) - -/var/lib/dhcp(3)?/dhcpd\.leases.* -- context_template(system_u:object_r:dhcpd_state_t,s0) - -/var/run/dhcpd\.pid -d context_template(system_u:object_r:dhcpd_var_run_t,s0) diff --git a/refpolicy/policy/modules/services/dhcpd.if b/refpolicy/policy/modules/services/dhcpd.if deleted file mode 100644 index 4a40fbc..0000000 --- a/refpolicy/policy/modules/services/dhcpd.if +++ /dev/null @@ -1,20 +0,0 @@ -## Dynamic host configuration protocol (DHCP) server - -######################################## -## -## Set the attributes of the DCHP -## server state files. -## -## -## Domain allowed access. -## -# -interface(`dhcpd_setattr_state_files',` - gen_require(` - type dhcpd_state_t; - class file setattr; - ') - - sysnet_search_dhcp_state($1) - allow $1 dhcpd_state_t:file setattr; -') diff --git a/refpolicy/policy/modules/services/dhcpd.te b/refpolicy/policy/modules/services/dhcpd.te deleted file mode 100644 index 9958d98..0000000 --- a/refpolicy/policy/modules/services/dhcpd.te +++ /dev/null @@ -1,136 +0,0 @@ - -policy_module(dhcpd,1.0) - -######################################## -# -# Declarations -# - -type dhcpd_t; -type dhcpd_exec_t; -init_daemon_domain(dhcpd_t,dhcpd_exec_t) - -type dhcpd_state_t; -files_type(dhcpd_state_t) - -type dhcpd_tmp_t; -files_tmp_file(dhcpd_tmp_t) - -type dhcpd_var_run_t; -files_pid_file(dhcpd_var_run_t) - -######################################## -# -# Local policy -# - -dontaudit dhcpd_t self:capability { net_admin sys_tty_config }; -allow dhcpd_t self:fifo_file { read write getattr }; -allow dhcpd_t self:unix_dgram_socket create_socket_perms; -allow dhcpd_t self:unix_stream_socket create_socket_perms; -allow dhcpd_t self:netlink_route_socket r_netlink_socket_perms; -allow dhcpd_t self:tcp_socket create_stream_socket_perms; -allow dhcpd_t self:udp_socket create_socket_perms; -# Allow dhcpd_t to use packet sockets -allow dhcpd_t self:packet_socket create_socket_perms; -allow dhcpd_t self:rawip_socket create_socket_perms; - -can_exec(dhcpd_t,dhcpd_exec_t) - -allow dhcpd_t dhcpd_state_t:file create_file_perms; -sysnet_create_dhcp_state(dhcpd_t,dhcpd_state_t) - -allow dhcpd_t dhcpd_tmp_t:dir create_dir_perms; -allow dhcpd_t dhcpd_tmp_t:file create_file_perms; -files_create_tmp_files(dhcpd_t, dhcpd_tmp_t, { file dir }) - -allow dhcpd_t dhcpd_var_run_t:file create_file_perms; -files_create_pid(dhcpd_t,dhcpd_var_run_t) - -kernel_read_system_state(dhcpd_t) -kernel_read_kernel_sysctl(dhcpd_t) - -corenet_tcp_sendrecv_all_if(dhcpd_t) -corenet_udp_sendrecv_all_if(dhcpd_t) -corenet_raw_sendrecv_all_if(dhcpd_t) -corenet_tcp_sendrecv_all_nodes(dhcpd_t) -corenet_udp_sendrecv_all_nodes(dhcpd_t) -corenet_raw_sendrecv_all_nodes(dhcpd_t) -corenet_tcp_sendrecv_all_ports(dhcpd_t) -corenet_udp_sendrecv_all_ports(dhcpd_t) -corenet_tcp_bind_all_nodes(dhcpd_t) -corenet_udp_bind_all_nodes(dhcpd_t) -corenet_udp_bind_dhcpd_port(dhcpd_t) -corenet_udp_bind_pxe_port(dhcpd_t) - -dev_read_sysfs(dhcpd_t) -dev_read_rand(dhcpd_t) -dev_read_urand(dhcpd_t) - -fs_getattr_all_fs(dhcpd_t) -fs_search_auto_mountpoints(dhcpd_t) - -term_dontaudit_use_console(dhcpd_t) - -corecmd_exec_bin(dhcpd_t) -corecmd_exec_sbin(dhcpd_t) - -domain_use_wide_inherit_fd(dhcpd_t) - -files_read_etc_files(dhcpd_t) -files_read_usr_files(dhcpd_t) -files_read_etc_runtime_files(dhcpd_t) -files_search_var_lib(dhcpd_t) - -init_use_fd(dhcpd_t) -init_use_script_pty(dhcpd_t) - -libs_use_ld_so(dhcpd_t) -libs_use_shared_libs(dhcpd_t) - -logging_send_syslog_msg(dhcpd_t) - -miscfiles_read_localization(dhcpd_t) - -sysnet_read_config(dhcpd_t) -sysnet_read_dhcp_config(dhcpd_t) - -userdom_dontaudit_use_unpriv_user_fd(dhcpd_t) -userdom_dontaudit_search_sysadm_home_dir(dhcpd_t) - -ifdef(`distro_gentoo',` - allow dhcpd_t self:capability { chown dac_override setgid setuid sys_chroot }; -') - -ifdef(`targeted_policy',` - term_dontaudit_use_unallocated_tty(dhcpd_t) - term_dontaudit_use_generic_pty(dhcpd_t) - files_dontaudit_read_root_file(dhcpd_t) -') - -optional_policy(`bind.te',` - # used for dynamic DNS - bind_read_dnssec_keys(dhcpd_t) -') - -optional_policy(`mount.te',` - mount_send_nfs_client_request(dhcpd_t) -') - -optional_policy(`nis.te',` - nis_use_ypbind(dhcpd_t) -') - -optional_policy(`selinuxutil.te',` - seutil_sigchld_newrole(dhcpd_t) -') - -optional_policy(`udev.te',` - udev_read_db(dhcpd_t) -') - -ifdef(`TODO',` -optional_policy(`rhgb.te',` - rhgb_domain(dhcpd_t) -') -') dnl end TODO