Oreon-Lime-R2/selinux-policy/selinux-policy-bc228bd/selinux-policy-bc228bd0c249a9e4aa3dcf238c2b1bb138943b07/policy/modules/contrib/ftp.if

278 lines
5.4 KiB
Text
Raw Permalink Normal View History

## <summary>File transfer protocol service.</summary>
######################################
## <summary>
## Execute a domain transition to run ftpd.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
#
interface(`ftp_domtrans',`
gen_require(`
type ftpd_t, ftpd_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1,ftpd_exec_t, ftpd_t)
')
#######################################
## <summary>
## Execute ftpd server in the ftpd domain.
## </summary>
## <param name="domain">
## <summary>
## The type of the process performing this action.
## </summary>
## </param>
#
interface(`ftp_initrc_domtrans',`
gen_require(`
type ftpd_initrc_exec_t;
')
init_labeled_script_domtrans($1, ftpd_initrc_exec_t)
')
########################################
## <summary>
## Execute ftpd server in the ftpd domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
#
interface(`ftp_systemctl',`
gen_require(`
type ftpd_unit_file_t;
type ftpd_t;
')
systemd_exec_systemctl($1)
init_reload_services($1)
allow $1 ftpd_unit_file_t:file read_file_perms;
allow $1 ftpd_unit_file_t:service manage_service_perms;
ps_process_pattern($1, ftpd_t)
')
#######################################
## <summary>
## Execute a dyntransition to run anon sftpd.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
#
interface(`ftp_dyntrans_anon_sftpd',`
gen_require(`
type anon_sftpd_t;
')
dyntrans_pattern($1, anon_sftpd_t)
')
########################################
## <summary>
## Connect to over ftpd over TCP. (Deprecated)
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`ftp_tcp_connect',`
refpolicywarn(`$0($*) has been deprecated.')
')
########################################
## <summary>
## Read ftpd configuration files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`ftp_read_config',`
gen_require(`
type ftpd_etc_t;
')
files_search_etc($1)
allow $1 ftpd_etc_t:file read_file_perms;
')
########################################
## <summary>
## Execute FTP daemon entry point programs.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`ftp_check_exec',`
gen_require(`
type ftpd_exec_t;
')
corecmd_search_bin($1)
allow $1 ftpd_exec_t:file mmap_file_perms;
')
########################################
## <summary>
## Read ftpd log files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`ftp_read_log',`
gen_require(`
type xferlog_t;
')
logging_search_logs($1)
allow $1 xferlog_t:file read_file_perms;
')
########################################
## <summary>
## Execute the ftpdctl in the ftpdctl domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
#
interface(`ftp_domtrans_ftpdctl',`
gen_require(`
type ftpdctl_t, ftpdctl_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, ftpdctl_exec_t, ftpdctl_t)
')
########################################
## <summary>
## Execute the ftpdctl in the ftpdctl
## domain, and allow the specified
## role the ftpctl domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
## <param name="role">
## <summary>
## Role allowed access.
## </summary>
## </param>
## <rolecap/>
#
interface(`ftp_run_ftpdctl',`
gen_require(`
attribute_role ftpdctl_roles;
')
ftp_domtrans_ftpdctl($1)
roleattribute $2 ftpdctl_roles;
')
#######################################
## <summary>
## Execute a dyntransition to run sftpd.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
#
interface(`ftp_dyntrans_sftpd',`
gen_require(`
type sftpd_t;
')
dyntrans_pattern($1, sftpd_t)
')
########################################
## <summary>
## All of the rules required to
## administrate an ftp environment.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <param name="role">
## <summary>
## Role allowed access.
## </summary>
## </param>
## <rolecap/>
#
interface(`ftp_admin',`
gen_require(`
type ftpd_t, ftpdctl_t, ftpd_tmp_t;
type ftpd_etc_t, ftpd_lock_t, sftpd_t;
type ftpd_var_run_t, xferlog_t, anon_sftpd_t;
type ftpd_initrc_exec_t, ftpdctl_tmp_t;
type ftpd_keytab_t;
')
allow $1 ftpd_t:process signal_perms;
ps_process_pattern($1, { ftpd_t ftpdctl_t sftpd_t anon_sftpd_t })
tunable_policy(`deny_ptrace',`',`
allow $1 { ftpd_t ftpdctl_t sftpd_t anon_sftpd_t }:process ptrace;
')
init_labeled_script_domtrans($1, ftpd_initrc_exec_t)
domain_system_change_exemption($1)
role_transition $2 ftpd_initrc_exec_t system_r;
allow $2 system_r;
miscfiles_manage_public_files($1)
files_list_tmp($1)
admin_pattern($1, { ftpd_tmp_t ftpdctl_tmp_t })
files_list_etc($1)
admin_pattern($1, { ftpd_etc_t ftpd_keytab_t })
files_list_var($1)
admin_pattern($1, ftpd_lock_t)
files_list_pids($1)
admin_pattern($1, ftpd_var_run_t)
logging_list_logs($1)
admin_pattern($1, xferlog_t)
ftp_systemctl($1)
admin_pattern($1, ftpd_unit_file_t)
allow $1 ftpd_unit_file_t:service all_service_perms;
ftp_run_ftpdctl($1, $2)
')