Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Pyzor - Pyzor is a collaborative, networked system to detect and
Chris PeBenito ab58ad
#         block spam using identifying digests of messages.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Author:  David Hampton <hampton@employees.org>
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
Chris PeBenito ab58ad
##########
Chris PeBenito ab58ad
# common definitions for pyzord and all flavors of pyzor
Chris PeBenito ab58ad
##########
Chris PeBenito ab58ad
define(`pyzor_base_domain',`
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Networking
Chris PeBenito ab58ad
can_network_client_tcp($1_t, http_port_t);
Chris PeBenito ab58ad
can_network_udp($1_t, pyzor_port_t);
Chris PeBenito ab58ad
can_resolve($1_t);
Chris PeBenito ab58ad
Chris PeBenito ab58ad
general_proc_read_access($1_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
tmp_domain($1)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow $1_t bin_t:dir { getattr search };
Chris PeBenito ab58ad
allow $1_t bin_t:file getattr;
Chris PeBenito ab58ad
allow $1_t lib_t:file { getattr read };
Chris PeBenito ab58ad
allow $1_t { var_t var_lib_t var_run_t }:dir search;
Chris PeBenito ab58ad
uses_shlib($1_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Python does a getattr on this file
Chris PeBenito ab58ad
allow $1_t pyzor_exec_t:file getattr;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# mktemp and other randoms
Chris PeBenito ab58ad
allow $1_t { random_device_t urandom_device_t }:chr_file r_file_perms;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Allow access to various files in the /etc/directory including mtab
Chris PeBenito ab58ad
# and nsswitch
Chris PeBenito ab58ad
allow $1_t { etc_t etc_runtime_t }:file { getattr read };
Chris PeBenito ab58ad
read_locale($1_t)
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Define a user domain for a pyzor
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Note: expects to be called with an argument of user, sysadm
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`pyzor_domain',`
Chris PeBenito ab58ad
type $1_pyzor_t, domain, privlog, nscd_client_domain;
Chris PeBenito ab58ad
role $1_r types $1_pyzor_t;
Chris PeBenito ab58ad
domain_auto_trans($1_t, pyzor_exec_t, $1_pyzor_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
pyzor_base_domain($1_pyzor)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Per-user config/data files
Chris PeBenito ab58ad
home_domain($1, pyzor)
Chris PeBenito ab58ad
file_type_auto_trans($1_pyzor_t, $1_home_dir_t, $1_pyzor_home_t, dir)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# System config files
Chris PeBenito ab58ad
r_dir_file($1_pyzor_t, pyzor_etc_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# System data files
Chris PeBenito ab58ad
r_dir_file($1_pyzor_t, pyzor_var_lib_t);
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow $1_pyzor_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Allow pyzor to be run by hand.  Needed by any action other than
Chris PeBenito ab58ad
# invocation from a spam filter.
Chris PeBenito ab58ad
can_access_pty($1_pyzor_t, $1)
Chris PeBenito ab58ad
allow $1_pyzor_t sshd_t:fd use;
Chris PeBenito ab58ad
')