selinux-policy/refpolicy/policy/modules/services/ntp.te

169 lines
4.0 KiB
Plaintext
Raw Normal View History

2005-09-05 16:47:19 +00:00
2005-12-09 16:38:39 +00:00
policy_module(ntp,1.1.0)
2005-09-05 16:47:19 +00:00
########################################
#
# Declarations
#
type ntp_drift_t;
files_type(ntp_drift_t)
type ntpd_t;
type ntpd_exec_t;
init_daemon_domain(ntpd_t,ntpd_exec_t)
type ntpd_log_t;
logging_log_file(ntpd_log_t)
type ntpd_tmp_t;
files_tmp_file(ntpd_tmp_t)
type ntpd_var_run_t;
files_pid_file(ntpd_var_run_t)
type ntpdate_exec_t;
init_system_domain(ntpd_t,ntpdate_exec_t)
########################################
#
# Local policy
#
# sys_resource and setrlimit is for locking memory
2005-09-05 16:47:19 +00:00
# ntpdate wants sys_nice
allow ntpd_t self:capability { chown dac_override kill setgid setuid sys_time ipc_lock sys_chroot sys_nice sys_resource };
2005-09-05 16:47:19 +00:00
dontaudit ntpd_t self:capability { net_admin sys_tty_config fsetid sys_nice };
allow ntpd_t self:process { signal_perms setcap setsched setrlimit };
2005-09-05 16:47:19 +00:00
allow ntpd_t self:fifo_file { read write getattr };
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;
allow ntpd_t self:tcp_socket create_stream_socket_perms;
allow ntpd_t self:udp_socket { create_socket_perms sendto recvfrom };
allow ntpd_t ntp_drift_t:dir rw_dir_perms;
allow ntpd_t ntp_drift_t:file create_file_perms;
can_exec(ntpd_t,ntpd_exec_t)
allow ntpd_t ntpd_log_t:file create_file_perms;
allow ntpd_t ntpd_log_t:dir { rw_dir_perms setattr };
logging_filetrans_log(ntpd_t,ntpd_log_t,{ file dir })
2005-09-05 16:47:19 +00:00
# for some reason it creates a file in /tmp
allow ntpd_t ntpd_tmp_t:dir create_dir_perms;
allow ntpd_t ntpd_tmp_t:file create_file_perms;
files_filetrans_tmp(ntpd_t, ntpd_tmp_t, { file dir })
2005-09-05 16:47:19 +00:00
allow ntpd_t ntpd_var_run_t:file create_file_perms;
2005-10-26 18:07:20 +00:00
allow ntpd_t ntpd_var_run_t:dir rw_dir_perms;
files_filetrans_pid(ntpd_t,ntpd_var_run_t)
2005-09-05 16:47:19 +00:00
kernel_read_kernel_sysctls(ntpd_t)
2005-09-05 16:47:19 +00:00
kernel_read_system_state(ntpd_t)
corenet_tcp_sendrecv_all_if(ntpd_t)
corenet_udp_sendrecv_all_if(ntpd_t)
corenet_raw_sendrecv_all_if(ntpd_t)
corenet_tcp_sendrecv_all_nodes(ntpd_t)
corenet_udp_sendrecv_all_nodes(ntpd_t)
corenet_raw_sendrecv_all_nodes(ntpd_t)
corenet_tcp_sendrecv_all_ports(ntpd_t)
corenet_udp_sendrecv_all_ports(ntpd_t)
2005-12-06 19:59:50 +00:00
corenet_non_ipsec_sendrecv(ntpd_t)
2005-09-05 16:47:19 +00:00
corenet_tcp_bind_all_nodes(ntpd_t)
corenet_udp_bind_all_nodes(ntpd_t)
corenet_udp_bind_ntp_port(ntpd_t)
2005-09-13 13:06:07 +00:00
corenet_tcp_connect_ntp_port(ntpd_t)
2005-09-05 16:47:19 +00:00
dev_read_sysfs(ntpd_t)
# for SSP
dev_read_urand(ntpd_t)
fs_getattr_all_fs(ntpd_t)
fs_search_auto_mountpoints(ntpd_t)
term_dontaudit_use_console(ntpd_t)
corecmd_exec_bin(ntpd_t)
corecmd_exec_sbin(ntpd_t)
corecmd_exec_ls(ntpd_t)
corecmd_exec_shell(ntpd_t)
domain_use_wide_inherit_fd(ntpd_t)
2006-02-02 21:08:12 +00:00
domain_dontaudit_list_all_domains_state(ntpd_t)
2005-09-05 16:47:19 +00:00
files_read_etc_files(ntpd_t)
files_read_etc_runtime_files(ntpd_t)
files_read_usr_files(ntpd_t)
files_list_var_lib(ntpd_t)
2006-02-06 15:40:41 +00:00
init_exec_script_files(ntpd_t)
2005-09-05 16:47:19 +00:00
init_use_fd(ntpd_t)
2006-02-02 21:08:12 +00:00
init_use_script_ptys(ntpd_t)
2005-09-05 16:47:19 +00:00
libs_use_ld_so(ntpd_t)
libs_use_shared_libs(ntpd_t)
logging_send_syslog_msg(ntpd_t)
miscfiles_read_localization(ntpd_t)
sysnet_read_config(ntpd_t)
userdom_dontaudit_use_unpriv_user_fd(ntpd_t)
2005-11-08 22:00:30 +00:00
userdom_list_sysadm_home_dir(ntpd_t)
2005-09-05 16:47:19 +00:00
userdom_dontaudit_list_sysadm_home_dir(ntpd_t)
ifdef(`targeted_policy', `
2006-02-02 21:08:12 +00:00
term_dontaudit_use_unallocated_ttys(ntpd_t)
term_dontaudit_use_generic_ptys(ntpd_t)
files_dontaudit_read_root_files(ntpd_t)
2005-09-05 16:47:19 +00:00
')
optional_policy(`cron',`
2005-09-05 16:47:19 +00:00
# for cron jobs
cron_system_entry(ntpd_t,ntpdate_exec_t)
2005-09-05 16:47:19 +00:00
')
optional_policy(`firstboot',`
2005-09-05 16:47:19 +00:00
firstboot_dontaudit_use_fd(ntpd_t)
')
optional_policy(`logrotate',`
2005-09-05 16:47:19 +00:00
logrotate_exec(ntpd_t)
')
optional_policy(`mount',`
2005-09-05 16:47:19 +00:00
mount_send_nfs_client_request(ntpd_t)
')
optional_policy(`nis',`
2005-09-05 16:47:19 +00:00
nis_use_ypbind(ntpd_t)
')
optional_policy(`nscd',`
2006-02-02 21:08:12 +00:00
nscd_socket_use(ntpd_t)
2005-09-05 16:47:19 +00:00
')
optional_policy(`samba',`
2006-02-02 21:08:12 +00:00
samba_stream_connect_winbind(ntpd_t)
2005-11-08 22:00:30 +00:00
')
optional_policy(`selinuxutil',`
2005-09-05 16:47:19 +00:00
seutil_sigchld_newrole(ntpd_t)
')
optional_policy(`udev',`
2005-09-05 16:47:19 +00:00
udev_read_db(ntpd_t)
')
ifdef(`TODO',`
allow ntpd_t sysadm_t:udp_socket sendto;
allow sysadm_t ntpd_t:udp_socket recvfrom;
allow sysadm_t ntpd_t:udp_socket sendto;
allow ntpd_t sysadm_t:udp_socket recvfrom;
') dnl end TODO