Blob Blame History Raw
policy_module(psad, 1.0.0) 

########################################
#
# Declarations
#

type psad_t;
type psad_exec_t;
init_daemon_domain(psad_t, psad_exec_t)

# config files
type psad_etc_t;
files_type(psad_etc_t)

type psad_initrc_exec_t;
init_script_file(psad_initrc_exec_t)

# var/lib files
type psad_var_lib_t;
files_type(psad_var_lib_t)

# log files
type psad_var_log_t;
logging_log_file(psad_var_log_t)

# pid files
type psad_var_run_t;
files_pid_file(psad_var_run_t)

# tmp files
type psad_tmp_t;
files_tmp_file(psad_tmp_t)

########################################
#
# psad local policy
#

allow psad_t self:capability { net_admin net_raw setuid setgid dac_override };
dontaudit psad_t self:capability sys_tty_config;
allow psad_t self:process signull;
allow psad_t self:fifo_file rw_fifo_file_perms;
allow psad_t self:rawip_socket create_socket_perms;

# config files
read_files_pattern(psad_t, psad_etc_t, psad_etc_t)
list_dirs_pattern(psad_t, psad_etc_t, psad_etc_t)

# log files
manage_files_pattern(psad_t, psad_var_log_t, psad_var_log_t)
manage_dirs_pattern(psad_t, psad_var_log_t, psad_var_log_t)
logging_log_filetrans(psad_t, psad_var_log_t, { file dir })

# pid file
manage_files_pattern(psad_t, psad_var_run_t, psad_var_run_t)
manage_sock_files_pattern(psad_t, psad_var_run_t, psad_var_run_t)
files_pid_filetrans(psad_t, psad_var_run_t, { file sock_file })

# tmp files
manage_dirs_pattern(psad_t, psad_tmp_t, psad_tmp_t)
manage_files_pattern(psad_t, psad_tmp_t, psad_tmp_t)
files_tmp_filetrans(psad_t, psad_tmp_t, { file dir })

# /var/lib files
search_dirs_pattern(psad_t, psad_var_lib_t, psad_var_lib_t)
manage_fifo_files_pattern(psad_t, psad_var_lib_t, psad_var_lib_t)

kernel_read_system_state(psad_t)
kernel_read_network_state(psad_t)
kernel_read_net_sysctls(psad_t)

corecmd_exec_shell(psad_t)
corecmd_exec_bin(psad_t)

corenet_all_recvfrom_unlabeled(psad_t)
corenet_all_recvfrom_netlabel(psad_t)
corenet_tcp_sendrecv_generic_if(psad_t)
corenet_tcp_sendrecv_generic_node(psad_t)
corenet_tcp_bind_generic_node(psad_t)
corenet_tcp_sendrecv_all_ports(psad_t)
corenet_tcp_connect_whois_port(psad_t)
corenet_sendrecv_whois_client_packets(psad_t)

dev_read_urand(psad_t)

files_read_etc_runtime_files(psad_t)

fs_getattr_all_fs(psad_t)

auth_use_nsswitch(psad_t)

iptables_domtrans(psad_t)

logging_read_generic_logs(psad_t)
logging_read_syslog_config(psad_t)
logging_send_syslog_msg(psad_t)

miscfiles_read_localization(psad_t)

sysnet_exec_ifconfig(psad_t)

optional_policy(`
	mta_send_mail(psad_t)
	mta_read_queue(psad_t)
')