selinux-policy/strict/domains/program/ntpd.te

89 lines
2.7 KiB
Plaintext
Raw Normal View History

2005-04-29 17:45:15 +00:00
#DESC NTPD - Time synchronisation daemon
#
# Author: Russell Coker <russell@coker.com.au>
# X-Debian-Packages: ntp ntp-simple
#
#################################
#
# Rules for the ntpd_t domain.
#
daemon_domain(ntpd, `, nscd_client_domain')
type ntp_drift_t, file_type, sysadmfile;
type ntpdate_exec_t, file_type, sysadmfile, exec_type;
domain_auto_trans(initrc_t, ntpdate_exec_t, ntpd_t)
logdir_domain(ntpd)
allow ntpd_t var_lib_t:dir r_dir_perms;
allow ntpd_t usr_t:file r_file_perms;
# reading /usr/share/ssl/cert.pem requires
allow ntpd_t usr_t:lnk_file read;
allow ntpd_t ntp_drift_t:dir rw_dir_perms;
allow ntpd_t ntp_drift_t:file create_file_perms;
# for SSP
2005-09-13 13:06:07 +00:00
allow ntpd_t urandom_device_t:chr_file { getattr read };
2005-04-29 17:45:15 +00:00
2005-09-16 13:36:26 +00:00
allow ntpd_t self:capability { chown dac_override kill setgid setuid sys_time net_bind_service ipc_lock sys_chroot };
2005-04-29 17:45:15 +00:00
dontaudit ntpd_t self:capability { net_admin };
allow ntpd_t self:process { setcap setsched };
# ntpdate wants sys_nice
dontaudit ntpd_t self:capability { fsetid sys_nice };
# for some reason it creates a file in /tmp
tmp_domain(ntpd)
allow ntpd_t etc_t:dir r_dir_perms;
allow ntpd_t etc_t:file { read getattr };
# Use the network.
can_network(ntpd_t)
2005-09-13 13:06:07 +00:00
allow ntpd_t ntp_port_t:tcp_socket name_connect;
2005-04-29 17:45:15 +00:00
can_ypbind(ntpd_t)
allow ntpd_t ntp_port_t:udp_socket name_bind;
2005-09-15 21:03:45 +00:00
allow sysadm_t ntp_port_t:udp_socket name_bind;
2005-04-29 17:45:15 +00:00
allow ntpd_t self:unix_dgram_socket create_socket_perms;
allow ntpd_t self:unix_stream_socket create_socket_perms;
allow ntpd_t self:netlink_route_socket r_netlink_socket_perms;
# so the start script can change firewall entries
allow initrc_t net_conf_t:file { getattr read ioctl };
# for cron jobs
# system_crond_t is not right, cron is not doing what it should
ifdef(`crond.te', `
system_crond_entry(ntpd_exec_t, ntpd_t)
')
can_exec(ntpd_t, initrc_exec_t)
allow ntpd_t self:fifo_file { read write getattr };
allow ntpd_t etc_runtime_t:file r_file_perms;
can_exec(ntpd_t, { bin_t shell_exec_t sbin_t ls_exec_t ntpd_exec_t })
allow ntpd_t { sbin_t bin_t }:dir search;
allow ntpd_t bin_t:lnk_file read;
read_sysctl(ntpd_t);
allow ntpd_t proc_t:file r_file_perms;
allow ntpd_t sysadm_home_dir_t:dir r_dir_perms;
allow ntpd_t self:file { getattr read };
dontaudit ntpd_t domain:dir search;
ifdef(`logrotate.te', `
can_exec(ntpd_t, logrotate_exec_t)
')
allow ntpd_t devtty_t:chr_file rw_file_perms;
can_udp_send(ntpd_t, sysadm_t)
can_udp_send(sysadm_t, ntpd_t)
can_udp_send(ntpd_t, ntpd_t)
ifdef(`firstboot.te', `
dontaudit ntpd_t firstboot_t:fd use;
')
ifdef(`winbind.te', `
allow ntpd_t winbind_var_run_t:dir r_dir_perms;
allow ntpd_t winbind_var_run_t:sock_file rw_file_perms;
')
2005-09-13 13:06:07 +00:00
# For clock devices like wwvb1
allow ntpd_t device_t:lnk_file read;