Chris PeBenito 29af4c
policy_module(cobbler, 1.1.0)
Dominick Grift 1031ee
Dominick Grift 1031ee
########################################
Dominick Grift 1031ee
#
Dominick Grift 1031ee
# Cobbler personal declarations.
Dominick Grift 1031ee
#
Dominick Grift 1031ee
Dominick Grift 1031ee
## <desc>
Dominick Grift 68ac47
##	

Dominick Grift 68ac47
##	Allow Cobbler to modify public files
Dominick Grift 68ac47
##	used for public file transfer services.
Dominick Grift 68ac47
##	

Dominick Grift 1031ee
## </desc>
Dominick Grift 1031ee
gen_tunable(cobbler_anon_write, false)
Dominick Grift 68ac47
Dan Walsh 3eaa99
## <desc>
Dominick Grift 68ac47
##	

Dominick Grift 68ac47
##	Allow Cobbler to connect to the
Dominick Grift 68ac47
##	network using TCP.
Dominick Grift 68ac47
##	

Dan Walsh 3eaa99
## </desc>
Dan Walsh 3eaa99
gen_tunable(cobbler_can_network_connect, false)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
## <desc>
Dominick Grift 68ac47
##	

Dominick Grift 68ac47
##	Allow Cobbler to access cifs file systems.
Dominick Grift 68ac47
##	

Dan Walsh 3eaa99
## </desc>
Dan Walsh 3eaa99
gen_tunable(cobbler_use_cifs, false)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
## <desc>
Dominick Grift 68ac47
##	

Dominick Grift 68ac47
##	Allow Cobbler to access nfs file systems.
Dominick Grift 68ac47
##	

