policy_module(fprintd, 1.2.0)

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

type fprintd_t;
type fprintd_exec_t;
init_daemon_domain(fprintd_t, fprintd_exec_t)
init_nnp_daemon_domain(fprintd_t)

type fprintd_var_lib_t;
files_type(fprintd_var_lib_t)

type fprintd_tmp_t;
files_tmp_file(fprintd_tmp_t)

########################################
#
# Local policy
#

allow fprintd_t self:capability { sys_admin sys_nice };
allow fprintd_t self:capability2 wake_alarm;
allow fprintd_t self:process { getsched setsched signal sigkill };
allow fprintd_t self:fifo_file rw_fifo_file_perms;
allow fprintd_t self:netlink_kobject_uevent_socket create_socket_perms;
allow fprintd_t self:unix_dgram_socket { create_socket_perms sendto };

manage_dirs_pattern(fprintd_t, fprintd_var_lib_t, fprintd_var_lib_t)
manage_files_pattern(fprintd_t, fprintd_var_lib_t, fprintd_var_lib_t)

manage_dirs_pattern(fprintd_t, fprintd_tmp_t, fprintd_tmp_t)
manage_files_pattern(fprintd_t, fprintd_tmp_t, fprintd_tmp_t)
files_tmp_filetrans(fprintd_t, fprintd_tmp_t, { file dir })

kernel_read_system_state(fprintd_t)

corecmd_exec_bin(fprintd_t)

dev_list_usbfs(fprintd_t)
dev_read_sysfs(fprintd_t)
dev_read_urand(fprintd_t)
dev_rw_generic_usb_dev(fprintd_t)

fs_getattr_all_fs(fprintd_t)

auth_use_nsswitch(fprintd_t)

logging_send_syslog_msg(fprintd_t)

userdom_use_user_ptys(fprintd_t)
userdom_read_all_users_state(fprintd_t)

optional_policy(`
	dbus_system_domain(fprintd_t, fprintd_exec_t)

	optional_policy(`
		consolekit_dbus_chat(fprintd_t)
	')

	optional_policy(`
		policykit_dbus_chat(fprintd_t)
		policykit_dbus_chat_auth(fprintd_t)
	')
')


optional_policy(`
	policykit_read_reload(fprintd_t)
	policykit_read_lib(fprintd_t)
	policykit_domtrans_auth(fprintd_t)
')

optional_policy(`
	rhcs_dbus_chat_cluster(fprintd_t)
')

optional_policy(`
	systemd_dbus_chat_logind(fprintd_t)
	systemd_write_inhibit_pipes(fprintd_t)
')

optional_policy(`
	udev_read_db(fprintd_t)
')

optional_policy(`
	xserver_read_state_xdm(fprintd_t)
')
