selinux-refpolicy.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Sugar, David" <dsugar@tresys.com>
To: "selinux-refpolicy@vger.kernel.org"  <selinux-refpolicy@vger.kernel.org>
Subject: [PATCH] Alternate ClamAV temp directory
Date: Fri, 11 Jan 2019 15:30:52 +0000	[thread overview]
Message-ID: <20190111153011.27275-3-dsugar@tresys.com> (raw)
In-Reply-To: <20190111153011.27275-1-dsugar@tresys.com>

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.

Signed-off-by: Dave Sugar <dsugar@tresys.com>
---
 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;
 ')
 
+#######################################
+## <summary>
+##	Denote a particular directory type to
+##	be a temporary working directory for ClamAV
+## </summary>
+## <desc>
+##	<p>
+##	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.
+##	</p>
+## </desc>
+## <param name="domain">
+##	<summary>
+##	Type of directory to hold clamd temp files.
+##	</summary>
+## </param>
+#
+interface(`clamav_temp_dir',`
+	gen_require(`
+		attribute clam_tmp_type;
+	')
+
+	typeattribute $1 clam_tmp_type;
+')
+
+
 ########################################
 ## <summary>
 ##	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)
-- 
2.20.1


  parent reply	other threads:[~2019-01-11 15:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-11 15:30 [PATCH] Add interface to create unit files with specified type via filetrans Sugar, David
2019-01-11 15:30 ` [PATCH] Add interface to start/stop iptables service Sugar, David
2019-01-12 19:32   ` Chris PeBenito
2019-01-11 15:30 ` Sugar, David [this message]
2019-01-12 19:34   ` [PATCH] Alternate ClamAV temp directory Chris PeBenito
2019-01-15 21:31     ` Sugar, David
2019-01-11 15:30 ` [PATCH 1/2] Interface with systemd_hostnamed over dbus to set hostname Sugar, David
2019-01-11 15:30 ` [PATCH 2/2] Setup private type for /etc/hostname Sugar, David
2019-01-12  1:11   ` Russell Coker
2019-01-12  3:49     ` Sugar, David
2019-01-12 19:30 ` [PATCH] Add interface to create unit files with specified type via filetrans Chris PeBenito
2019-01-15 21:27   ` Sugar, David

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190111153011.27275-3-dsugar@tresys.com \
    --to=dsugar@tresys.com \
    --cc=selinux-refpolicy@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).