From: guido@trentalancia.net (Guido Trentalancia) Date: Tue, 09 Aug 2016 19:05:37 +0200 Subject: [refpolicy] [PATCH v2] Update the dhcp client part of the sysnetwork module In-Reply-To: <1470694327.13546.1.camel@trentalancia.net> References: <1470694327.13546.1.camel@trentalancia.net> Message-ID: <1470762337.7062.1.camel@trentalancia.net> To: refpolicy@oss.tresys.com List-Id: refpolicy.oss.tresys.com Update the sysnetwork module to add some permissions needed by the dhcp client. Create auxiliary interfaces in the ntp module and in the kernel files module. The permission to execute restorecon/setfiles (required by the dhclient-script script and granted in a previous version of this patch) is not granted, as it does not break the script functioning. Signed-off-by: Guido Trentalancia --- policy/modules/contrib/ntp.if | 19 +++++++++++++++++++ policy/modules/kernel/files.if | 19 +++++++++++++++++++ policy/modules/system/sysnetwork.te | 8 ++++++++ 3 files changed, 46 insertions(+) --- refpolicy-git-06082016-orig2/policy/modules/kernel/files.if 2016-08-09 00:02:26.083934522 +0200 +++ refpolicy-git-06082016/policy/modules/kernel/files.if 2016-08-08 23:30:01.781638983 +0200 @@ -5348,6 +5348,25 @@ interface(`files_dontaudit_list_var',` ######################################## ## +## Add directory entries in the +## /var directory. +## +## +## +## Domain allowed access. +## +## +# +interface(`files_add_entry_var_dirs',` + gen_require(` + type var_t; + ') + + allow $1 var_t:dir add_entry_dir_perms; +') + +######################################## +## ## Create, read, write, and delete directories ## in the /var directory. ## --- refpolicy-git-06082016-orig2/policy/modules/contrib/ntp.if 2016-08-06 21:27:11.375094577 +0200 +++ refpolicy-git-06082016/policy/modules/contrib/ntp.if 2016-08-08 23:09:34.553877178 +0200 @@ -101,6 +101,25 @@ interface(`ntp_initrc_domtrans',` ######################################## ## +## Read ntp conf files. +## +## +## +## Domain allowed access. +## +## +# +interface(`ntp_read_conf_files',` + gen_require(` + type ntp_conf_t; + ') + + files_search_etc($1) + read_files_pattern($1, ntp_conf_t, ntp_conf_t) +') + +######################################## +## ## Read ntp drift files. ## ## --- refpolicy-git-06082016-orig2/policy/modules/system/sysnetwork.te 2016-08-09 00:02:35.257150332 +0200 +++ refpolicy-git-06082016/policy/modules/system/sysnetwork.te 2016-08-08 23:51:37.145701574 +0200 @@ -76,12 +79,20 @@ files_pid_filetrans(dhcpc_t, dhcpc_var_r # in /etc created by dhcpcd will be labelled net_conf_t. sysnet_manage_config(dhcpc_t) files_etc_filetrans(dhcpc_t, net_conf_t, file) +ntp_read_conf_files(dhcpc_t) + +# manage files in /var +files_add_entry_var_dirs(dhcpc_t) +files_manage_var_files(dhcpc_t) # create temp files manage_dirs_pattern(dhcpc_t, dhcpc_tmp_t, dhcpc_tmp_t) manage_files_pattern(dhcpc_t, dhcpc_tmp_t, dhcpc_tmp_t) files_tmp_filetrans(dhcpc_t, dhcpc_tmp_t, { file dir }) +# search cgroup directories +fs_search_cgroup_dirs(dhcpc_t) + can_exec(dhcpc_t, dhcpc_exec_t) kernel_load_module(dhcpc_t)