187 lines
3.7 KiB
Text
187 lines
3.7 KiB
Text
|
## <summary>Console network traffic monitor.</summary>
|
||
|
|
||
|
########################################
|
||
|
## <summary>
|
||
|
## Execute a domain transition to run vnstat.
|
||
|
## </summary>
|
||
|
## <param name="domain">
|
||
|
## <summary>
|
||
|
## Domain allowed to transition.
|
||
|
## </summary>
|
||
|
## </param>
|
||
|
#
|
||
|
interface(`vnstatd_domtrans_vnstat',`
|
||
|
gen_require(`
|
||
|
type vnstat_t, vnstat_exec_t;
|
||
|
')
|
||
|
|
||
|
corecmd_search_bin($1)
|
||
|
domtrans_pattern($1, vnstat_exec_t, vnstat_t)
|
||
|
')
|
||
|
|
||
|
########################################
|
||
|
## <summary>
|
||
|
## Execute vnstat in the vnstat domain,
|
||
|
## and allow the specified role
|
||
|
## the vnstat domain.
|
||
|
## </summary>
|
||
|
## <param name="domain">
|
||
|
## <summary>
|
||
|
## Domain allowed to transition.
|
||
|
## </summary>
|
||
|
## </param>
|
||
|
## <param name="role">
|
||
|
## <summary>
|
||
|
## Role allowed access.
|
||
|
## </summary>
|
||
|
## </param>
|
||
|
#
|
||
|
interface(`vnstatd_run_vnstat',`
|
||
|
gen_require(`
|
||
|
attribute_role vnstat_roles;
|
||
|
')
|
||
|
|
||
|
vnstatd_domtrans_vnstat($1)
|
||
|
roleattribute $2 vnstat_roles;
|
||
|
')
|
||
|
|
||
|
########################################
|
||
|
## <summary>
|
||
|
## Execute a domain transition to run vnstatd.
|
||
|
## </summary>
|
||
|
## <param name="domain">
|
||
|
## <summary>
|
||
|
## Domain allowed to transition.
|
||
|
## </summary>
|
||
|
## </param>
|
||
|
#
|
||
|
interface(`vnstatd_domtrans',`
|
||
|
gen_require(`
|
||
|
type vnstatd_t, vnstatd_exec_t;
|
||
|
')
|
||
|
|
||
|
corecmd_search_bin($1)
|
||
|
domtrans_pattern($1, vnstatd_exec_t, vnstatd_t)
|
||
|
')
|
||
|
|
||
|
########################################
|
||
|
## <summary>
|
||
|
## Search vnstatd lib directories.
|
||
|
## </summary>
|
||
|
## <param name="domain">
|
||
|
## <summary>
|
||
|
## Domain allowed access.
|
||
|
## </summary>
|
||
|
## </param>
|
||
|
#
|
||
|
interface(`vnstatd_search_lib',`
|
||
|
gen_require(`
|
||
|
type vnstatd_var_lib_t;
|
||
|
')
|
||
|
|
||
|
files_search_var_lib($1)
|
||
|
allow $1 vnstatd_var_lib_t:dir search_dir_perms;
|
||
|
')
|
||
|
|
||
|
########################################
|
||
|
## <summary>
|
||
|
## Create, read, write, and delete
|
||
|
## vnstatd lib directories.
|
||
|
## </summary>
|
||
|
## <param name="domain">
|
||
|
## <summary>
|
||
|
## Domain allowed access.
|
||
|
## </summary>
|
||
|
## </param>
|
||
|
#
|
||
|
interface(`vnstatd_manage_lib_dirs',`
|
||
|
gen_require(`
|
||
|
type vnstatd_var_lib_t;
|
||
|
')
|
||
|
|
||
|
files_search_var_lib($1)
|
||
|
manage_dirs_pattern($1, vnstatd_var_lib_t, vnstatd_var_lib_t)
|
||
|
')
|
||
|
|
||
|
########################################
|
||
|
## <summary>
|
||
|
## Read vnstatd lib files.
|
||
|
## </summary>
|
||
|
## <param name="domain">
|
||
|
## <summary>
|
||
|
## Domain allowed access.
|
||
|
## </summary>
|
||
|
## </param>
|
||
|
#
|
||
|
interface(`vnstatd_read_lib_files',`
|
||
|
gen_require(`
|
||
|
type vnstatd_var_lib_t;
|
||
|
')
|
||
|
|
||
|
files_search_var_lib($1)
|
||
|
read_files_pattern($1, vnstatd_var_lib_t, vnstatd_var_lib_t)
|
||
|
')
|
||
|
|
||
|
########################################
|
||
|
## <summary>
|
||
|
## Create, read, write, and delete
|
||
|
## vnstatd lib files.
|
||
|
## </summary>
|
||
|
## <param name="domain">
|
||
|
## <summary>
|
||
|
## Domain allowed access.
|
||
|
## </summary>
|
||
|
## </param>
|
||
|
#
|
||
|
interface(`vnstatd_manage_lib_files',`
|
||
|
gen_require(`
|
||
|
type vnstatd_var_lib_t;
|
||
|
')
|
||
|
|
||
|
files_search_var_lib($1)
|
||
|
manage_files_pattern($1, vnstatd_var_lib_t, vnstatd_var_lib_t)
|
||
|
')
|
||
|
|
||
|
########################################
|
||
|
## <summary>
|
||
|
## All of the rules required to
|
||
|
## administrate an vnstatd environment.
|
||
|
## </summary>
|
||
|
## <param name="domain">
|
||
|
## <summary>
|
||
|
## Domain allowed access.
|
||
|
## </summary>
|
||
|
## </param>
|
||
|
## <param name="role">
|
||
|
## <summary>
|
||
|
## Role allowed access.
|
||
|
## </summary>
|
||
|
## </param>
|
||
|
#
|
||
|
interface(`vnstatd_admin',`
|
||
|
gen_require(`
|
||
|
type vnstatd_t, vnstatd_var_lib_t, vnstatd_initrc_exec_t;
|
||
|
type vnstatd_var_run_t;
|
||
|
')
|
||
|
|
||
|
allow $1 vnstatd_t:process signal_perms;
|
||
|
ps_process_pattern($1, vnstatd_t)
|
||
|
|
||
|
tunable_policy(`deny_ptrace',`',`
|
||
|
allow $1 vnstatd_t:process ptrace;
|
||
|
')
|
||
|
|
||
|
init_labeled_script_domtrans($1, vnstatd_initrc_exec_t)
|
||
|
domain_system_change_exemption($1)
|
||
|
role_transition $2 vnstatd_initrc_exec_t system_r;
|
||
|
allow $2 system_r;
|
||
|
|
||
|
files_search_pids($1)
|
||
|
admin_pattern($1, vnstatd_var_run_t)
|
||
|
|
||
|
files_list_var_lib($1)
|
||
|
admin_pattern($1, vnstatd_var_lib_t)
|
||
|
|
||
|
vnstatd_run_vnstat($1, $2)
|
||
|
')
|