|
Chris PeBenito |
0fbfa5 |
#DESC Amavis - Anti-virus
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Author: Brian May <bam@snoopy.apana.org.au>
|
|
Chris PeBenito |
0fbfa5 |
# X-Debian-Packages: amavis-ng amavisd-new amavisd-new-milter amavisd-new-milter-helper
|
|
Chris PeBenito |
0fbfa5 |
# Depends: clamav.te
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
#################################
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Rules for the amavisd_t domain.
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
type amavisd_etc_t, file_type, sysadmfile;
|
|
Chris PeBenito |
0fbfa5 |
type amavisd_lib_t, file_type, sysadmfile;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
2705f9 |
# Virus and spam found and quarantined.
|
|
Chris PeBenito |
2705f9 |
type amavisd_quarantine_t, file_type, sysadmfile, tmpfile;
|
|
Chris PeBenito |
2705f9 |
|
|
Chris PeBenito |
0fbfa5 |
daemon_domain(amavisd)
|
|
Chris PeBenito |
0fbfa5 |
tmp_domain(amavisd)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
2705f9 |
allow initrc_t amavisd_etc_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
allow initrc_t amavisd_lib_t:dir { search read write rmdir remove_name unlink };
|
|
Chris PeBenito |
0fbfa5 |
allow initrc_t amavisd_lib_t:file unlink;
|
|
Chris PeBenito |
0fbfa5 |
allow initrc_t amavisd_var_run_t:dir setattr;
|
|
Chris PeBenito |
0fbfa5 |
allow amavisd_t self:capability { chown dac_override setgid setuid };
|
|
Chris PeBenito |
0fbfa5 |
dontaudit amavisd_t self:capability sys_tty_config;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow amavisd_t usr_t:{ file lnk_file } { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
dontaudit amavisd_t usr_t:file ioctl;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# networking
|
|
Chris PeBenito |
2705f9 |
can_network_server_tcp(amavisd_t, amavisd_recv_port_t)
|
|
Chris PeBenito |
2705f9 |
allow amavisd_t amavisd_recv_port_t:tcp_socket name_bind;
|
|
Chris PeBenito |
2705f9 |
allow mta_delivery_agent amavisd_recv_port_t:tcp_socket name_connect;
|
|
Chris PeBenito |
2705f9 |
# The next line doesn't work right so drop the port specification.
|
|
Chris PeBenito |
2705f9 |
#can_network_client_tcp(amavisd_t, amavisd_send_port_t)
|
|
Chris PeBenito |
2705f9 |
can_network_client_tcp(amavisd_t)
|
|
Chris PeBenito |
2705f9 |
allow amavisd_t amavisd_send_port_t:tcp_socket name_connect;
|
|
Chris PeBenito |
2705f9 |
can_resolve(amavisd_t);
|
|
Chris PeBenito |
0fbfa5 |
can_ypbind(amavisd_t);
|
|
Chris PeBenito |
0fbfa5 |
can_tcp_connect(mail_server_sender, amavisd_t);
|
|
Chris PeBenito |
0fbfa5 |
can_tcp_connect(amavisd_t, mail_server_domain)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`scannerdaemon.te', `
|
|
Chris PeBenito |
0fbfa5 |
can_tcp_connect(amavisd_t, scannerdaemon_t);
|
|
Chris PeBenito |
0fbfa5 |
allow scannerdaemon_t amavisd_lib_t:dir r_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow scannerdaemon_t amavisd_lib_t:file r_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`clamav.te', `
|
|
Chris PeBenito |
0fbfa5 |
clamscan_domain(amavisd)
|
|
Chris PeBenito |
0fbfa5 |
role system_r types amavisd_clamscan_t;
|
|
Chris PeBenito |
0fbfa5 |
domain_auto_trans(amavisd_t, clamscan_exec_t, amavisd_clamscan_t)
|
|
Chris PeBenito |
0fbfa5 |
allow amavisd_clamscan_t amavisd_lib_t:dir r_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow amavisd_clamscan_t amavisd_lib_t:file r_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
can_clamd_connect(amavisd)
|
|
Chris PeBenito |
0fbfa5 |
allow clamd_t amavisd_lib_t:dir r_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow clamd_t amavisd_lib_t:file r_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
2705f9 |
# DCC
|
|
Chris PeBenito |
2705f9 |
ifdef(`dcc.te', `
|
|
Chris PeBenito |
2705f9 |
allow dcc_client_t amavisd_lib_t:file r_file_perms;
|
|
Chris PeBenito |
2705f9 |
')
|
|
Chris PeBenito |
2705f9 |
|
|
Chris PeBenito |
2705f9 |
# Pyzor
|
|
Chris PeBenito |
2705f9 |
ifdef(`pyzor.te',`
|
|
Chris PeBenito |
2705f9 |
domain_auto_trans(amavisd_t, pyzor_exec_t, pyzor_t)
|
|
Chris PeBenito |
2705f9 |
#allow pyzor_t amavisd_data_t:dir search;
|
|
Chris PeBenito |
2705f9 |
# Pyzor creates a temp file adjacent to the working file.
|
|
Chris PeBenito |
2705f9 |
create_dir_file(pyzor_t, amavisd_lib_t);
|
|
Chris PeBenito |
2705f9 |
')
|
|
Chris PeBenito |
2705f9 |
|
|
Chris PeBenito |
2705f9 |
# SpamAssassin is executed from within amavisd, but needs to read its
|
|
Chris PeBenito |
2705f9 |
# config
|
|
Chris PeBenito |
2705f9 |
ifdef(`spamd.te', `
|
|
Chris PeBenito |
2705f9 |
r_dir_file(amavisd_t, etc_mail_t)
|
|
Chris PeBenito |
2705f9 |
')
|
|
Chris PeBenito |
2705f9 |
|
|
Chris PeBenito |
0fbfa5 |
# Can create unix sockets
|
|
Chris PeBenito |
0fbfa5 |
allow amavisd_t self:unix_stream_socket create_stream_socket_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow amavisd_t self:unix_dgram_socket create_socket_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow amavisd_t self:fifo_file getattr;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
read_locale(amavisd_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Access config files (amavisd).
|
|
Chris PeBenito |
0fbfa5 |
allow amavisd_t amavisd_etc_t:file r_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
log_domain(amavisd)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Access amavisd var/lib files.
|
|
Chris PeBenito |
0fbfa5 |
create_dir_file(amavisd_t, amavisd_lib_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
2705f9 |
# Access amavisd quarantined files.
|
|
Chris PeBenito |
2705f9 |
create_dir_file(amavisd_t, amavisd_quarantine_t)
|
|
Chris PeBenito |
2705f9 |
|
|
Chris PeBenito |
0fbfa5 |
# Run helper programs.
|
|
Chris PeBenito |
0fbfa5 |
can_exec_any(amavisd_t,bin_t)
|
|
Chris PeBenito |
0fbfa5 |
allow amavisd_t bin_t:dir { getattr search };
|
|
Chris PeBenito |
0fbfa5 |
allow amavisd_t sbin_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow amavisd_t var_lib_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# allow access to files for scanning (required for amavis):
|
|
Chris PeBenito |
0fbfa5 |
allow clamd_t self:capability { dac_override dac_read_search };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# unknown stuff
|
|
Chris PeBenito |
0fbfa5 |
allow amavisd_t self:fifo_file { ioctl read write };
|
|
Chris PeBenito |
0fbfa5 |
allow amavisd_t { random_device_t urandom_device_t }:chr_file read;
|
|
Chris PeBenito |
0fbfa5 |
allow amavisd_t proc_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
allow amavisd_t etc_runtime_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# broken stuff
|
|
Chris PeBenito |
0fbfa5 |
dontaudit amavisd_t sysadm_home_dir_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
dontaudit amavisd_t shadow_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
dontaudit amavisd_t sysadm_devpts_t:chr_file { read write };
|
|
Chris PeBenito |
2705f9 |
|