2005-08-23 17:26:19 +00:00
|
|
|
|
2008-10-14 15:46:36 +00:00
|
|
|
policy_module(bind, 1.8.0)
|
2005-08-23 17:26:19 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
2007-03-26 18:41:45 +00:00
|
|
|
## <desc>
|
|
|
|
## <p>
|
|
|
|
## Allow BIND to write the master zone files.
|
2007-12-07 15:44:53 +00:00
|
|
|
## Generally this is used for dynamic DNS or zone transfers.
|
2007-03-26 18:41:45 +00:00
|
|
|
## </p>
|
|
|
|
## </desc>
|
2008-07-23 21:38:39 +00:00
|
|
|
gen_tunable(named_write_master_zones, false)
|
2007-03-26 18:41:45 +00:00
|
|
|
|
2005-08-23 17:26:19 +00:00
|
|
|
# for DNSSEC key files
|
2005-09-28 19:07:22 +00:00
|
|
|
type dnssec_t;
|
|
|
|
files_security_file(dnssec_t)
|
2005-08-23 17:26:19 +00:00
|
|
|
|
|
|
|
type named_t;
|
|
|
|
type named_exec_t;
|
2008-07-23 21:38:39 +00:00
|
|
|
init_daemon_domain(named_t, named_exec_t)
|
2005-08-23 17:26:19 +00:00
|
|
|
role system_r types named_t;
|
|
|
|
|
2005-09-15 21:03:29 +00:00
|
|
|
type named_checkconf_exec_t;
|
2008-07-23 21:38:39 +00:00
|
|
|
init_system_domain(named_t, named_checkconf_exec_t)
|
2005-09-15 21:03:29 +00:00
|
|
|
|
2005-08-23 17:26:19 +00:00
|
|
|
# A type for configuration files of named.
|
|
|
|
type named_conf_t;
|
|
|
|
files_type(named_conf_t)
|
2005-10-14 17:55:40 +00:00
|
|
|
files_mountpoint(named_conf_t)
|
2005-08-23 17:26:19 +00:00
|
|
|
|
|
|
|
# for secondary zone files
|
|
|
|
type named_cache_t;
|
|
|
|
files_type(named_cache_t)
|
|
|
|
|
2008-09-15 17:02:57 +00:00
|
|
|
type named_initrc_exec_t;
|
|
|
|
init_script_file(named_initrc_exec_t)
|
|
|
|
|
2005-09-15 21:03:29 +00:00
|
|
|
type named_log_t;
|
|
|
|
logging_log_file(named_log_t)
|
|
|
|
|
2005-08-23 17:26:19 +00:00
|
|
|
type named_tmp_t;
|
|
|
|
files_tmp_file(named_tmp_t)
|
|
|
|
|
|
|
|
type named_var_run_t;
|
|
|
|
files_pid_file(named_var_run_t)
|
|
|
|
|
|
|
|
# for primary zone files
|
|
|
|
type named_zone_t;
|
|
|
|
files_type(named_zone_t)
|
|
|
|
|
|
|
|
type ndc_t;
|
|
|
|
type ndc_exec_t;
|
2008-07-23 21:38:39 +00:00
|
|
|
init_system_domain(ndc_t, ndc_exec_t)
|
2005-08-23 17:26:19 +00:00
|
|
|
role system_r types ndc_t;
|
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Named local policy
|
|
|
|
#
|
|
|
|
|
|
|
|
allow named_t self:capability { chown dac_override fowner setgid setuid sys_chroot sys_nice sys_resource };
|
|
|
|
dontaudit named_t self:capability sys_tty_config;
|
2008-09-15 17:02:57 +00:00
|
|
|
allow named_t self:process { setsched getcap setcap setrlimit signal_perms };
|
2006-12-12 20:08:08 +00:00
|
|
|
allow named_t self:fifo_file rw_fifo_file_perms;
|
2005-08-23 17:26:19 +00:00
|
|
|
allow named_t self:unix_stream_socket create_stream_socket_perms;
|
|
|
|
allow named_t self:unix_dgram_socket create_socket_perms;
|
|
|
|
allow named_t self:tcp_socket create_stream_socket_perms;
|
|
|
|
allow named_t self:udp_socket create_socket_perms;
|
|
|
|
|
2008-10-16 16:09:20 +00:00
|
|
|
allow named_t dnssec_t:file read_file_perms;
|
2005-08-23 17:26:19 +00:00
|
|
|
|
|
|
|
# read configuration
|
2006-12-12 20:08:08 +00:00
|
|
|
allow named_t named_conf_t:dir list_dir_perms;
|
2008-07-23 21:38:39 +00:00
|
|
|
read_files_pattern(named_t, named_conf_t, named_conf_t)
|
|
|
|
read_lnk_files_pattern(named_t, named_conf_t, named_conf_t)
|
2005-08-23 17:26:19 +00:00
|
|
|
|
|
|
|
# write cache for secondary zones
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_files_pattern(named_t, named_cache_t, named_cache_t)
|
|
|
|
manage_lnk_files_pattern(named_t, named_cache_t, named_cache_t)
|
2005-08-23 17:26:19 +00:00
|
|
|
|
|
|
|
can_exec(named_t, named_exec_t)
|
|
|
|
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_files_pattern(named_t, named_log_t, named_log_t)
|
|
|
|
logging_log_filetrans(named_t, named_log_t, { file dir })
|
2005-09-15 21:03:29 +00:00
|
|
|
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_dirs_pattern(named_t, named_tmp_t, named_tmp_t)
|
|
|
|
manage_files_pattern(named_t, named_tmp_t, named_tmp_t)
|
2006-02-21 18:40:44 +00:00
|
|
|
files_tmp_filetrans(named_t, named_tmp_t, { file dir })
|
2005-08-23 17:26:19 +00:00
|
|
|
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_files_pattern(named_t, named_var_run_t, named_var_run_t)
|
|
|
|
manage_sock_files_pattern(named_t, named_var_run_t, named_var_run_t)
|
|
|
|
files_pid_filetrans(named_t, named_var_run_t, { file sock_file })
|
2005-08-23 17:26:19 +00:00
|
|
|
|
|
|
|
# read zone files
|
2006-12-12 20:08:08 +00:00
|
|
|
allow named_t named_zone_t:dir list_dir_perms;
|
2008-07-23 21:38:39 +00:00
|
|
|
read_files_pattern(named_t, named_zone_t, named_zone_t)
|
|
|
|
read_lnk_files_pattern(named_t, named_zone_t, named_zone_t)
|
2005-08-23 17:26:19 +00:00
|
|
|
|
2006-01-31 16:49:43 +00:00
|
|
|
kernel_read_kernel_sysctls(named_t)
|
2005-08-23 17:26:19 +00:00
|
|
|
kernel_read_system_state(named_t)
|
|
|
|
kernel_read_network_state(named_t)
|
|
|
|
|
2007-10-12 17:50:11 +00:00
|
|
|
corecmd_search_bin(named_t)
|
|
|
|
|
2007-06-27 15:23:21 +00:00
|
|
|
corenet_all_recvfrom_unlabeled(named_t)
|
|
|
|
corenet_all_recvfrom_netlabel(named_t)
|
2005-08-23 17:26:19 +00:00
|
|
|
corenet_tcp_sendrecv_all_if(named_t)
|
|
|
|
corenet_udp_sendrecv_all_if(named_t)
|
|
|
|
corenet_tcp_sendrecv_all_nodes(named_t)
|
|
|
|
corenet_udp_sendrecv_all_nodes(named_t)
|
|
|
|
corenet_tcp_sendrecv_all_ports(named_t)
|
|
|
|
corenet_udp_sendrecv_all_ports(named_t)
|
|
|
|
corenet_tcp_bind_all_nodes(named_t)
|
|
|
|
corenet_udp_bind_all_nodes(named_t)
|
|
|
|
corenet_tcp_bind_dns_port(named_t)
|
|
|
|
corenet_udp_bind_dns_port(named_t)
|
2005-09-15 21:03:29 +00:00
|
|
|
corenet_tcp_bind_rndc_port(named_t)
|
|
|
|
corenet_tcp_connect_all_ports(named_t)
|
2006-05-26 18:04:46 +00:00
|
|
|
corenet_sendrecv_dns_server_packets(named_t)
|
|
|
|
corenet_sendrecv_dns_client_packets(named_t)
|
|
|
|
corenet_sendrecv_rndc_server_packets(named_t)
|
|
|
|
corenet_sendrecv_rndc_client_packets(named_t)
|
2007-10-12 17:35:56 +00:00
|
|
|
corenet_udp_bind_all_unreserved_ports(named_t)
|
2005-08-23 17:26:19 +00:00
|
|
|
|
|
|
|
dev_read_sysfs(named_t)
|
|
|
|
dev_read_rand(named_t)
|
2006-05-19 14:02:24 +00:00
|
|
|
dev_read_urand(named_t)
|
|
|
|
|
2006-02-20 21:33:25 +00:00
|
|
|
domain_use_interactive_fds(named_t)
|
2005-08-23 17:26:19 +00:00
|
|
|
|
|
|
|
files_read_etc_files(named_t)
|
|
|
|
files_read_etc_runtime_files(named_t)
|
|
|
|
|
2007-10-12 17:50:11 +00:00
|
|
|
fs_getattr_all_fs(named_t)
|
|
|
|
fs_search_auto_mountpoints(named_t)
|
|
|
|
|
2007-10-12 17:35:56 +00:00
|
|
|
auth_use_nsswitch(named_t)
|
|
|
|
|
2005-08-23 17:26:19 +00:00
|
|
|
logging_send_syslog_msg(named_t)
|
|
|
|
|
|
|
|
miscfiles_read_localization(named_t)
|
2006-05-19 14:02:24 +00:00
|
|
|
miscfiles_read_certs(named_t)
|
2005-08-23 17:26:19 +00:00
|
|
|
|
|
|
|
sysnet_read_config(named_t)
|
|
|
|
|
2006-02-20 21:33:25 +00:00
|
|
|
userdom_dontaudit_use_unpriv_user_fds(named_t)
|
2008-04-29 13:58:34 +00:00
|
|
|
|
|
|
|
sysadm_dontaudit_search_home_dirs(named_t)
|
2005-08-23 17:26:19 +00:00
|
|
|
|
2005-12-02 22:06:05 +00:00
|
|
|
tunable_policy(`named_write_master_zones',`
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_dirs_pattern(named_t, named_zone_t, named_zone_t)
|
|
|
|
manage_files_pattern(named_t, named_zone_t,named_zone_t)
|
|
|
|
manage_lnk_files_pattern(named_t, named_zone_t, named_zone_t)
|
2005-12-02 22:06:05 +00:00
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-12-02 22:06:05 +00:00
|
|
|
init_dbus_chat_script(named_t)
|
|
|
|
|
|
|
|
sysnet_dbus_chat_dhcpc(named_t)
|
2005-10-14 17:55:40 +00:00
|
|
|
|
2008-07-23 21:38:39 +00:00
|
|
|
dbus_system_bus_client_template(named, named_t)
|
2005-10-14 17:55:40 +00:00
|
|
|
dbus_connect_system_bus(named_t)
|
2005-12-02 22:06:05 +00:00
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-12-02 22:06:05 +00:00
|
|
|
networkmanager_dbus_chat(named_t)
|
|
|
|
')
|
|
|
|
')
|
|
|
|
|
2007-10-12 17:35:56 +00:00
|
|
|
optional_policy(`
|
|
|
|
kerberos_use(named_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-12-02 22:06:05 +00:00
|
|
|
# this seems like fds that arent being
|
|
|
|
# closed. these should probably be
|
|
|
|
# dontaudits instead.
|
2006-02-02 21:08:12 +00:00
|
|
|
networkmanager_rw_udp_sockets(named_t)
|
|
|
|
networkmanager_rw_packet_sockets(named_t)
|
|
|
|
networkmanager_rw_routing_sockets(named_t)
|
2005-10-14 17:55:40 +00:00
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-08-23 17:26:19 +00:00
|
|
|
seutil_sigchld_newrole(named_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-08-23 17:26:19 +00:00
|
|
|
udev_read_db(named_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# NDC local policy
|
|
|
|
#
|
|
|
|
|
|
|
|
# cjp: why net_admin?!
|
|
|
|
allow ndc_t self:capability { dac_override net_admin };
|
|
|
|
allow ndc_t self:process { fork signal_perms };
|
2008-10-16 16:09:20 +00:00
|
|
|
allow ndc_t self:fifo_file rw_fifo_file_perms;
|
2005-08-23 17:26:19 +00:00
|
|
|
allow ndc_t self:unix_stream_socket { connect create_stream_socket_perms };
|
|
|
|
allow ndc_t self:tcp_socket create_socket_perms;
|
|
|
|
allow ndc_t self:netlink_route_socket r_netlink_socket_perms;
|
|
|
|
|
2008-10-16 16:09:20 +00:00
|
|
|
allow ndc_t dnssec_t:file read_file_perms;
|
2006-08-29 02:41:00 +00:00
|
|
|
allow ndc_t dnssec_t:lnk_file { getattr read };
|
2005-08-23 17:26:19 +00:00
|
|
|
|
2008-10-16 16:09:20 +00:00
|
|
|
stream_connect_pattern(ndc_t, named_var_run_t, named_var_run_t, named_t)
|
2005-08-23 17:26:19 +00:00
|
|
|
|
2008-10-16 16:09:20 +00:00
|
|
|
allow ndc_t named_conf_t:file read_file_perms;
|
2006-09-25 18:53:06 +00:00
|
|
|
allow ndc_t named_conf_t:lnk_file { getattr read };
|
2005-08-23 17:26:19 +00:00
|
|
|
|
2008-10-16 16:09:20 +00:00
|
|
|
allow ndc_t named_zone_t:dir search_dir_perms;
|
2005-08-23 17:26:19 +00:00
|
|
|
|
2006-01-31 16:49:43 +00:00
|
|
|
kernel_read_kernel_sysctls(ndc_t)
|
2005-08-23 17:26:19 +00:00
|
|
|
|
2007-06-27 15:23:21 +00:00
|
|
|
corenet_all_recvfrom_unlabeled(ndc_t)
|
|
|
|
corenet_all_recvfrom_netlabel(ndc_t)
|
2005-08-23 17:26:19 +00:00
|
|
|
corenet_tcp_sendrecv_all_if(ndc_t)
|
|
|
|
corenet_tcp_sendrecv_all_nodes(ndc_t)
|
|
|
|
corenet_tcp_sendrecv_all_ports(ndc_t)
|
2008-09-15 17:02:57 +00:00
|
|
|
corenet_tcp_bind_all_nodes(ndc_t)
|
2005-09-15 21:03:29 +00:00
|
|
|
corenet_tcp_connect_rndc_port(ndc_t)
|
2006-05-26 18:04:46 +00:00
|
|
|
corenet_sendrecv_rndc_client_packets(ndc_t)
|
2005-08-23 17:26:19 +00:00
|
|
|
|
2006-02-20 21:33:25 +00:00
|
|
|
domain_use_interactive_fds(ndc_t)
|
2005-08-23 17:26:19 +00:00
|
|
|
|
|
|
|
files_read_etc_files(ndc_t)
|
|
|
|
files_search_pids(ndc_t)
|
|
|
|
|
2007-10-12 17:50:11 +00:00
|
|
|
fs_getattr_xattr_fs(ndc_t)
|
|
|
|
|
2006-03-02 23:41:11 +00:00
|
|
|
init_use_fds(ndc_t)
|
2006-02-02 21:08:12 +00:00
|
|
|
init_use_script_ptys(ndc_t)
|
2005-08-23 17:26:19 +00:00
|
|
|
|
|
|
|
logging_send_syslog_msg(ndc_t)
|
|
|
|
|
|
|
|
miscfiles_read_localization(ndc_t)
|
|
|
|
|
|
|
|
sysnet_read_config(ndc_t)
|
2005-09-15 21:03:29 +00:00
|
|
|
sysnet_dns_name_resolve(ndc_t)
|
2005-08-23 17:26:19 +00:00
|
|
|
|
|
|
|
# for /etc/rndc.key
|
|
|
|
ifdef(`distro_redhat',`
|
|
|
|
allow ndc_t named_conf_t:dir search;
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-08-23 17:26:19 +00:00
|
|
|
nis_use_ypbind(ndc_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-02-02 21:08:12 +00:00
|
|
|
nscd_socket_use(ndc_t)
|
2005-08-23 17:26:19 +00:00
|
|
|
')
|
2005-10-22 17:44:04 +00:00
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-03-02 23:41:11 +00:00
|
|
|
ppp_dontaudit_use_fds(ndc_t)
|
2005-11-08 22:00:30 +00:00
|
|
|
')
|