From: dominick.grift@gmail.com (Dominick Grift) Date: Tue, 14 Aug 2012 15:28:17 +0200 Subject: [refpolicy] [PATCH v2 1/6] Introduce ntp_conf_t In-Reply-To: <1344950902-21516-1-git-send-email-dominick.grift@gmail.com> References: <1344950902-21516-1-git-send-email-dominick.grift@gmail.com> Message-ID: <1344950902-21516-2-git-send-email-dominick.grift@gmail.com> To: refpolicy@oss.tresys.com List-Id: refpolicy.oss.tresys.com Introduce ntp_conf_t config file type and use that instead of net_conf_t so that ntp_admin() does not need access to network configuration to be able to manage ntpd. Signed-off-by: Dominick Grift --- ntp.fc | 4 ++-- ntp.if | 4 ++-- ntp.te | 5 +++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ntp.fc b/ntp.fc index e79dccc..05fa48d 100644 --- a/ntp.fc +++ b/ntp.fc @@ -2,11 +2,11 @@ /etc/cron\.(daily|weekly)/ntp-simple -- gen_context(system_u:object_r:ntpd_exec_t,s0) /etc/cron\.(daily|weekly)/ntp-server -- gen_context(system_u:object_r:ntpd_exec_t,s0) -/etc/ntpd?\.conf.* -- gen_context(system_u:object_r:net_conf_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) /etc/ntp/keys -- gen_context(system_u:object_r:ntpd_key_t,s0) -/etc/ntp/step-tickers.* -- gen_context(system_u:object_r:net_conf_t,s0) +/etc/ntp/step-tickers.* -- gen_context(system_u:object_r:ntp_conf_t,s0) /etc/rc\.d/init\.d/ntpd -- gen_context(system_u:object_r:ntpd_initrc_exec_t,s0) diff --git a/ntp.if b/ntp.if index e80f8c0..d56b635 100644 --- a/ntp.if +++ b/ntp.if @@ -140,7 +140,7 @@ interface(`ntp_rw_shm',` interface(`ntp_admin',` gen_require(` type ntpd_t, ntpd_tmp_t, ntpd_log_t; - type ntpd_key_t, ntpd_var_run_t; + type ntpd_key_t, ntpd_var_run_t, ntp_conf_t; type ntpd_initrc_exec_t; ') @@ -152,7 +152,7 @@ interface(`ntp_admin',` role_transition $2 ntpd_initrc_exec_t system_r; allow $2 system_r; - admin_pattern($1, ntpd_key_t) + admin_pattern($1, { ntpd_key_t ntp_conf_t }) logging_list_logs($1) admin_pattern($1, ntpd_log_t) diff --git a/ntp.te b/ntp.te index c61adc8..08bcd96 100644 --- a/ntp.te +++ b/ntp.te @@ -15,6 +15,9 @@ init_daemon_domain(ntpd_t, ntpd_exec_t) type ntpd_initrc_exec_t; init_script_file(ntpd_initrc_exec_t) +type ntp_conf_t; +files_config_file(ntp_conf_t) + type ntpd_key_t; files_type(ntpd_key_t) @@ -54,6 +57,8 @@ manage_files_pattern(ntpd_t, ntp_drift_t, ntp_drift_t) can_exec(ntpd_t, ntpd_exec_t) +allow ntpd_t ntp_conf_t:file read_file_perms; + read_files_pattern(ntpd_t, ntpd_key_t, ntpd_key_t) read_lnk_files_pattern(ntpd_t, ntpd_key_t, ntpd_key_t) -- 1.7.11.2