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