Chris PeBenito b11a75
Chris PeBenito 5ea24b
policy_module(ntp,1.1.0)
Chris PeBenito b11a75
Chris PeBenito b11a75
########################################
Chris PeBenito b11a75
#
Chris PeBenito b11a75
# Declarations
Chris PeBenito b11a75
#
Chris PeBenito b11a75
Chris PeBenito b11a75
type ntp_drift_t;
Chris PeBenito b11a75
files_type(ntp_drift_t)
Chris PeBenito b11a75
Chris PeBenito b11a75
type ntpd_t;
Chris PeBenito b11a75
type ntpd_exec_t;
Chris PeBenito b11a75
init_daemon_domain(ntpd_t,ntpd_exec_t)
Chris PeBenito b11a75
Chris PeBenito b11a75
type ntpd_log_t;
Chris PeBenito b11a75
logging_log_file(ntpd_log_t)
Chris PeBenito b11a75
Chris PeBenito b11a75
type ntpd_tmp_t;
Chris PeBenito b11a75
files_tmp_file(ntpd_tmp_t)
Chris PeBenito b11a75
Chris PeBenito b11a75
type ntpd_var_run_t;
Chris PeBenito b11a75
files_pid_file(ntpd_var_run_t)
Chris PeBenito b11a75
Chris PeBenito b11a75
type ntpdate_exec_t;
Chris PeBenito b11a75
init_system_domain(ntpd_t,ntpdate_exec_t)
Chris PeBenito b11a75
Chris PeBenito b11a75
########################################
Chris PeBenito b11a75
#
Chris PeBenito b11a75
# Local policy
Chris PeBenito b11a75
#
Chris PeBenito b11a75
Chris PeBenito 77f6e2
# sys_resource and setrlimit is for locking memory
Chris PeBenito b11a75
# ntpdate wants sys_nice
Chris PeBenito 77f6e2
allow ntpd_t self:capability { chown dac_override kill setgid setuid sys_time ipc_lock sys_chroot sys_nice sys_resource };
Chris PeBenito b11a75
dontaudit ntpd_t self:capability { net_admin sys_tty_config fsetid sys_nice };
Chris PeBenito 77f6e2
allow ntpd_t self:process { signal_perms setcap setsched setrlimit };
Chris PeBenito b11a75
allow ntpd_t self:fifo_file { read write getattr };
Chris PeBenito b11a75
allow ntpd_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito b11a75
allow ntpd_t self:unix_stream_socket create_socket_perms;
Chris PeBenito b11a75
allow ntpd_t self:netlink_route_socket r_netlink_socket_perms;
Chris PeBenito b11a75
allow ntpd_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito b11a75
allow ntpd_t self:udp_socket { create_socket_perms sendto recvfrom };
Chris PeBenito b11a75
Chris PeBenito b11a75
allow ntpd_t ntp_drift_t:dir rw_dir_perms;
Chris PeBenito b11a75
allow ntpd_t ntp_drift_t:file create_file_perms;
Chris PeBenito b11a75
Chris PeBenito b11a75
can_exec(ntpd_t,ntpd_exec_t)
Chris PeBenito b11a75
Chris PeBenito b11a75
allow ntpd_t ntpd_log_t:file create_file_perms;
Chris PeBenito b11a75
allow ntpd_t ntpd_log_t:dir { rw_dir_perms setattr };
Chris PeBenito 103fe2
logging_log_filetrans(ntpd_t,ntpd_log_t,{ file dir })
Chris PeBenito b11a75
Chris PeBenito b11a75
# for some reason it creates a file in /tmp
Chris PeBenito b11a75
allow ntpd_t ntpd_tmp_t:dir create_dir_perms;
Chris PeBenito b11a75
allow ntpd_t ntpd_tmp_t:file create_file_perms;
Chris PeBenito 103fe2
files_tmp_filetrans(ntpd_t, ntpd_tmp_t, { file dir })
Chris PeBenito b11a75
Chris PeBenito b11a75
allow ntpd_t ntpd_var_run_t:file create_file_perms;
Chris PeBenito d1b9d9
allow ntpd_t ntpd_var_run_t:dir rw_dir_perms;
Chris PeBenito 103fe2
files_pid_filetrans(ntpd_t,ntpd_var_run_t)
Chris PeBenito b11a75
Chris PeBenito 445522
kernel_read_kernel_sysctls(ntpd_t)
Chris PeBenito b11a75
kernel_read_system_state(ntpd_t)
Chris PeBenito b11a75
Chris PeBenito b11a75
corenet_tcp_sendrecv_all_if(ntpd_t)
Chris PeBenito b11a75
corenet_udp_sendrecv_all_if(ntpd_t)
Chris PeBenito b11a75
corenet_raw_sendrecv_all_if(ntpd_t)
Chris PeBenito b11a75
corenet_tcp_sendrecv_all_nodes(ntpd_t)
Chris PeBenito b11a75
corenet_udp_sendrecv_all_nodes(ntpd_t)
Chris PeBenito b11a75
corenet_raw_sendrecv_all_nodes(ntpd_t)
Chris PeBenito b11a75
corenet_tcp_sendrecv_all_ports(ntpd_t)
Chris PeBenito b11a75
corenet_udp_sendrecv_all_ports(ntpd_t)
Chris PeBenito bd7037
corenet_non_ipsec_sendrecv(ntpd_t)
Chris PeBenito b11a75
corenet_tcp_bind_all_nodes(ntpd_t)
Chris PeBenito b11a75
corenet_udp_bind_all_nodes(ntpd_t)
Chris PeBenito b11a75
corenet_udp_bind_ntp_port(ntpd_t)
Chris PeBenito 0907bd
corenet_tcp_connect_ntp_port(ntpd_t)
Chris PeBenito b11a75
Chris PeBenito b11a75
dev_read_sysfs(ntpd_t)
Chris PeBenito b11a75
# for SSP
Chris PeBenito b11a75
dev_read_urand(ntpd_t)
Chris PeBenito b11a75
Chris PeBenito b11a75
fs_getattr_all_fs(ntpd_t)
Chris PeBenito b11a75
fs_search_auto_mountpoints(ntpd_t)
Chris PeBenito b11a75
Chris PeBenito b11a75
term_dontaudit_use_console(ntpd_t)
Chris PeBenito b11a75
Chris PeBenito b11a75
corecmd_exec_bin(ntpd_t)
Chris PeBenito b11a75
corecmd_exec_sbin(ntpd_t)
Chris PeBenito b11a75
corecmd_exec_ls(ntpd_t)
Chris PeBenito b11a75
corecmd_exec_shell(ntpd_t)
Chris PeBenito b11a75
Chris PeBenito 15722e
domain_use_interactive_fds(ntpd_t)
Chris PeBenito 1815ba
domain_dontaudit_list_all_domains_state(ntpd_t)
Chris PeBenito b11a75
Chris PeBenito b11a75
files_read_etc_files(ntpd_t)
Chris PeBenito b11a75
files_read_etc_runtime_files(ntpd_t)
Chris PeBenito b11a75
files_read_usr_files(ntpd_t)
Chris PeBenito b11a75
files_list_var_lib(ntpd_t)
Chris PeBenito b11a75
Chris PeBenito f75479
init_exec_script_files(ntpd_t)
Chris PeBenito b11a75
init_use_fd(ntpd_t)
Chris PeBenito 1815ba
init_use_script_ptys(ntpd_t)
Chris PeBenito b11a75
Chris PeBenito b11a75
libs_use_ld_so(ntpd_t)
Chris PeBenito b11a75
libs_use_shared_libs(ntpd_t)
Chris PeBenito b11a75
Chris PeBenito b11a75
logging_send_syslog_msg(ntpd_t)
Chris PeBenito b11a75
Chris PeBenito b11a75
miscfiles_read_localization(ntpd_t)
Chris PeBenito b11a75
Chris PeBenito b11a75
sysnet_read_config(ntpd_t)
Chris PeBenito b11a75
Chris PeBenito 15722e
userdom_dontaudit_use_unpriv_user_fds(ntpd_t)
Chris PeBenito 103fe2
userdom_list_sysadm_home_dirs(ntpd_t)
Chris PeBenito 103fe2
userdom_dontaudit_list_sysadm_home_dirs(ntpd_t)
Chris PeBenito b11a75
Chris PeBenito b11a75
ifdef(`targeted_policy', `
Chris PeBenito 1815ba
	term_dontaudit_use_unallocated_ttys(ntpd_t)
Chris PeBenito 1815ba
	term_dontaudit_use_generic_ptys(ntpd_t)
Chris PeBenito 9e04f5
	files_dontaudit_read_root_files(ntpd_t)
Chris PeBenito b11a75
')
Chris PeBenito b11a75
Chris PeBenito 132880
optional_policy(`cron',`
Chris PeBenito b11a75
	# for cron jobs
Chris PeBenito 77f6e2
	cron_system_entry(ntpd_t,ntpdate_exec_t)
Chris PeBenito b11a75
')
Chris PeBenito b11a75
Chris PeBenito 132880
optional_policy(`firstboot',`
Chris PeBenito b11a75
	firstboot_dontaudit_use_fd(ntpd_t)
Chris PeBenito b11a75
')
Chris PeBenito b11a75
Chris PeBenito 132880
optional_policy(`logrotate',`
Chris PeBenito b11a75
	logrotate_exec(ntpd_t)
Chris PeBenito b11a75
')
Chris PeBenito b11a75
Chris PeBenito 132880
optional_policy(`mount',`
Chris PeBenito b11a75
	mount_send_nfs_client_request(ntpd_t)
Chris PeBenito b11a75
')
Chris PeBenito b11a75
Chris PeBenito 132880
optional_policy(`nis',`
Chris PeBenito b11a75
	nis_use_ypbind(ntpd_t)
Chris PeBenito b11a75
')
Chris PeBenito b11a75
Chris PeBenito 132880
optional_policy(`nscd',`
Chris PeBenito 1815ba
	nscd_socket_use(ntpd_t)
Chris PeBenito b11a75
')
Chris PeBenito b11a75
Chris PeBenito 132880
optional_policy(`samba',`
Chris PeBenito 1815ba
	samba_stream_connect_winbind(ntpd_t)
Chris PeBenito 725926
')
Chris PeBenito 725926
Chris PeBenito 132880
optional_policy(`selinuxutil',`
Chris PeBenito b11a75
	seutil_sigchld_newrole(ntpd_t)
Chris PeBenito b11a75
')
Chris PeBenito b11a75
Chris PeBenito 132880
optional_policy(`udev',`
Chris PeBenito b11a75
	udev_read_db(ntpd_t)
Chris PeBenito b11a75
')
Chris PeBenito b11a75
Chris PeBenito b11a75
ifdef(`TODO',`
Chris PeBenito b11a75
allow ntpd_t sysadm_t:udp_socket sendto;
Chris PeBenito b11a75
allow sysadm_t ntpd_t:udp_socket recvfrom;
Chris PeBenito b11a75
Chris PeBenito b11a75
allow sysadm_t ntpd_t:udp_socket sendto;
Chris PeBenito b11a75
allow ntpd_t sysadm_t:udp_socket recvfrom;
Chris PeBenito b11a75
') dnl end TODO