Chris PeBenito 29af4c
policy_module(bind, 1.11.0)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 56e1b3
## <desc>
Dominick Grift 9a0f79
##	

Dominick Grift 9a0f79
##	Allow BIND to write the master zone files.
Dominick Grift 9a0f79
##	Generally this is used for dynamic DNS or zone transfers.
Dominick Grift 9a0f79
##	

Chris PeBenito 56e1b3
## </desc>
Chris PeBenito 0bfccd
gen_tunable(named_write_master_zones, false)
Chris PeBenito 56e1b3
Chris PeBenito 17de1b
# for DNSSEC key files
Chris PeBenito 17de1b
type dnssec_t;
Chris PeBenito 17de1b
files_security_file(dnssec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type named_t;
Chris PeBenito 17de1b
type named_exec_t;
Chris PeBenito 0bfccd
init_daemon_domain(named_t, named_exec_t)
Chris PeBenito 17de1b
role system_r types named_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type named_checkconf_exec_t;
Chris PeBenito 0bfccd
init_system_domain(named_t, named_checkconf_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# A type for configuration files of named.
Chris PeBenito 17de1b
type named_conf_t;
Chris PeBenito 17de1b
files_type(named_conf_t)
Chris PeBenito 17de1b
files_mountpoint(named_conf_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# for secondary zone files
Chris PeBenito 17de1b
type named_cache_t;
Chris PeBenito 17de1b
files_type(named_cache_t)
Chris PeBenito 17de1b
Chris PeBenito f5394c
type named_initrc_exec_t;
Chris PeBenito f5394c
init_script_file(named_initrc_exec_t)
Chris PeBenito f5394c
Chris PeBenito 17de1b
type named_log_t;
Chris PeBenito 17de1b
logging_log_file(named_log_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type named_tmp_t;
Chris PeBenito 17de1b
files_tmp_file(named_tmp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type named_var_run_t;
Chris PeBenito 17de1b
files_pid_file(named_var_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# for primary zone files
Chris PeBenito 17de1b
type named_zone_t;
Chris PeBenito 17de1b
files_type(named_zone_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type ndc_t;
Chris PeBenito 17de1b
type ndc_exec_t;
Chris PeBenito 0bfccd
init_system_domain(ndc_t, ndc_exec_t)
Chris PeBenito 17de1b
role system_r types ndc_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Named local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow named_t self:capability { chown dac_override fowner setgid setuid sys_chroot sys_nice sys_resource };
Chris PeBenito 17de1b
dontaudit named_t self:capability sys_tty_config;
Chris PeBenito f5394c
allow named_t self:process { setsched getcap setcap setrlimit signal_perms };
Chris PeBenito c0868a
allow named_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 17de1b
allow named_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow named_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 17de1b
allow named_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow named_t self:udp_socket create_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito 0b36a2
allow named_t dnssec_t:file read_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# read configuration
Chris PeBenito c0868a
allow named_t named_conf_t:dir list_dir_perms;
Chris PeBenito 0bfccd
read_files_pattern(named_t, named_conf_t, named_conf_t)
Chris PeBenito 0bfccd
read_lnk_files_pattern(named_t, named_conf_t, named_conf_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# write cache for secondary zones
Chris PeBenito 0bfccd
manage_files_pattern(named_t, named_cache_t, named_cache_t)
Chris PeBenito 0bfccd
manage_lnk_files_pattern(named_t, named_cache_t, named_cache_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
can_exec(named_t, named_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 0bfccd
manage_files_pattern(named_t, named_log_t, named_log_t)
Chris PeBenito 0bfccd
logging_log_filetrans(named_t, named_log_t, { file dir })
Chris PeBenito 17de1b
Chris PeBenito 0bfccd
manage_dirs_pattern(named_t, named_tmp_t, named_tmp_t)
Chris PeBenito 0bfccd
manage_files_pattern(named_t, named_tmp_t, named_tmp_t)
Chris PeBenito 17de1b
files_tmp_filetrans(named_t, named_tmp_t, { file dir })
Chris PeBenito 17de1b
Dan Walsh 3eaa99
manage_dirs_pattern(named_t, named_var_run_t, named_var_run_t)
Chris PeBenito 0bfccd
manage_files_pattern(named_t, named_var_run_t, named_var_run_t)
Chris PeBenito 0bfccd
manage_sock_files_pattern(named_t, named_var_run_t, named_var_run_t)
Dan Walsh 3eaa99
files_pid_filetrans(named_t, named_var_run_t, { file sock_file dir })
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# read zone files
Chris PeBenito c0868a
allow named_t named_zone_t:dir list_dir_perms;
Chris PeBenito 0bfccd
read_files_pattern(named_t, named_zone_t, named_zone_t)
Chris PeBenito 0bfccd
read_lnk_files_pattern(named_t, named_zone_t, named_zone_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_kernel_sysctls(named_t)
Chris PeBenito 17de1b
kernel_read_system_state(named_t)
Chris PeBenito 17de1b
kernel_read_network_state(named_t)
Chris PeBenito 17de1b
Chris PeBenito f48782
corecmd_search_bin(named_t)
Chris PeBenito f48782
Chris PeBenito 190066
corenet_all_recvfrom_unlabeled(named_t)
Chris PeBenito 190066
corenet_all_recvfrom_netlabel(named_t)
Chris PeBenito 668b30
corenet_tcp_sendrecv_generic_if(named_t)
Chris PeBenito 668b30
corenet_udp_sendrecv_generic_if(named_t)
Chris PeBenito c12621
corenet_tcp_sendrecv_generic_node(named_t)
Chris PeBenito c12621
corenet_udp_sendrecv_generic_node(named_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_ports(named_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_ports(named_t)
Chris PeBenito c12621
corenet_tcp_bind_generic_node(named_t)
Chris PeBenito c12621
corenet_udp_bind_generic_node(named_t)
Chris PeBenito 17de1b
corenet_tcp_bind_dns_port(named_t)
Chris PeBenito 17de1b
corenet_udp_bind_dns_port(named_t)
Chris PeBenito 17de1b
corenet_tcp_bind_rndc_port(named_t)
Chris PeBenito 17de1b
corenet_tcp_connect_all_ports(named_t)
Chris PeBenito 17de1b
corenet_sendrecv_dns_server_packets(named_t)
Chris PeBenito 17de1b
corenet_sendrecv_dns_client_packets(named_t)
Chris PeBenito 17de1b
corenet_sendrecv_rndc_server_packets(named_t)
Chris PeBenito 17de1b
corenet_sendrecv_rndc_client_packets(named_t)
Chris PeBenito ce6fee
corenet_dontaudit_udp_bind_all_reserved_ports(named_t)
Chris PeBenito bc01b3
corenet_udp_bind_all_unreserved_ports(named_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
dev_read_sysfs(named_t)
Chris PeBenito 17de1b
dev_read_rand(named_t)
Chris PeBenito 17de1b
dev_read_urand(named_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
domain_use_interactive_fds(named_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_read_etc_files(named_t)
Chris PeBenito 17de1b
files_read_etc_runtime_files(named_t)
Chris PeBenito 17de1b
Chris PeBenito f48782
fs_getattr_all_fs(named_t)
Chris PeBenito f48782
fs_search_auto_mountpoints(named_t)
Chris PeBenito f48782
Chris PeBenito bc01b3
auth_use_nsswitch(named_t)
Chris PeBenito bc01b3
Chris PeBenito 17de1b
logging_send_syslog_msg(named_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(named_t)
Dominick Grift 834062
miscfiles_read_generic_certs(named_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
userdom_dontaudit_use_unpriv_user_fds(named_t)
Chris PeBenito 296273
userdom_dontaudit_search_user_home_dirs(named_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
tunable_policy(`named_write_master_zones',`
Chris PeBenito 0bfccd
	manage_dirs_pattern(named_t, named_zone_t, named_zone_t)
Chris PeBenito 3f67f7
	manage_files_pattern(named_t, named_zone_t, named_zone_t)
Chris PeBenito 0bfccd
	manage_lnk_files_pattern(named_t, named_zone_t, named_zone_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	init_dbus_chat_script(named_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	sysnet_dbus_chat_dhcpc(named_t)
Chris PeBenito 17de1b
Chris PeBenito 296273
	dbus_system_bus_client(named_t)
Chris PeBenito 17de1b
	dbus_connect_system_bus(named_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
		networkmanager_dbus_chat(named_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito ce6fee
	kerberos_keytab_template(named, named_t)
Chris PeBenito bc01b3
')
Chris PeBenito bc01b3
Chris PeBenito bc01b3
optional_policy(`
Chris PeBenito 17de1b
	# this seems like fds that arent being
Chris PeBenito ff8f0a
	# closed. these should probably be
Chris PeBenito 17de1b
	# dontaudits instead.
Chris PeBenito 17de1b
	networkmanager_rw_udp_sockets(named_t)
Chris PeBenito 17de1b
	networkmanager_rw_packet_sockets(named_t)
Chris PeBenito 17de1b
	networkmanager_rw_routing_sockets(named_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	seutil_sigchld_newrole(named_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	udev_read_db(named_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# NDC local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# cjp: why net_admin?!
Chris PeBenito 17de1b
allow ndc_t self:capability { dac_override net_admin };
Chris PeBenito 17de1b
allow ndc_t self:process { fork signal_perms };
Chris PeBenito 0b36a2
allow ndc_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 17de1b
allow ndc_t self:unix_stream_socket { connect create_stream_socket_perms };
Chris PeBenito 17de1b
allow ndc_t self:tcp_socket create_socket_perms;
Chris PeBenito 17de1b
allow ndc_t self:netlink_route_socket r_netlink_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito 0b36a2
allow ndc_t dnssec_t:file read_file_perms;
Dominick Grift 72ba80
allow ndc_t dnssec_t:lnk_file read_lnk_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 0b36a2
stream_connect_pattern(ndc_t, named_var_run_t, named_var_run_t, named_t)
Chris PeBenito 17de1b
Chris PeBenito 0b36a2
allow ndc_t named_conf_t:file read_file_perms;
Dominick Grift 72ba80
allow ndc_t named_conf_t:lnk_file read_lnk_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 0b36a2
allow ndc_t named_zone_t:dir search_dir_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_kernel_sysctls(ndc_t)
Chris PeBenito 17de1b
Chris PeBenito 190066
corenet_all_recvfrom_unlabeled(ndc_t)
Chris PeBenito 190066
corenet_all_recvfrom_netlabel(ndc_t)
Chris PeBenito 668b30
corenet_tcp_sendrecv_generic_if(ndc_t)
Chris PeBenito c12621
corenet_tcp_sendrecv_generic_node(ndc_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_ports(ndc_t)
Chris PeBenito c12621
corenet_tcp_bind_generic_node(ndc_t)
Chris PeBenito 17de1b
corenet_tcp_connect_rndc_port(ndc_t)
Chris PeBenito 17de1b
corenet_sendrecv_rndc_client_packets(ndc_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
domain_use_interactive_fds(ndc_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_read_etc_files(ndc_t)
Chris PeBenito 17de1b
files_search_pids(ndc_t)
Chris PeBenito 17de1b
Chris PeBenito f48782
fs_getattr_xattr_fs(ndc_t)
Chris PeBenito f48782
Chris PeBenito 17de1b
init_use_fds(ndc_t)
Chris PeBenito 17de1b
init_use_script_ptys(ndc_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
logging_send_syslog_msg(ndc_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(ndc_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
sysnet_read_config(ndc_t)
Chris PeBenito 17de1b
sysnet_dns_name_resolve(ndc_t)
Chris PeBenito 17de1b
Chris PeBenito 296273
userdom_use_user_terminals(ndc_t)
Chris PeBenito 296273
Chris PeBenito 5843d0
term_dontaudit_use_console(ndc_t)
Chris PeBenito 5843d0
Chris PeBenito 17de1b
# for /etc/rndc.key
Chris PeBenito 17de1b
ifdef(`distro_redhat',`
Dominick Grift 72ba80
	allow ndc_t named_conf_t:dir search_dir_perms;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	nis_use_ypbind(ndc_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	nscd_socket_use(ndc_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	ppp_dontaudit_use_fds(ndc_t)
Chris PeBenito 17de1b
')