Skip to contentSkip to conversation

ntp: fix the drift file context and transition

PATCH New Guido Trentalancia 2 participants 2 messages May 25, 2017 – May 26, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ntp: fix the drift file context and transition

Fix the ntp module by adding a new file context for the default location of the drift file (frequency of the local clock oscillator) and by adding the appropriate file transition interface call.

Otherwise, the drift file cannot be created and the following error message is generated:

frequency file /etc/ntp.drift.TEMP: Permission denied

---
 policy/modules/contrib/ntp.fc |    1 +
 policy/modules/contrib/ntp.te |    1 +
 2 files changed, 2 insertions(+)
policy/modules/contrib/ntp.fc +1 -0
@@ -3,6 +3,7 @@
 /etc/cron\.(daily|weekly)/ntp-server	--	gen_context(system_u:object_r:ntpd_exec_t,s0)
 
 /etc/ntp\.conf				--	gen_context(system_u:object_r:ntp_conf_t,s0)
+/etc/ntp\.drift				--	gen_context(system_u:object_r:ntp_drift_t,s0)
 /etc/ntpd.*\.conf.*			--	gen_context(system_u:object_r:ntp_conf_t,s0)
 /etc/ntp/crypto(/.*)?				gen_context(system_u:object_r:ntpd_key_t,s0)
 /etc/ntp/data(/.*)?				gen_context(system_u:object_r:ntp_drift_t,s0)
policy/modules/contrib/ntp.te +1 -0
@@ -65,6 +65,7 @@ allow ntpd_t ntp_conf_t:file read_file_p
 
 manage_dirs_pattern(ntpd_t, ntp_drift_t, ntp_drift_t)
 manage_files_pattern(ntpd_t, ntp_drift_t, ntp_drift_t)
+files_etc_filetrans(ntpd_t, ntp_drift_t, file)
 files_var_filetrans(ntpd_t, ntp_drift_t, file)
 
 read_files_pattern(ntpd_t, ntpd_key_t, ntpd_key_t)
#1 lore raw

PATCH 1/1 ntp: fix the drift file context and transition

Quoted 28 lines · Guido Trentalancia via refpolicy

Fix the ntp module by adding a new file context for the default location of the drift file (frequency of the local clock oscillator) and by adding the appropriate file transition interface call.

Otherwise, the drift file cannot be created and the following error message is generated:

frequency file /etc/ntp.drift.TEMP: Permission denied

---
 policy/modules/contrib/ntp.fc |    1 +
 policy/modules/contrib/ntp.te |    1 +
 2 files changed, 2 insertions(+)
policy/modules/contrib/ntp.fc +1 -0
@@ -3,6 +3,7 @@
 /etc/cron\.(daily|weekly)/ntp-server	--	gen_context(system_u:object_r:ntpd_exec_t,s0)
 
 /etc/ntp\.conf				--	gen_context(system_u:object_r:ntp_conf_t,s0)
+/etc/ntp\.drift				--	gen_context(system_u:object_r:ntp_drift_t,s0)
 /etc/ntpd.*\.conf.*			--	gen_context(system_u:object_r:ntp_conf_t,s0)
 /etc/ntp/crypto(/.*)?				gen_context(system_u:object_r:ntpd_key_t,s0)
 /etc/ntp/data(/.*)?				gen_context(system_u:object_r:ntp_drift_t,s0)

policy/modules/contrib/ntp.te allow ntpd_t ntp_conf_t:file read_file_p · line 71

Quoted 7 lines
policy/modules/contrib/ntp.te +1 -0
@@ -65,6 +65,7 @@ allow ntpd_t ntp_conf_t:file read_file_p
 
 manage_dirs_pattern(ntpd_t, ntp_drift_t, ntp_drift_t)
 manage_files_pattern(ntpd_t, ntp_drift_t, ntp_drift_t)
+files_etc_filetrans(ntpd_t, ntp_drift_t, file)
 files_var_filetrans(ntpd_t, ntp_drift_t, file)
 
 read_files_pattern(ntpd_t, ntpd_key_t, ntpd_key_t)

Merged.

Signature · 1 line
Chris PeBenito