policy_module(cups, 1.16.2)

########################################
#
# Declarations
#

## <desc>
## <p>
## Allow cups execmem/execstack
## </p>
## </desc>
gen_tunable(cups_execmem, false)

attribute cups_domain;

type cupsd_config_t, cups_domain;
type cupsd_config_exec_t;
init_daemon_domain(cupsd_config_t, cupsd_config_exec_t)

type cupsd_config_var_run_t;
files_pid_file(cupsd_config_var_run_t)

type cupsd_t, cups_domain;
type cupsd_exec_t;
typealias cupsd_t alias hplip_t;
typealias cupsd_exec_t alias hplip_exec_t;
init_daemon_domain(cupsd_t, cupsd_exec_t)
mls_trusted_object(cupsd_t)

type cupsd_etc_t;
typealias cupsd_etc_t alias hplip_etc_t;
files_config_file(cupsd_etc_t)

type cupsd_initrc_exec_t;
init_script_file(cupsd_initrc_exec_t)

type cupsd_interface_t;
files_type(cupsd_interface_t)

type cupsd_rw_etc_t;
files_config_file(cupsd_rw_etc_t)

type cupsd_lock_t;
files_lock_file(cupsd_lock_t)

type cupsd_log_t;
typealias cupsd_log_t alias hplip_var_log_t;
logging_log_file(cupsd_log_t)

type cupsd_var_lib_t alias hplip_var_lib_t;
files_type(cupsd_var_lib_t)

type cupsd_lpd_t, cups_domain;
type cupsd_lpd_exec_t;
init_daemon_domain(cupsd_lpd_t, cupsd_lpd_exec_t)

type cupsd_lpd_tmp_t;
files_tmp_file(cupsd_lpd_tmp_t)

type cupsd_lpd_var_run_t;
files_pid_file(cupsd_lpd_var_run_t)

type cups_pdf_t, cups_domain;
type cups_pdf_exec_t;
cups_backend(cups_pdf_t, cups_pdf_exec_t)

type cups_pdf_tmp_t;
files_tmp_file(cups_pdf_tmp_t)

type cupsd_tmp_t;
typealias cupsd_tmp_t alias hplip_tmp_t;
files_tmp_file(cupsd_tmp_t)

type cupsd_var_run_t;
typealias cupsd_var_run_t alias hplip_var_run_t;
files_pid_file(cupsd_var_run_t)
init_daemon_run_dir(cupsd_var_run_t, "cups")
mls_trusted_object(cupsd_var_run_t)

type cupsd_unit_file_t;
systemd_unit_file(cupsd_unit_file_t)

type ptal_t;
type ptal_exec_t;
init_daemon_domain(ptal_t, ptal_exec_t)

type ptal_etc_t;
files_config_file(ptal_etc_t)

type ptal_var_run_t;
files_pid_file(ptal_var_run_t)

