From: guido@trentalancia.net (Guido Trentalancia) Date: Sun, 14 Aug 2016 00:03:16 +0200 (CEST) Subject: [refpolicy] [PATCH v5] Update the dhcp client and ifconfig parts of the sysnetwork module In-Reply-To: <1471095869.21480.17.camel@trentalancia.net> References: <1470694327.13546.1.camel@trentalancia.net> <1470762337.7062.1.camel@trentalancia.net> <1471095487.21480.15.camel@trentalancia.net> <1471095869.21480.17.camel@trentalancia.net> Message-ID: <557137276.942733.1471125796170.JavaMail.open-xchange@popper02.register.it> To: refpolicy@oss.tresys.com List-Id: refpolicy.oss.tresys.com Update the sysnetwork module to add some permissions needed by the dhcp client and ifconfig. Create auxiliary interfaces in the ntp 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. Include revisions from Chris PeBenito. Signed-off-by: Guido Trentalancia --- policy/modules/contrib/ntp.if | 19 +++++++++++++++++++ policy/modules/system/sysnetwork.te | 13 ++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) --- refpolicy-git-06082016-orig/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-orig/policy/modules/system/sysnetwork.te 2016-08-06 21:26:43.309774442 +0200 +++ refpolicy-git-06082016/policy/modules/system/sysnetwork.te 2016-08-13 23:38:42.816761522 +0200 @@ -50,7 +50,7 @@ ifdef(`distro_debian',` allow dhcpc_t self:capability { dac_override fsetid net_admin net_raw net_bind_service setpcap sys_nice sys_resource sys_tty_config }; dontaudit dhcpc_t self:capability { sys_tty_config sys_ptrace }; # for access("/etc/bashrc", X_OK) on Red Hat -dontaudit dhcpc_t self:capability { dac_read_search sys_module }; +dontaudit dhcpc_t self:capability { dac_read_search }; allow dhcpc_t self:process { getsched getcap setcap setfscreate ptrace signal_perms }; allow dhcpc_t self:fifo_file rw_fifo_file_perms; @@ -77,13 +77,20 @@ files_pid_filetrans(dhcpc_t, dhcpc_var_r sysnet_manage_config(dhcpc_t) files_etc_filetrans(dhcpc_t, net_conf_t, file) +# manage files in /var +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) kernel_read_system_state(dhcpc_t) kernel_read_network_state(dhcpc_t) kernel_search_network_sysctl(dhcpc_t) @@ -225,6 +232,7 @@ optional_policy(` optional_policy(` ntp_initrc_domtrans(dhcpc_t) ntp_read_drift_files(dhcpc_t) + ntp_read_conf_files(dhcpc_t) ') optional_policy(`