Chris PeBenito 17de1b
Chris PeBenito 0251df
policy_module(ntp,1.3.0)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type ntp_drift_t;
Chris PeBenito 17de1b
files_type(ntp_drift_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type ntpd_t;
Chris PeBenito 17de1b
type ntpd_exec_t;
Chris PeBenito 17de1b
init_daemon_domain(ntpd_t,ntpd_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type ntpd_log_t;
Chris PeBenito 17de1b
logging_log_file(ntpd_log_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type ntpd_tmp_t;
Chris PeBenito 17de1b
files_tmp_file(ntpd_tmp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type ntpd_var_run_t;
Chris PeBenito 17de1b
files_pid_file(ntpd_var_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type ntpdate_exec_t;
Chris PeBenito 17de1b
init_system_domain(ntpd_t,ntpdate_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# sys_resource and setrlimit is for locking memory
Chris PeBenito 17de1b
# ntpdate wants sys_nice
Chris PeBenito 17de1b
allow ntpd_t self:capability { chown dac_override kill setgid setuid sys_time ipc_lock sys_chroot sys_nice sys_resource };
Chris PeBenito 17de1b
dontaudit ntpd_t self:capability { net_admin sys_tty_config fsetid sys_nice };
Chris PeBenito 17de1b
allow ntpd_t self:process { signal_perms setcap setsched setrlimit };
Chris PeBenito 17de1b
allow ntpd_t self:fifo_file { read write getattr };
Chris PeBenito 17de1b
allow ntpd_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 17de1b
allow ntpd_t self:unix_stream_socket create_socket_perms;
Chris PeBenito 17de1b
allow ntpd_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 33c7e6
allow ntpd_t self:udp_socket create_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito c0868a
manage_files_pattern(ntpd_t,ntp_drift_t,ntp_drift_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
can_exec(ntpd_t,ntpd_exec_t)
Chris PeBenito 17de1b
Chris PeBenito c0868a
allow ntpd_t ntpd_log_t:dir setattr;
Chris PeBenito c0868a
manage_files_pattern(ntpd_t,ntpd_log_t,ntpd_log_t)
Chris PeBenito 17de1b
logging_log_filetrans(ntpd_t,ntpd_log_t,{ file dir })
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# for some reason it creates a file in /tmp
Chris PeBenito c0868a
manage_dirs_pattern(ntpd_t,ntpd_tmp_t,ntpd_tmp_t)
Chris PeBenito c0868a
manage_files_pattern(ntpd_t,ntpd_tmp_t,ntpd_tmp_t)
Chris PeBenito 17de1b
files_tmp_filetrans(ntpd_t, ntpd_tmp_t, { file dir })
Chris PeBenito 17de1b
Chris PeBenito c0868a
manage_files_pattern(ntpd_t,ntpd_var_run_t,ntpd_var_run_t)
Chris PeBenito 17de1b
files_pid_filetrans(ntpd_t,ntpd_var_run_t,file)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_kernel_sysctls(ntpd_t)
Chris PeBenito 17de1b
kernel_read_system_state(ntpd_t)
Chris PeBenito 17de1b
kernel_read_network_state(ntpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
corenet_non_ipsec_sendrecv(ntpd_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_if(ntpd_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_if(ntpd_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_nodes(ntpd_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_nodes(ntpd_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_ports(ntpd_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_ports(ntpd_t)
Chris PeBenito 17de1b
corenet_tcp_bind_all_nodes(ntpd_t)
Chris PeBenito 17de1b
corenet_udp_bind_all_nodes(ntpd_t)
Chris PeBenito 17de1b
corenet_udp_bind_ntp_port(ntpd_t)
Chris PeBenito 17de1b
corenet_tcp_connect_ntp_port(ntpd_t)
Chris PeBenito 17de1b
corenet_sendrecv_ntp_server_packets(ntpd_t)
Chris PeBenito 17de1b
corenet_sendrecv_ntp_client_packets(ntpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
dev_read_sysfs(ntpd_t)
Chris PeBenito 17de1b
# for SSP
Chris PeBenito 17de1b
dev_read_urand(ntpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
fs_getattr_all_fs(ntpd_t)
Chris PeBenito 17de1b
fs_search_auto_mountpoints(ntpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
auth_use_nsswitch(ntpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
corecmd_exec_bin(ntpd_t)
Chris PeBenito 17de1b
corecmd_exec_shell(ntpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
domain_use_interactive_fds(ntpd_t)
Chris PeBenito 17de1b
domain_dontaudit_list_all_domains_state(ntpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_read_etc_files(ntpd_t)
Chris PeBenito 17de1b
files_read_etc_runtime_files(ntpd_t)
Chris PeBenito 17de1b
files_read_usr_files(ntpd_t)
Chris PeBenito 17de1b
files_list_var_lib(ntpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
init_exec_script_files(ntpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(ntpd_t)
Chris PeBenito 17de1b
libs_use_shared_libs(ntpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
logging_send_syslog_msg(ntpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(ntpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
sysnet_read_config(ntpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
userdom_dontaudit_use_unpriv_user_fds(ntpd_t)
Chris PeBenito 17de1b
userdom_list_sysadm_home_dirs(ntpd_t)
Chris PeBenito 17de1b
userdom_dontaudit_list_sysadm_home_dirs(ntpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`targeted_policy', `
Chris PeBenito 17de1b
	term_dontaudit_use_unallocated_ttys(ntpd_t)
Chris PeBenito 17de1b
	term_dontaudit_use_generic_ptys(ntpd_t)
Chris PeBenito 17de1b
	files_dontaudit_read_root_files(ntpd_t)
Chris PeBenito 8708d9
Chris PeBenito 8708d9
	optional_policy(`
Chris PeBenito 8708d9
		# The Gnome date GUI code is requesting that 
Chris PeBenito 8708d9
		# the ntp code change the date of the machine.
Chris PeBenito 8708d9
		unconfined_rw_pipes(ntpd_t)
Chris PeBenito 8708d9
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	# for cron jobs
Chris PeBenito 17de1b
	cron_system_entry(ntpd_t,ntpdate_exec_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	firstboot_dontaudit_use_fds(ntpd_t)
Chris PeBenito 9af48e
	firstboot_dontaudit_rw_pipes(ntpd_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	logrotate_exec(ntpd_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	seutil_sigchld_newrole(ntpd_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	udev_read_db(ntpd_t)
Chris PeBenito 17de1b
')