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] Add interfaces to run freshclam
Date: Mon, 25 Feb 2019 23:37:45 +0000	[thread overview]
Message-ID: <20190225233708.15319-2-dsugar@tresys.com> (raw)
In-Reply-To: <20190225233708.15319-1-dsugar@tresys.com>

Currently freshclam can only be started from cron or init.  This adds
the option of starting from a different process and optionally 
transitioning or staying in the callers domain.

Signed-off-by: Dave Sugar <dsugar@tresys.com>
---
 policy/modules/services/clamav.if | 64 +++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/policy/modules/services/clamav.if b/policy/modules/services/clamav.if
index 0dc1e23c..30d0b814 100644
--- a/policy/modules/services/clamav.if
+++ b/policy/modules/services/clamav.if
@@ -251,6 +251,70 @@ interface(`clamav_scannable_files',`
 	typeattribute $1 clam_scannable_type;
 ')
 
+########################################
+## <summary>
+##	Execute a domain transition to run freshclam.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed to transition.
+##	</summary>
+## </param>
+#
+interface(`clamav_domtrans_freshclam',`
+	gen_require(`
+		type freshclam_t, freshclam_exec_t;
+	')
+
+	corecmd_search_bin($1)
+	domtrans_pattern($1, freshclam_exec_t, freshclam_t)
+')
+
+########################################
+## <summary>
+##	Execute freshclam in the freshclam domain, and
+##	allow the specified role the freshclam domain.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed to transition.
+##	</summary>
+## </param>
+## <param name="role">
+##	<summary>
+##	Role allowed access.
+##	</summary>
+## </param>
+## <rolecap/>
+#
+interface(`clamav_run_freshclam',`
+	gen_require(`
+		type freshclam_t;
+	')
+
+	clamav_domtrans_freshclam($1)
+	role $2 types freshclam_t;
+')
+
+########################################
+## <summary>
+##	Execute freshclam in the caller domain.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`clamav_exec_freshclam',`
+	gen_require(`
+		type freshclam_exec_t;
+	')
+
+	corecmd_search_bin($1)
+	can_exec($1, freshclam_exec_t)
+')
+
 ########################################
 ## <summary>
 ##	Allow specified domain to enable clamd units
-- 
2.20.1


  parent reply	other threads:[~2019-02-25 23:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-25 23:37 [PATCH] Fix incorrect type in clamav_enableddisable_clamd interface Sugar, David
2019-02-25 23:37 ` [PATCH] Allow freshclam to read sysctl_crypto_t Sugar, David
2019-02-27  3:22   ` Chris PeBenito
2019-02-25 23:37 ` Sugar, David [this message]
2019-02-27  3:22   ` [PATCH] Add interfaces to run freshclam Chris PeBenito
2019-02-25 23:37 ` [PATCH] Allow AIDE to sendto kernel datagram socket Sugar, David
2019-02-26  6:52   ` Dominick Grift
2019-02-26 12:28     ` Sugar, David
2019-02-26 12:32       ` Dominick Grift
2019-02-27  3:21   ` Chris PeBenito
2019-02-25 23:37 ` [PATCH] Allow AIDE to mmap files Sugar, David
2019-02-27  3:22   ` Chris PeBenito
2019-02-25 23:37 ` [PATCH] Allow AIDE to read kernel sysctl_crypto_t Sugar, David
2019-02-27  3:22   ` Chris PeBenito
2019-02-27  3:23 ` [PATCH] Fix incorrect type in clamav_enableddisable_clamd interface Chris PeBenito

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=20190225233708.15319-2-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).