Add interfaces to run freshclam

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>
This commit is contained in:
Sugar, David 2019-02-25 23:37:45 +00:00 committed by Chris PeBenito
parent 899520233d
commit c418d0e81d
1 changed files with 64 additions and 0 deletions

View File

@ -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