2018-06-23 13:00:56 +00:00
|
|
|
## <summary>Intrusion Detection and Log Analysis with iptables.</summary>
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Execute a domain transition to run psad.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed to transition.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`psad_domtrans',`
|
|
|
|
gen_require(`
|
|
|
|
type psad_t, psad_exec_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
corecmd_search_bin($1)
|
|
|
|
domtrans_pattern($1, psad_exec_t, psad_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Send generic signals to psad.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`psad_signal',`
|
|
|
|
gen_require(`
|
|
|
|
type psad_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
allow $1 psad_t:process signal;
|
|
|
|
')
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
## <summary>
|
|
|
|
## Send null signals to psad.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`psad_signull',`
|
|
|
|
gen_require(`
|
|
|
|
type psad_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
allow $1 psad_t:process signull;
|
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Read psad configuration content.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`psad_read_config',`
|
|
|
|
gen_require(`
|
|
|
|
type psad_etc_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
files_search_etc($1)
|
|
|
|
allow $1 psad_etc_t:dir list_dir_perms;
|
|
|
|
allow $1 psad_etc_t:file read_file_perms;
|
|
|
|
allow $1 psad_etc_t:lnk_file read_lnk_file_perms;
|
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Create, read, write, and delete
|
|
|
|
## psad configuration content.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`psad_manage_config',`
|
|
|
|
gen_require(`
|
|
|
|
type psad_etc_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
files_search_etc($1)
|
|
|
|
allow $1 psad_etc_t:dir manage_dir_perms;
|
|
|
|
allow $1 psad_etc_t:file manage_file_perms;
|
|
|
|
allow $1 psad_etc_t:lnk_file manage_lnk_file_perms;
|
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Read psad pid files.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`psad_read_pid_files',`
|
|
|
|
gen_require(`
|
2019-09-08 20:55:02 +00:00
|
|
|
type psad_runtime_t;
|
2018-06-23 13:00:56 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
files_search_pids($1)
|
2019-09-08 20:55:02 +00:00
|
|
|
read_files_pattern($1, psad_runtime_t, psad_runtime_t)
|
2018-06-23 13:00:56 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Read and write psad pid files.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`psad_rw_pid_files',`
|
|
|
|
gen_require(`
|
2019-09-08 20:55:02 +00:00
|
|
|
type psad_runtime_t;
|
2018-06-23 13:00:56 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
files_search_pids($1)
|
2019-09-08 20:55:02 +00:00
|
|
|
rw_files_pattern($1, psad_runtime_t, psad_runtime_t)
|
2018-06-23 13:00:56 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Read psad log content.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
## <rolecap/>
|
|
|
|
#
|
|
|
|
interface(`psad_read_log',`
|
|
|
|
gen_require(`
|
|
|
|
type psad_var_log_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
logging_search_logs($1)
|
|
|
|
allow $1 psad_var_log_t:dir list_dir_perms;
|
|
|
|
allow $1 psad_var_log_t:file read_file_perms;
|
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Append psad log files.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
## <rolecap/>
|
|
|
|
#
|
|
|
|
interface(`psad_append_log',`
|
|
|
|
gen_require(`
|
|
|
|
type psad_var_log_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
logging_search_logs($1)
|
|
|
|
append_files_pattern($1, psad_var_log_t, psad_var_log_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Read and write psad fifo files.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`psad_rw_fifo_file',`
|
|
|
|
gen_require(`
|
|
|
|
type psad_var_lib_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
files_search_var_lib($1)
|
|
|
|
rw_fifo_files_pattern($1, psad_var_lib_t, psad_var_lib_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
## <summary>
|
|
|
|
## Read and write psad temporary files.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`psad_rw_tmp_files',`
|
|
|
|
gen_require(`
|
|
|
|
type psad_tmp_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
files_search_tmp($1)
|
|
|
|
rw_files_pattern($1, psad_tmp_t, psad_tmp_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## All of the rules required to
|
|
|
|
## administrate an psad environment.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
## <param name="role">
|
|
|
|
## <summary>
|
|
|
|
## Role allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
## <rolecap/>
|
|
|
|
#
|
|
|
|
interface(`psad_admin',`
|
|
|
|
gen_require(`
|
2019-09-08 20:55:02 +00:00
|
|
|
type psad_t, psad_runtime_t, psad_var_log_t;
|
2018-06-23 13:00:56 +00:00
|
|
|
type psad_initrc_exec_t, psad_var_lib_t;
|
|
|
|
type psad_tmp_t, psad_etc_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
allow $1 psad_t:process { ptrace signal_perms };
|
|
|
|
ps_process_pattern($1, psad_t)
|
|
|
|
|
|
|
|
init_startstop_service($1, $2, psad_t, psad_initrc_exec_t)
|
|
|
|
|
|
|
|
files_search_etc($1)
|
|
|
|
admin_pattern($1, psad_etc_t)
|
|
|
|
|
|
|
|
files_search_pids($1)
|
2019-09-08 20:55:02 +00:00
|
|
|
admin_pattern($1, psad_runtime_t)
|
2018-06-23 13:00:56 +00:00
|
|
|
|
|
|
|
logging_search_logs($1)
|
|
|
|
admin_pattern($1, psad_var_log_t)
|
|
|
|
|
|
|
|
files_search_var_lib($1)
|
|
|
|
admin_pattern($1, psad_var_lib_t)
|
|
|
|
|
|
|
|
files_search_tmp($1)
|
|
|
|
admin_pattern($1, psad_tmp_t)
|
|
|
|
')
|