Chris PeBenito ab58ad
#DESC Hwclock - Hardware clock manager
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Author:  David A. Wheeler <dwheeler@ida.org>
Chris PeBenito ab58ad
#          Russell Coker <russell@coker.com.au>
Chris PeBenito ab58ad
# X-Debian-Packages: util-linux
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#################################
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Rules for the hwclock_t domain.
Chris PeBenito ab58ad
# This domain moves time information between the "hardware clock"
Chris PeBenito ab58ad
# (which runs when the system is off) and the "system clock",
Chris PeBenito ab58ad
# and it stores adjustment values in /etc/adjtime so that errors in the
Chris PeBenito ab58ad
# hardware clock are corrected.
Chris PeBenito ab58ad
# Note that any errors from this domain are NOT recorded by the system logger,
Chris PeBenito ab58ad
# because the system logger isnt running when this domain is active.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
daemon_base_domain(hwclock)
Chris PeBenito ab58ad
role sysadm_r types hwclock_t;
Chris PeBenito ab58ad
ifdef(`targeted_policy', `', `
Chris PeBenito ab58ad
domain_auto_trans(sysadm_t, hwclock_exec_t, hwclock_t)
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
type adjtime_t, file_type, sysadmfile;
Chris PeBenito ab58ad
allow hwclock_t fs_t:filesystem getattr;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
read_locale(hwclock_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Give hwclock the capabilities it requires.  dac_override is a surprise,
Chris PeBenito ab58ad
# but hwclock does require it.
Chris PeBenito ab58ad
allow hwclock_t self:capability { dac_override sys_rawio sys_time sys_tty_config };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Allow hwclock to set the hardware clock.
Chris PeBenito ab58ad
allow hwclock_t clock_device_t:devfile_class_set { setattr rw_file_perms };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Allow hwclock to store & retrieve correction factors.
Chris PeBenito ab58ad
allow hwclock_t adjtime_t:file { setattr rw_file_perms };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Read and write console and ttys.
Chris PeBenito ab58ad
allow hwclock_t tty_device_t:chr_file rw_file_perms;
Chris PeBenito ab58ad
allow hwclock_t ttyfile:chr_file rw_file_perms;
Chris PeBenito ab58ad
allow hwclock_t ptyfile:chr_file rw_file_perms;
Chris PeBenito ab58ad
ifdef(`gnome-pty-helper.te', `allow hwclock_t sysadm_gph_t:fd use;')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
read_locale(hwclock_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# for when /usr is not mounted
Chris PeBenito ab58ad
dontaudit hwclock_t file_t:dir search;
Chris PeBenito ab58ad
allow hwclock_t self:netlink_audit_socket { create_netlink_socket_perms nlmsg_relay };
Chris PeBenito ab58ad
r_dir_file(hwclock_t, etc_t)