|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Macros for clamscan
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Author: Brian May <bam@snoopy.apana.org.au>
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# can_clamd_connect(domain_prefix)
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Define a domain that can access clamd
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
define(`can_clamd_connect',`
|
|
Chris PeBenito |
0fbfa5 |
allow $1_t clamd_var_run_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow $1_t clamd_var_run_t:sock_file write;
|
|
Chris PeBenito |
2705f9 |
allow $1_t clamd_sock_t:sock_file write;
|
|
Chris PeBenito |
0fbfa5 |
can_unix_connect($1_t, clamd_t)
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# clamscan_domain(domain_prefix)
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Define a derived domain for the clamscan program when executed
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
define(`clamscan_domain', `
|
|
Chris PeBenito |
0fbfa5 |
# Derived domain based on the calling user domain and the program.
|
|
Chris PeBenito |
0fbfa5 |
type $1_clamscan_t, domain, privlog;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Uses shared librarys
|
|
Chris PeBenito |
0fbfa5 |
uses_shlib($1_clamscan_t)
|
|
Chris PeBenito |
0fbfa5 |
allow $1_clamscan_t fs_t:filesystem getattr;
|
|
Chris PeBenito |
0fbfa5 |
r_dir_file($1_clamscan_t, etc_t)
|
|
Chris PeBenito |
0fbfa5 |
read_locale($1_clamscan_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Access virus signatures
|
|
Chris PeBenito |
0fbfa5 |
allow $1_clamscan_t var_lib_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
r_dir_file($1_clamscan_t, clamav_var_lib_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Allow temp files
|
|
Chris PeBenito |
0fbfa5 |
tmp_domain($1_clamscan)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Why is this required?
|
|
Chris PeBenito |
0fbfa5 |
allow $1_clamscan_t proc_t:dir r_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow $1_clamscan_t proc_t:file r_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
read_sysctl($1_clamscan_t)
|
|
Chris PeBenito |
0fbfa5 |
allow $1_clamscan_t self:unix_stream_socket { connect create read write };
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
define(`user_clamscan_domain',`
|
|
Chris PeBenito |
0fbfa5 |
clamscan_domain($1)
|
|
Chris PeBenito |
0fbfa5 |
role $1_r types $1_clamscan_t;
|
|
Chris PeBenito |
0fbfa5 |
domain_auto_trans($1_t, clamscan_exec_t, $1_clamscan_t)
|
|
Chris PeBenito |
0fbfa5 |
access_terminal($1_clamscan_t, $1)
|
|
Chris PeBenito |
0fbfa5 |
r_dir_file($1_clamscan_t,$1_home_t);
|
|
Chris PeBenito |
0fbfa5 |
r_dir_file($1_clamscan_t,$1_home_dir_t);
|
|
Chris PeBenito |
0fbfa5 |
allow $1_clamscan_t $1_home_t:file r_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow $1_clamscan_t privfd:fd use;
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`gnome-pty-helper.te', `allow $1_clamscan_t $1_gph_t:fd use;')
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
|