ntp.te 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. policy_module(ntp, 1.15.2)
  2. ########################################
  3. #
  4. # Declarations
  5. #
  6. attribute_role ntpd_roles;
  7. type ntp_drift_t;
  8. files_type(ntp_drift_t)
  9. type ntpd_t;
  10. type ntpd_exec_t;
  11. init_daemon_domain(ntpd_t, ntpd_exec_t)
  12. role ntpd_roles types ntpd_t;
  13. type ntpd_initrc_exec_t;
  14. init_script_file(ntpd_initrc_exec_t)
  15. type ntp_conf_t;
  16. files_config_file(ntp_conf_t)
  17. type ntpd_key_t;
  18. files_type(ntpd_key_t)
  19. type ntpd_log_t;
  20. logging_log_file(ntpd_log_t)
  21. type ntpd_tmp_t;
  22. files_tmp_file(ntpd_tmp_t)
  23. type ntpd_tmpfs_t;
  24. files_tmpfs_file(ntpd_tmpfs_t)
  25. type ntpd_unit_t;
  26. init_unit_file(ntpd_unit_t)
  27. type ntpd_var_run_t;
  28. files_pid_file(ntpd_var_run_t)
  29. type ntpdate_exec_t;
  30. init_system_domain(ntpd_t, ntpdate_exec_t)
  31. ########################################
  32. #
  33. # Local policy
  34. #
  35. allow ntpd_t self:capability { chown dac_override kill setgid setuid sys_time ipc_lock ipc_owner sys_chroot sys_nice sys_resource };
  36. dontaudit ntpd_t self:capability { net_admin sys_tty_config fsetid sys_nice };
  37. allow ntpd_t self:process { signal_perms getcap setcap setsched setrlimit };
  38. allow ntpd_t self:fifo_file rw_fifo_file_perms;
  39. allow ntpd_t self:shm create_shm_perms;
  40. allow ntpd_t self:tcp_socket { accept listen };
  41. allow ntpd_t self:socket create;
  42. allow ntpd_t self:unix_dgram_socket sendto;
  43. manage_dirs_pattern(ntpd_t, ntp_drift_t, ntp_drift_t)
  44. manage_files_pattern(ntpd_t, ntp_drift_t, ntp_drift_t)
  45. files_var_filetrans(ntpd_t, ntp_drift_t, file)
  46. allow ntpd_t ntp_conf_t:file read_file_perms;
  47. read_files_pattern(ntpd_t, ntpd_key_t, ntpd_key_t)
  48. read_lnk_files_pattern(ntpd_t, ntpd_key_t, ntpd_key_t)
  49. allow ntpd_t ntpd_log_t:dir setattr_dir_perms;
  50. manage_dirs_pattern(ntpd_t, ntpd_log_t, ntpd_log_t)
  51. manage_files_pattern(ntpd_t, ntpd_log_t, ntpd_log_t)
  52. logging_log_filetrans(ntpd_t, ntpd_log_t, { file dir })
  53. manage_dirs_pattern(ntpd_t, ntpd_tmp_t, ntpd_tmp_t)
  54. manage_files_pattern(ntpd_t, ntpd_tmp_t, ntpd_tmp_t)
  55. files_tmp_filetrans(ntpd_t, ntpd_tmp_t, { file dir })
  56. manage_dirs_pattern(ntpd_t, ntpd_tmpfs_t, ntpd_tmpfs_t)
  57. manage_files_pattern(ntpd_t, ntpd_tmpfs_t, ntpd_tmpfs_t)
  58. fs_tmpfs_filetrans(ntpd_t, ntpd_tmpfs_t, { dir file })
  59. manage_files_pattern(ntpd_t, ntpd_var_run_t, ntpd_var_run_t)
  60. files_pid_filetrans(ntpd_t, ntpd_var_run_t, file)
  61. can_exec(ntpd_t, ntpd_exec_t)
  62. kernel_read_kernel_sysctls(ntpd_t)
  63. kernel_read_system_state(ntpd_t)
  64. kernel_read_network_state(ntpd_t)
  65. kernel_request_load_module(ntpd_t)
  66. corenet_all_recvfrom_unlabeled(ntpd_t)
  67. corenet_all_recvfrom_netlabel(ntpd_t)
  68. corenet_tcp_sendrecv_generic_if(ntpd_t)
  69. corenet_udp_sendrecv_generic_if(ntpd_t)
  70. corenet_tcp_sendrecv_generic_node(ntpd_t)
  71. corenet_udp_sendrecv_generic_node(ntpd_t)
  72. corenet_udp_bind_generic_node(ntpd_t)
  73. corenet_sendrecv_ntp_server_packets(ntpd_t)
  74. corenet_udp_bind_ntp_port(ntpd_t)
  75. corenet_udp_sendrecv_ntp_port(ntpd_t)
  76. corenet_sendrecv_ntp_client_packets(ntpd_t)
  77. corenet_tcp_connect_ntp_port(ntpd_t)
  78. corenet_tcp_sendrecv_ntp_port(ntpd_t)
  79. corecmd_exec_bin(ntpd_t)
  80. corecmd_exec_shell(ntpd_t)
  81. dev_read_sysfs(ntpd_t)
  82. dev_read_urand(ntpd_t)
  83. dev_rw_realtime_clock(ntpd_t)
  84. clock_read_adjtime(ntpd_t)
  85. domain_use_interactive_fds(ntpd_t)
  86. domain_dontaudit_list_all_domains_state(ntpd_t)
  87. files_read_etc_runtime_files(ntpd_t)
  88. files_read_usr_files(ntpd_t)
  89. files_list_var_lib(ntpd_t)
  90. files_manage_generic_locks(ntpd_t)
  91. fs_getattr_all_fs(ntpd_t)
  92. fs_search_auto_mountpoints(ntpd_t)
  93. term_use_ptmx(ntpd_t)
  94. auth_use_nsswitch(ntpd_t)
  95. init_exec_script_files(ntpd_t)
  96. logging_send_syslog_msg(ntpd_t)
  97. miscfiles_read_localization(ntpd_t)
  98. userdom_dontaudit_use_unpriv_user_fds(ntpd_t)
  99. userdom_list_user_home_dirs(ntpd_t)
  100. ifdef(`init_systemd',`
  101. dbus_system_bus_client(ntpd_t)
  102. dbus_connect_system_bus(ntpd_t)
  103. init_dbus_chat(ntpd_t)
  104. init_status(ntpd_t)
  105. sysadm_dbus_chat(ntpd_t)
  106. allow ntpd_t self:capability { fowner setpcap };
  107. init_reload(ntpd_t)
  108. # for /var/lib/systemd/clock
  109. init_list_var_lib_dirs(ntpd_t)
  110. # for /run/systemd/netif/links
  111. init_list_pid_dirs(ntpd_t)
  112. optional_policy(`
  113. unconfined_dbus_send(ntpd_t)
  114. ')
  115. ')
  116. optional_policy(`
  117. cron_system_entry(ntpd_t, ntpdate_exec_t)
  118. ')
  119. optional_policy(`
  120. gpsd_rw_shm(ntpd_t)
  121. ')
  122. optional_policy(`
  123. firstboot_dontaudit_use_fds(ntpd_t)
  124. firstboot_dontaudit_rw_pipes(ntpd_t)
  125. firstboot_dontaudit_rw_stream_sockets(ntpd_t)
  126. ')
  127. optional_policy(`
  128. hal_dontaudit_write_log(ntpd_t)
  129. ')
  130. optional_policy(`
  131. logrotate_exec(ntpd_t)
  132. ')
  133. optional_policy(`
  134. seutil_sigchld_newrole(ntpd_t)
  135. ')
  136. optional_policy(`
  137. udev_read_db(ntpd_t)
  138. ')