Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.7 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26E5BC43387 for ; Sat, 12 Jan 2019 20:04:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ECA5120836 for ; Sat, 12 Jan 2019 20:04:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ieee.org header.i=@ieee.org header.b="VNEvQLSd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726542AbfALUEw (ORCPT ); Sat, 12 Jan 2019 15:04:52 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:40989 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725876AbfALUEw (ORCPT ); Sat, 12 Jan 2019 15:04:52 -0500 Received: by mail-qk1-f193.google.com with SMTP id 189so8507655qkj.8 for ; Sat, 12 Jan 2019 12:04:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ieee.org; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=dU7PWgEP61g8Wu7zNWpGS5y6Y5fcieh4gz5SGy3S4EM=; b=VNEvQLSdizAfoku/ZnXjopHlip186YHFwqAD3gJ1OVOYXzBK6gmu0eCbu4F/WQpuxi icIURTYaVLURsqiU9N5ZiihneIVbB8WD67OLmNMu9L5Pv8DGdDHsr791vDTY8M8op+n/ RosyH3/prYTjBcro8jyytjesATMOSBQQYeEzc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=dU7PWgEP61g8Wu7zNWpGS5y6Y5fcieh4gz5SGy3S4EM=; b=KrjA44YhGZL3T5fGqi28IVObS30HFMYk8kNYXJyluFi23I9c1xu1sQWjpYH4tHQlv8 R24VBeiCTfQfjYaduIt59sozNoTaaMRu32wKMQfrS1Bs3wSIBT3Chf3xnJXNg/wFYgIm PzwsPhZQW2VVB0xjLyD4OOBU5DzVZcY8f7Dul+EWpemH+auj5q3Cgjxzk+fgOvYLRL/X EaLJX8FCVoCTm1pBNCqAu19CA11zXPsW2e8RFzFBRHOIs+KPex6ODmDvNkw+ySco6l5j xMRME4d7sIDbJseXw9sVs4k5HeBm10ROrHWDi6oouF/OhxT3qi2/K4DXpaekf4MozeFh ihdQ== X-Gm-Message-State: AJcUukc+SvN4NrE4M1dQwwnIcq2Z4Xe+bJlUZLO59Kt17UjUo1OdRXhx ViqKGSHpgdZCfTyf0T1YPOmX77f9GOY= X-Google-Smtp-Source: ALg8bN5kfdmZPZybM4aVhDtJLFfjnQ9BzQNcOUKSmgg0VtLrrpIMg58hCLF8ea6iA85v0g+6jkWTMg== X-Received: by 2002:a37:3692:: with SMTP id d140mr17083167qka.108.1547323491013; Sat, 12 Jan 2019 12:04:51 -0800 (PST) Received: from [192.168.1.190] (pool-108-15-23-247.bltmmd.fios.verizon.net. [108.15.23.247]) by smtp.gmail.com with ESMTPSA id i26sm34244009qkg.12.2019.01.12.12.04.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Jan 2019 12:04:50 -0800 (PST) Subject: Re: [PATCH] Alternate ClamAV temp directory To: "Sugar, David" , "selinux-refpolicy@vger.kernel.org" References: <20190111153011.27275-1-dsugar@tresys.com> <20190111153011.27275-3-dsugar@tresys.com> From: Chris PeBenito Message-ID: <95c3514b-651c-17e4-9838-f8fff9b7692f@ieee.org> Date: Sat, 12 Jan 2019 14:34:27 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <20190111153011.27275-3-dsugar@tresys.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org On 1/11/19 10:30 AM, Sugar, David wrote: > ClamAV configuration controls where temporary files are stored. > Default is /tmp but the configuration option 'TemporaryDirectory' > allows for this location to be changed. This change allows for > the type of this directory to be something other than 'tmp_t' > and have files created in this directory still be clamd_tmp_t. In this case, it would seem to be more appropriate to simply label this alternative tmp directory as clamd_tmp_t. > Signed-off-by: Dave Sugar > --- > policy/modules/services/clamav.if | 29 +++++++++++++++++++++++++++++ > policy/modules/services/clamav.te | 2 ++ > 2 files changed, 31 insertions(+) > > diff --git a/policy/modules/services/clamav.if b/policy/modules/services/clamav.if > index 7b6df49e..a8d1603c 100644 > --- a/policy/modules/services/clamav.if > +++ b/policy/modules/services/clamav.if > @@ -225,6 +225,35 @@ interface(`clamav_scannable_files',` > typeattribute $1 clam_scannable_type; > ') > > +####################################### > +## > +## Denote a particular directory type to > +## be a temporary working directory for ClamAV > +## > +## > +##

> +## Allow the specified domain to be a directory to be > +## used by ClamAV for temp files. This is only needed > +## if the TemporaryDirectory in the clamd.conf is > +## modified to point to a directory that is not already > +## labeled tmp_t. > +##

> +##
> +## > +## > +## Type of directory to hold clamd temp files. > +## > +## > +# > +interface(`clamav_temp_dir',` > + gen_require(` > + attribute clam_tmp_type; > + ') > + > + typeattribute $1 clam_tmp_type; > +') > + > + > ######################################## > ## > ## Allow specified domain to enable clamd units > diff --git a/policy/modules/services/clamav.te b/policy/modules/services/clamav.te > index 84a0bc76..6fc9cc7e 100644 > --- a/policy/modules/services/clamav.te > +++ b/policy/modules/services/clamav.te > @@ -28,6 +28,7 @@ gen_tunable(clamd_use_jit, false) > # Declarations > # > attribute clam_scannable_type; > +attribute clam_tmp_type; > > type clamd_t; > type clamd_exec_t; > @@ -88,6 +89,7 @@ read_lnk_files_pattern(clamd_t, clamd_etc_t, clamd_etc_t) > manage_dirs_pattern(clamd_t, clamd_tmp_t, clamd_tmp_t) > manage_files_pattern(clamd_t, clamd_tmp_t, clamd_tmp_t) > files_tmp_filetrans(clamd_t, clamd_tmp_t, { file dir }) > +filetrans_pattern(clamd_t, clam_tmp_type, clamd_tmp_t, { file dir }) > > manage_dirs_pattern(clamd_t, clamd_var_lib_t, clamd_var_lib_t) > manage_files_pattern(clamd_t, clamd_var_lib_t, clamd_var_lib_t) > -- Chris PeBenito