ifdef(`enable_mcs',`
	init_ranged_daemon_domain(cupsd_t, cupsd_exec_t, s0 - mcs_systemhigh)
')

ifdef(`enable_mls',`
	init_ranged_daemon_domain(cupsd_t, cupsd_exec_t, mls_systemhigh)
')

#######################################
#
# Cups general local policy
#

allow cups_domain self:capability { setuid setgid sys_nice };
allow cups_domain self:process { getsched setsched signal_perms };
allow cups_domain self:fifo_file rw_fifo_file_perms;
allow cups_domain self:tcp_socket { accept listen };
allow cups_domain self:netlink_kobject_uevent_socket create_socket_perms;

kernel_read_kernel_sysctls(cups_domain)
kernel_read_network_state(cups_domain)

corecmd_exec_bin(cups_domain)
corecmd_exec_shell(cups_domain)

dev_read_urand(cups_domain)
dev_read_rand(cups_domain)
dev_read_sysfs(cups_domain)

fs_getattr_all_fs(cups_domain)

miscfiles_read_fonts(cups_domain)
miscfiles_setattr_fonts_cache_dirs(cups_domain)

optional_policy(`
    lpd_manage_spool(cups_domain)
')

########################################
#
# Cups local policy
#

allow cupsd_t self:capability { ipc_lock sys_admin dac_read_search dac_override kill fsetid fowner chown  sys_resource sys_tty_config };
dontaudit cupsd_t self:capability { sys_tty_config net_admin };
allow cupsd_t self:capability2 { block_suspend wake_alarm };
allow cupsd_t self:process { getpgid setpgid setsched };
allow cupsd_t self:unix_stream_socket { accept connectto listen };
allow cupsd_t self:netlink_selinux_socket create_socket_perms;
allow cupsd_t self:socket connect;
allow cupsd_t self:shm create_shm_perms;
allow cupsd_t self:sem create_sem_perms;
allow cupsd_t self:appletalk_socket create_socket_perms;

allow cupsd_t cupsd_etc_t:dir manage_dir_perms;
allow cupsd_t cupsd_etc_t:file { map rename setattr_file_perms };
read_files_pattern(cupsd_t, cupsd_etc_t, cupsd_etc_t)
read_lnk_files_pattern(cupsd_t, cupsd_etc_t, cupsd_etc_t)

manage_files_pattern(cupsd_t, cupsd_interface_t, cupsd_interface_t)
can_exec(cupsd_t, cupsd_interface_t)

manage_dirs_pattern(cupsd_t, cupsd_etc_t, cupsd_rw_etc_t)
manage_files_pattern(cupsd_t, cupsd_etc_t, cupsd_rw_etc_t)
filetrans_pattern(cupsd_t, cupsd_etc_t, cupsd_rw_etc_t, file)
files_var_filetrans(cupsd_t, cupsd_rw_etc_t, { dir file })
cups_filetrans_named_content(cupsd_t)
can_exec(cupsd_t, cupsd_rw_etc_t)

allow cupsd_t cupsd_exec_t:dir search_dir_perms;
allow cupsd_t cupsd_exec_t:lnk_file read_lnk_file_perms;

allow cupsd_t cupsd_lock_t:file manage_file_perms;
files_lock_filetrans(cupsd_t, cupsd_lock_t, file)

manage_dirs_pattern(cupsd_t, cupsd_log_t, cupsd_log_t)
manage_files_pattern(cupsd_t, cupsd_log_t, cupsd_log_t)
logging_log_filetrans(cupsd_t, cupsd_log_t, { file dir })

manage_files_pattern(cupsd_t, cupsd_var_lib_t, cupsd_var_lib_t)
manage_lnk_files_pattern(cupsd_t, cupsd_var_lib_t, cupsd_var_lib_t)

manage_dirs_pattern(cupsd_t, cupsd_tmp_t, cupsd_tmp_t)
manage_files_pattern(cupsd_t, cupsd_tmp_t, cupsd_tmp_t)
manage_lnk_files_pattern(cupsd_t, cupsd_tmp_t, cupsd_tmp_t)
manage_fifo_files_pattern(cupsd_t, cupsd_tmp_t, cupsd_tmp_t)
files_tmp_filetrans(cupsd_t, cupsd_tmp_t, { dir fifo_file file lnk_file })
allow cupsd_t cupsd_tmp_t:file execute;

allow cupsd_t cupsd_var_run_t:dir setattr_dir_perms;
manage_dirs_pattern(cupsd_t, cupsd_var_run_t, cupsd_var_run_t)
manage_files_pattern(cupsd_t, cupsd_var_run_t, cupsd_var_run_t)
manage_sock_files_pattern(cupsd_t, cupsd_var_run_t, cupsd_var_run_t)
manage_fifo_files_pattern(cupsd_t, cupsd_var_run_t, cupsd_var_run_t)
files_pid_filetrans(cupsd_t, cupsd_var_run_t, { dir fifo_file file })

allow cupsd_t cupsd_unit_file_t:file read_file_perms;


stream_connect_pattern(cupsd_t, ptal_var_run_t, ptal_var_run_t, ptal_t)
allow cupsd_t ptal_var_run_t:sock_file setattr_sock_file_perms;

can_exec(cupsd_t, { cupsd_exec_t cupsd_interface_t })

kernel_read_system_state(cupsd_t)
kernel_read_all_sysctls(cupsd_t)
kernel_request_load_module(cupsd_t)

corenet_all_recvfrom_netlabel(cupsd_t)
corenet_tcp_sendrecv_generic_if(cupsd_t)
corenet_udp_sendrecv_generic_if(cupsd_t)
corenet_raw_sendrecv_generic_if(cupsd_t)
corenet_tcp_sendrecv_generic_node(cupsd_t)
corenet_udp_sendrecv_generic_node(cupsd_t)
corenet_raw_sendrecv_generic_node(cupsd_t)
corenet_tcp_sendrecv_all_ports(cupsd_t)
corenet_udp_sendrecv_all_ports(cupsd_t)
corenet_tcp_bind_generic_node(cupsd_t)
corenet_udp_bind_generic_node(cupsd_t)

corenet_sendrecv_all_server_packets(cupsd_t)
corenet_sendrecv_all_client_packets(cupsd_t)
corenet_tcp_bind_ipp_port(cupsd_t)
corenet_udp_bind_ipp_port(cupsd_t)
corenet_udp_bind_howl_port(cupsd_t)
corenet_tcp_bind_reserved_port(cupsd_t)
corenet_dontaudit_tcp_bind_all_reserved_ports(cupsd_t)
corenet_tcp_bind_all_rpc_ports(cupsd_t)
corenet_tcp_connect_all_ports(cupsd_t)

corenet_sendrecv_hplip_client_packets(cupsd_t)
corenet_receive_hplip_server_packets(cupsd_t)
corenet_tcp_bind_hplip_port(cupsd_t)
corenet_tcp_connect_hplip_port(cupsd_t)
corenet_tcp_bind_glance_port(cupsd_t)
corenet_tcp_connect_glance_port(cupsd_t)

corenet_sendrecv_ipp_client_packets(cupsd_t)
corenet_tcp_connect_ipp_port(cupsd_t)

corenet_sendrecv_howl_server_packets(cupsd_t)
corenet_udp_bind_howl_port(cupsd_t)

dev_rw_printer(cupsd_t)
dev_rw_input_dev(cupsd_t)
dev_rw_generic_usb_dev(cupsd_t)
dev_rw_usbfs(cupsd_t)
dev_getattr_printer_dev(cupsd_t)

domain_read_all_domains_state(cupsd_t)
domain_use_interactive_fds(cupsd_t)

files_getattr_boot_dirs(cupsd_t)
files_list_spool(cupsd_t)
files_read_etc_runtime_files(cupsd_t)
files_exec_usr_files(cupsd_t)
# for /var/lib/defoma
files_read_var_lib_files(cupsd_t)
files_list_world_readable(cupsd_t)
files_read_world_readable_files(cupsd_t)
files_read_world_readable_symlinks(cupsd_t)
files_read_var_files(cupsd_t)
files_read_var_symlinks(cupsd_t)
files_dontaudit_getattr_all_tmp_files(cupsd_t)
files_dontaudit_list_home(cupsd_t)
# for /etc/printcap
files_dontaudit_write_etc_files(cupsd_t)
files_dontaudit_write_usr_dirs(cupsd_t)

fs_search_auto_mountpoints(cupsd_t)
fs_search_fusefs(cupsd_t)
fs_read_anon_inodefs_files(cupsd_t)
fs_rw_anon_inodefs_files(cupsd_t)
fs_rw_inherited_tmpfs_files(cupsd_t)

mls_dbus_send_all_levels(cupsd_t)
mls_fd_use_all_levels(cupsd_t)
mls_file_downgrade(cupsd_t)
mls_file_write_all_levels(cupsd_t)
mls_file_read_all_levels(cupsd_t)
mls_rangetrans_target(cupsd_t)
mls_socket_write_all_levels(cupsd_t)

term_search_ptys(cupsd_t)
term_use_unallocated_ttys(cupsd_t)
term_use_ptmx(cupsd_t)
term_use_usb_ttys(cupsd_t)

selinux_compute_access_vector(cupsd_t)
selinux_validate_context(cupsd_t)

init_exec_script_files(cupsd_t)
init_read_utmp(cupsd_t)

auth_domtrans_chk_passwd(cupsd_t)
auth_dontaudit_read_pam_pid(cupsd_t)
auth_rw_faillog(cupsd_t)
auth_use_nsswitch(cupsd_t)

libs_exec_lib_files(cupsd_t)
libs_exec_ldconfig(cupsd_t)
libs_exec_ld_so(cupsd_t)
libs_use_ld_so(cupsd_t)
libs_legacy_use_ld_so(cupsd_t)
libs_dontaudit_setattr_lib_dirs(cupsd_t)

logging_send_audit_msgs(cupsd_t)
logging_send_syslog_msg(cupsd_t)

miscfiles_legacy_read_localization(cupsd_t)

seutil_read_config(cupsd_t)

sysnet_exec_ifconfig(cupsd_t)
sysnet_dns_name_resolve(cupsd_t)

userdom_dontaudit_use_unpriv_user_fds(cupsd_t)
userdom_dontaudit_search_user_home_dirs(cupsd_t)
userdom_dontaudit_search_user_home_content(cupsd_t)
userdom_dontaudit_use_unpriv_user_fds(cupsd_t)
userdom_dontaudit_search_user_home_content(cupsd_t)

tunable_policy(`cups_execmem',`
	allow cupsd_t self:process { execmem execstack };
')


optional_policy(`
	apm_domtrans_client(cupsd_t)
')

optional_policy(`
	cron_system_entry(cupsd_t, cupsd_exec_t)
')

optional_policy(`
	dbus_system_bus_client(cupsd_t)

	init_dbus_chat(cupsd_t)

	userdom_dbus_send_all_users(cupsd_t)

	optional_policy(`
		avahi_dbus_chat(cupsd_t)
	')

	optional_policy(`
		colord_read_lib_files(cupsd_t)
	')

	optional_policy(`
		hal_dbus_chat(cupsd_t)
	')

	# talk to processes that do not have policy
	optional_policy(`
		unconfined_dbus_chat(cupsd_t)
		files_write_generic_pid_pipes(cupsd_t)
	')
')

optional_policy(`
	hostname_exec(cupsd_t)
')

optional_policy(`
	inetd_core_service_domain(cupsd_t, cupsd_exec_t)
')

optional_policy(`
	kerberos_tmp_filetrans_host_rcache(cupsd_t, "host_0")
	kerberos_manage_host_rcache(cupsd_t)
')

optional_policy(`
	logrotate_domtrans(cupsd_t)
')

optional_policy(`
	lpd_exec_lpr(cupsd_t)
	lpd_read_config(cupsd_t)
	lpd_relabel_spool(cupsd_t)
')

optional_policy(`
	mta_send_mail(cupsd_t)
')

optional_policy(`
	networkmanager_dbus_chat(cupsd_t)
')

optional_policy(`
	samba_read_config(cupsd_t)
	samba_rw_var_files(cupsd_t)
	samba_stream_connect_nmbd(cupsd_t)
')

optional_policy(`
	seutil_sigchld_newrole(cupsd_t)
')

optional_policy(`
	snmp_manage_var_lib_files(cupsd_t)
')

optional_policy(`
	udev_read_db(cupsd_t)
')

optional_policy(`
	virt_rw_chr_files(cupsd_t)
')

optional_policy(`
    vmware_read_system_config(cupsd_t)
')

########################################
#
# Configuration daemon local policy
#

allow cupsd_config_t self:capability { chown dac_read_search sys_tty_config };
dontaudit cupsd_config_t self:capability sys_tty_config;
allow cupsd_config_t self:process { getsched };

domtrans_pattern(cupsd_config_t, cupsd_exec_t, cupsd_t)
allow cupsd_config_t cupsd_t:process signal;
ps_process_pattern(cupsd_config_t, cupsd_t)

manage_files_pattern(cupsd_config_t, cupsd_etc_t, cupsd_etc_t)
manage_lnk_files_pattern(cupsd_config_t, cupsd_etc_t, cupsd_etc_t)
filetrans_pattern(cupsd_config_t, cupsd_etc_t, cupsd_rw_etc_t, file)

manage_files_pattern(cupsd_config_t, cupsd_rw_etc_t, cupsd_rw_etc_t)
manage_lnk_files_pattern(cupsd_config_t, cupsd_rw_etc_t, cupsd_rw_etc_t)
files_var_filetrans(cupsd_config_t, cupsd_rw_etc_t, file)

allow cupsd_config_t cupsd_log_t:file { append_file_perms read_file_perms };

manage_lnk_files_pattern(cupsd_config_t, cupsd_tmp_t, cupsd_tmp_t)
manage_files_pattern(cupsd_config_t, cupsd_tmp_t, cupsd_tmp_t)
manage_dirs_pattern(cupsd_config_t, cupsd_tmp_t, cupsd_tmp_t)
files_tmp_filetrans(cupsd_config_t, cupsd_tmp_t, { lnk_file file dir })

allow cupsd_config_t cupsd_var_run_t:file read_file_perms;
allow cupsd_config_t cupsd_var_run_t:sock_file read_file_perms;

manage_dirs_pattern(cupsd_config_t, cupsd_config_var_run_t, cupsd_config_var_run_t)
manage_files_pattern(cupsd_config_t, cupsd_config_var_run_t, cupsd_config_var_run_t)
manage_sock_files_pattern(cupsd_config_t, cupsd_config_var_run_t, cupsd_config_var_run_t)
files_pid_filetrans(cupsd_config_t, cupsd_config_var_run_t, { dir file })

read_files_pattern(cupsd_config_t, cupsd_etc_t, cupsd_etc_t)

stream_connect_pattern(cupsd_config_t, cupsd_var_run_t, cupsd_var_run_t, cupsd_t)

can_exec(cupsd_config_t, cupsd_config_exec_t)
can_exec(cupsd_config_t, cupsd_exec_t)

kernel_read_system_state(cupsd_config_t)
kernel_read_all_sysctls(cupsd_config_t)

corenet_all_recvfrom_netlabel(cupsd_config_t)
corenet_tcp_sendrecv_generic_if(cupsd_config_t)
corenet_tcp_sendrecv_generic_node(cupsd_config_t)
corenet_tcp_sendrecv_all_ports(cupsd_config_t)

corenet_sendrecv_all_client_packets(cupsd_config_t)
corenet_tcp_connect_all_ports(cupsd_config_t)

dev_rw_generic_usb_dev(cupsd_config_t)

files_read_etc_runtime_files(cupsd_config_t)
files_read_var_symlinks(cupsd_config_t)
files_search_all_mountpoints(cupsd_config_t)

fs_search_auto_mountpoints(cupsd_config_t)

domain_use_interactive_fds(cupsd_config_t)
domain_dontaudit_search_all_domains_state(cupsd_config_t)

init_getattr_all_script_files(cupsd_config_t)

auth_use_nsswitch(cupsd_config_t)

logging_send_syslog_msg(cupsd_config_t)

userdom_dontaudit_use_unpriv_user_fds(cupsd_config_t)
userdom_dontaudit_search_user_home_dirs(cupsd_config_t)
userdom_read_all_users_state(cupsd_config_t)
userdom_read_user_tmp_symlinks(cupsd_config_t)
userdom_rw_user_tmp_files(cupsd_config_t)

tunable_policy(`cups_execmem',`
	allow cupsd_config_t self:process { execmem execstack };
')

optional_policy(`
	term_use_generic_ptys(cupsd_config_t)
')

optional_policy(`
	cron_system_entry(cupsd_config_t, cupsd_config_exec_t)
')

optional_policy(`
	dbus_system_domain(cupsd_config_t, cupsd_config_exec_t)

	optional_policy(`
		hal_dbus_chat(cupsd_config_t)
	')

	optional_policy(`
		policykit_dbus_chat(cupsd_config_t)
	')
')

optional_policy(`
    gnome_dontaudit_read_config(cupsd_config_t)
')

optional_policy(`
	hal_domtrans(cupsd_config_t)
	hal_read_tmp_files(cupsd_config_t)
')

optional_policy(`
	hostname_exec(cupsd_config_t)
')

optional_policy(`
	logrotate_use_fds(cupsd_config_t)
')

optional_policy(`
	lpd_read_config(cupsd_config_t)
')

optional_policy(`
	libs_exec_ldconfig(cupsd_config_t)
')

optional_policy(`
	rpm_read_db(cupsd_config_t)
')

optional_policy(`
	seutil_sigchld_newrole(cupsd_config_t)
')

optional_policy(`
	udev_read_db(cupsd_config_t)
')

optional_policy(`
	unconfined_stream_connect(cupsd_config_t)
')

########################################
#
# Lpd local policy
#

allow cupsd_lpd_t self:netlink_tcpdiag_socket r_netlink_socket_perms;

allow cupsd_lpd_t { cupsd_etc_t cupsd_rw_etc_t }:dir list_dir_perms;
allow cupsd_lpd_t { cupsd_etc_t cupsd_rw_etc_t }:file read_file_perms;
allow cupsd_lpd_t { cupsd_etc_t cupsd_rw_etc_t }:lnk_file read_lnk_file_perms;

manage_dirs_pattern(cupsd_lpd_t, cupsd_lpd_tmp_t, cupsd_lpd_tmp_t)
manage_files_pattern(cupsd_lpd_t, cupsd_lpd_tmp_t, cupsd_lpd_tmp_t)
files_tmp_filetrans(cupsd_lpd_t, cupsd_lpd_tmp_t, { dir file })

manage_files_pattern(cupsd_lpd_t, cupsd_lpd_var_run_t, cupsd_lpd_var_run_t)
files_pid_filetrans(cupsd_lpd_t, cupsd_lpd_var_run_t, file)

read_sock_files_pattern(cupsd_lpd_t, cupsd_var_run_t, cupsd_var_run_t)
stream_connect_pattern(cupsd_lpd_t, cupsd_var_run_t, cupsd_var_run_t, cupsd_t)

kernel_read_kernel_sysctls(cupsd_lpd_t)
kernel_read_system_state(cupsd_lpd_t)

corenet_all_recvfrom_netlabel(cupsd_lpd_t)
corenet_tcp_sendrecv_generic_if(cupsd_lpd_t)
corenet_tcp_sendrecv_generic_node(cupsd_lpd_t)

corenet_sendrecv_ipp_client_packets(cupsd_lpd_t)
corenet_tcp_connect_ipp_port(cupsd_lpd_t)
corenet_tcp_bind_printer_port(cupsd_lpd_t)
corenet_tcp_connect_printer_port(cupsd_lpd_t)
corenet_tcp_sendrecv_ipp_port(cupsd_lpd_t)

corenet_sendrecv_printer_server_packets(cupsd_lpd_t)
corenet_tcp_bind_printer_port(cupsd_lpd_t)
corenet_tcp_sendrecv_printer_port(cupsd_lpd_t)

corenet_sendrecv_printer_client_packets(cupsd_lpd_t)
corenet_tcp_connect_printer_port(cupsd_lpd_t)

dev_read_urand(cupsd_lpd_t)
dev_read_rand(cupsd_lpd_t)

init_abstract_socket_activation(cupsd_lpd_t)

fs_getattr_xattr_fs(cupsd_lpd_t)

files_search_home(cupsd_lpd_t)

auth_use_nsswitch(cupsd_lpd_t)

logging_send_syslog_msg(cupsd_lpd_t)

optional_policy(`
	inetd_service_domain(cupsd_lpd_t, cupsd_lpd_exec_t)
')

########################################
#
# Pdf local policy
#

allow cups_pdf_t self:capability { chown fowner fsetid setuid setgid dac_read_search dac_override };
allow cups_pdf_t self:unix_dgram_socket create_stream_socket_perms;
allow cups_pdf_t self:unix_stream_socket create_stream_socket_perms;
allow cups_pdf_t cupsd_rw_etc_t:dir search;


allow cups_pdf_t cupsd_etc_t:dir list_dir_perms;

append_files_pattern(cups_pdf_t, cupsd_log_t, cupsd_log_t)
create_files_pattern(cups_pdf_t, cupsd_log_t, cupsd_log_t)
setattr_files_pattern(cups_pdf_t, cupsd_log_t, cupsd_log_t)
manage_dirs_pattern(cups_pdf_t, cupsd_log_t, cupsd_log_t)
logging_log_filetrans(cups_pdf_t, cupsd_log_t, { file dir })

manage_files_pattern(cups_pdf_t, cups_pdf_tmp_t, cups_pdf_tmp_t)
manage_dirs_pattern(cups_pdf_t, cups_pdf_tmp_t, cups_pdf_tmp_t)
files_tmp_filetrans(cups_pdf_t, cups_pdf_tmp_t, { dir file })

fs_rw_anon_inodefs_files(cups_pdf_t)
fs_search_auto_mountpoints(cups_pdf_t)

kernel_read_system_state(cups_pdf_t)

auth_use_nsswitch(cups_pdf_t)

userdom_manage_user_home_content_dirs(cups_pdf_t)
userdom_manage_user_home_content_files(cups_pdf_t)
userdom_filetrans_home_content(cups_pdf_t)

tunable_policy(`use_nfs_home_dirs',`
	fs_manage_nfs_dirs(cups_pdf_t)
	fs_manage_nfs_files(cups_pdf_t)
')

userdom_home_manager(cups_pdf_t)

optional_policy(`
	dbus_system_bus_client(cups_pdf_t)
')

optional_policy(`
	gnome_read_config(cups_pdf_t)
')


########################################
#
# PTAL local policy
#

allow ptal_t self:capability { chown sys_rawio };
dontaudit ptal_t self:capability sys_tty_config;
allow ptal_t self:fifo_file rw_fifo_file_perms;
allow ptal_t self:unix_stream_socket { accept listen };
allow ptal_t self:tcp_socket create_stream_socket_perms;

allow ptal_t ptal_etc_t:dir list_dir_perms;
read_files_pattern(ptal_t, ptal_etc_t, ptal_etc_t)
read_lnk_files_pattern(ptal_t, ptal_etc_t, ptal_etc_t)

manage_dirs_pattern(ptal_t, ptal_var_run_t, ptal_var_run_t)
manage_files_pattern(ptal_t, ptal_var_run_t, ptal_var_run_t)
manage_lnk_files_pattern(ptal_t, ptal_var_run_t, ptal_var_run_t)
manage_fifo_files_pattern(ptal_t, ptal_var_run_t, ptal_var_run_t)
manage_sock_files_pattern(ptal_t, ptal_var_run_t, ptal_var_run_t)
files_pid_filetrans(ptal_t, ptal_var_run_t, { dir file lnk_file sock_file fifo_file })

kernel_read_kernel_sysctls(ptal_t)
kernel_list_proc(ptal_t)
kernel_read_proc_symlinks(ptal_t)

corenet_all_recvfrom_netlabel(ptal_t)
corenet_tcp_sendrecv_generic_if(ptal_t)
corenet_tcp_sendrecv_generic_node(ptal_t)
corenet_tcp_bind_generic_node(ptal_t)

corenet_sendrecv_ptal_server_packets(ptal_t)
corenet_tcp_bind_ptal_port(ptal_t)
corenet_tcp_sendrecv_ptal_port(ptal_t)

dev_read_usbfs(ptal_t)
dev_rw_printer(ptal_t)

domain_use_interactive_fds(ptal_t)

files_read_etc_runtime_files(ptal_t)

fs_getattr_all_fs(ptal_t)
fs_search_auto_mountpoints(ptal_t)

logging_send_syslog_msg(ptal_t)

sysnet_read_config(ptal_t)

userdom_dontaudit_use_unpriv_user_fds(ptal_t)
userdom_dontaudit_search_user_home_content(ptal_t)

optional_policy(`
	seutil_sigchld_newrole(ptal_t)
')

optional_policy(`
	udev_read_db(ptal_t)
')

