policy_module(powerprofiles)

# power-profiles-daemon is a daemon to manage power profiles
# Debian package power-profiles-daemon

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

type power_profilesd_t;
type power_profilesd_exec_t;
init_daemon_domain(power_profilesd_t, power_profilesd_exec_t)

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

allow power_profilesd_t self:capability { dac_override dac_read_search };
allow power_profilesd_t self:netlink_kobject_uevent_socket create_socket_perms;
allow power_profilesd_t self:unix_dgram_socket create_socket_perms;

kernel_read_system_state(power_profilesd_t)

dev_create_sysfs_files(power_profilesd_t)
dev_read_sysfs(power_profilesd_t)
dev_write_sysfs(power_profilesd_t)

dbus_list_system_bus_runtime(power_profilesd_t)
dbus_system_bus_client(power_profilesd_t)
dbus_connect_system_bus(power_profilesd_t)

files_read_etc_files(power_profilesd_t)
files_search_var_lib(power_profilesd_t)

fs_getattr_xattr_fs(power_profilesd_t)

miscfiles_read_localization(power_profilesd_t)

policykit_dbus_chat(power_profilesd_t)
systemd_dbus_chat_logind(power_profilesd_t)

udev_search_runtime(power_profilesd_t)

ifdef(`init_systemd',`
	init_stream_connect(power_profilesd_t)
')

optional_policy(`
	unconfined_dbus_send(power_profilesd_t)
')

optional_policy(`
	xserver_dbus_chat_xdm(power_profilesd_t)
')