Dan Walsh 3eaa99
## </desc>
Dan Walsh 3eaa99
gen_tunable(cobbler_use_nfs, false)
Dominick Grift 1031ee
Dominick Grift 1031ee
type cobblerd_t;
Dominick Grift 1031ee
type cobblerd_exec_t;
Dominick Grift 1031ee
init_daemon_domain(cobblerd_t, cobblerd_exec_t)
Dominick Grift 1031ee
Dominick Grift 1031ee
type cobblerd_initrc_exec_t;
Dominick Grift 1031ee
init_script_file(cobblerd_initrc_exec_t)
Dominick Grift 1031ee
Dominick Grift 1031ee
type cobbler_etc_t;
Dominick Grift 1031ee
files_config_file(cobbler_etc_t)
Dominick Grift 1031ee
Dominick Grift 1031ee
type cobbler_var_log_t;
Dominick Grift 1031ee
logging_log_file(cobbler_var_log_t)
Dominick Grift 1031ee
Dan Walsh 2968e0
type cobbler_var_lib_t alias cobbler_content_t;
Dan Walsh 2968e0
files_type(cobbler_var_lib_t)
Dan Walsh 2968e0
Dan Walsh 3eaa99
type cobbler_tmp_t;
Dan Walsh 3eaa99
files_tmp_file(cobbler_tmp_t)
Dan Walsh 3eaa99
Dominick Grift 1031ee
########################################
Dominick Grift 1031ee
#
Dan Walsh 2968e0
# Cobbler personal policy.
Dominick Grift 1031ee
#
Dominick Grift 1031ee
Dan Walsh 3eaa99
allow cobblerd_t self:capability { chown dac_override fowner fsetid sys_nice };
Dan Walsh 3eaa99
dontaudit cobblerd_t self:capability { sys_ptrace sys_tty_config };
Dan Walsh 3eaa99
Dominick Grift 1031ee
allow cobblerd_t self:process { getsched setsched signal };
Dominick Grift 1031ee
allow cobblerd_t self:fifo_file rw_fifo_file_perms;
Dan Walsh 3eaa99
allow cobblerd_t self:netlink_route_socket create_netlink_socket_perms;
Dominick Grift 1031ee
allow cobblerd_t self:tcp_socket create_stream_socket_perms;
Dan Walsh 3eaa99
allow cobblerd_t self:udp_socket create_socket_perms;
Dan Walsh 3eaa99
allow cobblerd_t self:unix_dgram_socket create_socket_perms;
Dominick Grift 1031ee
Jeremy Solt a2524c
list_dirs_pattern(cobblerd_t, cobbler_etc_t, cobbler_etc_t)
Dominick Grift 1031ee
read_files_pattern(cobblerd_t, cobbler_etc_t, cobbler_etc_t)
Dominick Grift 1031ee
Dan Walsh 2968e0
# Something that runs in the cobberd_t domain tries to relabelfrom cobbler_var_lib_t dir to httpd_sys_content_t.
Dan Walsh 2968e0
dontaudit cobblerd_t cobbler_var_lib_t:dir relabel_dir_perms;
Dan Walsh 3eaa99
Dan Walsh 2968e0
manage_dirs_pattern(cobblerd_t, cobbler_var_lib_t, cobbler_var_lib_t)
Dan Walsh 2968e0
manage_files_pattern(cobblerd_t, cobbler_var_lib_t, cobbler_var_lib_t)
Dan Walsh 2968e0
manage_lnk_files_pattern(cobblerd_t, cobbler_var_lib_t, cobbler_var_lib_t)
Dan Walsh 2968e0
files_var_lib_filetrans(cobblerd_t, cobbler_var_lib_t, { dir file lnk_file })
Dan Walsh 3eaa99
Dan Walsh 3eaa99
# Something really needs to write to cobbler.log. Ideally this should not be happening.
Dan Walsh 3eaa99
allow cobblerd_t cobbler_var_log_t:file write;
Dominick Grift 1031ee
Dominick Grift 1031ee
append_files_pattern(cobblerd_t, cobbler_var_log_t, cobbler_var_log_t)
Dominick Grift 1031ee
create_files_pattern(cobblerd_t, cobbler_var_log_t, cobbler_var_log_t)
Dominick Grift 1031ee
read_files_pattern(cobblerd_t, cobbler_var_log_t, cobbler_var_log_t)
Dominick Grift 1031ee
setattr_files_pattern(cobblerd_t, cobbler_var_log_t, cobbler_var_log_t)
Dominick Grift 1031ee
logging_log_filetrans(cobblerd_t, cobbler_var_log_t, file)
Dominick Grift 1031ee
Dan Walsh 3eaa99
manage_dirs_pattern(cobblerd_t, cobbler_tmp_t, cobbler_tmp_t)
Dan Walsh 3eaa99
manage_files_pattern(cobblerd_t, cobbler_tmp_t, cobbler_tmp_t)
Dan Walsh 3eaa99
files_tmp_filetrans(cobblerd_t, cobbler_tmp_t, { dir file })
Dan Walsh 3eaa99
Chris PeBenito 27eab8
kernel_read_system_state(cobblerd_t)
Dan Walsh 3eaa99
kernel_dontaudit_search_network_state(cobblerd_t)
Chris PeBenito 27eab8
Dominick Grift 1031ee
corecmd_exec_bin(cobblerd_t)
Dominick Grift 1031ee
corecmd_exec_shell(cobblerd_t)
Dominick Grift 1031ee
Dominick Grift 1031ee
corenet_all_recvfrom_netlabel(cobblerd_t)
Dominick Grift 1031ee
corenet_all_recvfrom_unlabeled(cobblerd_t)
Dan Walsh 2968e0
corenet_sendrecv_cobbler_server_packets(cobblerd_t)
Dan Walsh 2968e0
corenet_tcp_bind_cobbler_port(cobblerd_t)
Dominick Grift 1031ee
corenet_tcp_bind_generic_node(cobblerd_t)
Dominick Grift 1031ee
corenet_tcp_sendrecv_generic_if(cobblerd_t)
Dominick Grift 1031ee
corenet_tcp_sendrecv_generic_node(cobblerd_t)
Dominick Grift 1031ee
corenet_tcp_sendrecv_generic_port(cobblerd_t)
Dan Walsh 3eaa99
corenet_tcp_sendrecv_cobbler_port(cobblerd_t)
Dan Walsh 3eaa99
# sync and rsync to ftp and http are permitted by default, for any other media use cobbler_can_network_connect.
Dan Walsh 3eaa99
corenet_tcp_connect_ftp_port(cobblerd_t)
Dan Walsh 3eaa99
corenet_tcp_sendrecv_ftp_port(cobblerd_t)
Dan Walsh 3eaa99
corenet_sendrecv_ftp_client_packets(cobblerd_t)
Dan Walsh 3eaa99
corenet_tcp_connect_http_port(cobblerd_t)
Dan Walsh 3eaa99
corenet_tcp_sendrecv_http_port(cobblerd_t)
Dan Walsh 3eaa99
corenet_sendrecv_http_client_packets(cobblerd_t)
Dominick Grift 1031ee
Dominick Grift 1031ee
dev_read_urand(cobblerd_t)
Dominick Grift 1031ee
Dan Walsh 3eaa99
domain_dontaudit_exec_all_entry_files(cobblerd_t)
Dan Walsh 3eaa99
domain_dontaudit_read_all_domains_state(cobblerd_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
files_read_etc_files(cobblerd_t)
Dan Walsh 3eaa99
# mtab
Dan Walsh 3eaa99
files_read_etc_runtime_files(cobblerd_t)
Dominick Grift 1031ee
files_read_usr_files(cobblerd_t)
Dominick Grift 1031ee
files_list_boot(cobblerd_t)
Dan Walsh 3eaa99
files_read_boot_files(cobblerd_t)
Dominick Grift 1031ee
files_list_tmp(cobblerd_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
# read from mounted images (install media)
Dan Walsh 3eaa99
fs_read_iso9660_files(cobblerd_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
init_dontaudit_read_all_script_files(cobblerd_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
term_use_console(cobblerd_t)
Dominick Grift 1031ee
Dominick Grift 1031ee
miscfiles_read_localization(cobblerd_t)
Dominick Grift 1031ee
miscfiles_read_public_files(cobblerd_t)
Dominick Grift 1031ee
Dan Walsh 3eaa99
selinux_dontaudit_read_fs(cobblerd_t)
Dan Walsh 3eaa99
Dominick Grift 1031ee
sysnet_read_config(cobblerd_t)
Dominick Grift 1031ee
sysnet_rw_dhcp_config(cobblerd_t)
Dominick Grift 1031ee
sysnet_write_config(cobblerd_t)
Dominick Grift 1031ee
Dan Walsh 3eaa99
userdom_dontaudit_use_user_terminals(cobblerd_t)
Dan Walsh 3eaa99
userdom_dontaudit_search_user_home_dirs(cobblerd_t)
Dan Walsh 3eaa99
userdom_dontaudit_search_admin_dir(cobblerd_t)
Dan Walsh 3eaa99
Dominick Grift 1031ee
tunable_policy(`cobbler_anon_write',`
Dominick Grift 1031ee
	miscfiles_manage_public_files(cobblerd_t)
Dominick Grift 1031ee
')
Dominick Grift 1031ee
Dan Walsh 3eaa99
tunable_policy(`cobbler_can_network_connect',`
Dan Walsh 3eaa99
	corenet_tcp_connect_all_ports(cobblerd_t)
Dan Walsh 3eaa99
	corenet_tcp_sendrecv_all_ports(cobblerd_t)
Dan Walsh 3eaa99
	corenet_sendrecv_all_client_packets(cobblerd_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
tunable_policy(`cobbler_use_cifs',`
Dan Walsh 3eaa99
	fs_manage_cifs_dirs(cobblerd_t)
Dan Walsh 3eaa99
	fs_manage_cifs_files(cobblerd_t)
Dan Walsh 3eaa99
	fs_manage_cifs_symlinks(cobblerd_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
tunable_policy(`cobbler_use_nfs',`
Dan Walsh 3eaa99
	fs_manage_nfs_dirs(cobblerd_t)
Dan Walsh 3eaa99
	fs_manage_nfs_files(cobblerd_t)
Dan Walsh 3eaa99
	fs_manage_nfs_symlinks(cobblerd_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Dan Walsh 3eaa99
	# Cobbler traverses /var/www to get to /var/www/cobbler/*
Dan Walsh 3eaa99
	apache_search_sys_content(cobblerd_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dominick Grift 1031ee
optional_policy(`
Dominick Grift 1031ee
	bind_read_config(cobblerd_t)
Dominick Grift 1031ee
	bind_write_config(cobblerd_t)
Dominick Grift 1031ee
	bind_domtrans_ndc(cobblerd_t)
Dominick Grift 1031ee
	bind_domtrans(cobblerd_t)
Dominick Grift 1031ee
	bind_initrc_domtrans(cobblerd_t)
Dominick Grift 1031ee
	bind_manage_zone(cobblerd_t)
Dominick Grift 1031ee
')
Dominick Grift 1031ee
Dominick Grift 1031ee
optional_policy(`
Dan Walsh 3eaa99
	certmaster_exec(cobblerd_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Dominick Grift 1031ee
	dhcpd_domtrans(cobblerd_t)
Dominick Grift 1031ee
	dhcpd_initrc_domtrans(cobblerd_t)
Dominick Grift 1031ee
')
Dominick Grift 1031ee
Dominick Grift 1031ee
optional_policy(`
Dominick Grift 1031ee
	dnsmasq_domtrans(cobblerd_t)
Dominick Grift 1031ee
	dnsmasq_initrc_domtrans(cobblerd_t)
Dominick Grift 1031ee
	dnsmasq_write_config(cobblerd_t)
Dominick Grift 1031ee
')
Dominick Grift 1031ee
Dominick Grift 1031ee
optional_policy(`
Dan Walsh 3eaa99
	gnome_dontaudit_search_config(cobblerd_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Dominick Grift 1031ee
	rpm_exec(cobblerd_t)
Dominick Grift 1031ee
')
Dominick Grift 1031ee
Dominick Grift 1031ee
optional_policy(`
Dan Walsh 3eaa99
	rsync_exec(cobblerd_t)
Dan Walsh 3eaa99
	rsync_manage_config(cobblerd_t)
Dan Walsh 3eaa99
	# cobbler creates /etc/rsync.conf if its not there.
Dan Walsh 3eaa99
	rsync_filetrans_config(cobblerd_t, file)
Dominick Grift 1031ee
')
Dominick Grift 1031ee
Dominick Grift 1031ee
optional_policy(`
Dan Walsh 3eaa99
	# Cobbler puts objects in both /var/lib/tftpdir as well as /var/lib/tftpdir/images.
Dan Walsh 3eaa99
	# tftp_manage_rw_content(cobblerd_t) can be used instead if:
Dan Walsh 3eaa99
	# 1. cobbler package installs /var/lib/tftpdir/images.
Dan Walsh 3eaa99
	# 2. no FILES in /var/lib/TFTPDIR are hard linked.
Dan Walsh 3eaa99
	# Cobbler also creates other directories in /var/lib/tftpdir (etc, s390x, ppc, pxelinux.cfg)
Dan Walsh 3eaa99
	# are any of those hard linked?
Dan Walsh 2968e0
	tftp_filetrans_tftpdir(cobblerd_t, cobbler_var_lib_t, { dir file })
Dominick Grift 1031ee
')
Jeremy Solt a2524c
Jeremy Solt a2524c
########################################
Jeremy Solt a2524c
#
Jeremy Solt a2524c
# Cobbler web local policy.
Jeremy Solt a2524c
#
Jeremy Solt a2524c
Dan Walsh 2968e0
apache_content_template(cobbler)
Dan Walsh 2968e0
manage_dirs_pattern(cobblerd_t, httpd_cobbler_content_rw_t, httpd_cobbler_content_rw_t)
Dan Walsh 2968e0
manage_files_pattern(cobblerd_t, httpd_cobbler_content_rw_t, httpd_cobbler_content_rw_t)