2005-10-05 19:52:53 +00:00
|
|
|
|
2009-01-09 19:48:02 +00:00
|
|
|
policy_module(ftp, 1.10.2)
|
2005-10-05 19:52:53 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
2007-03-26 18:41:45 +00:00
|
|
|
## <desc>
|
|
|
|
## <p>
|
2007-12-07 15:44:53 +00:00
|
|
|
## Allow ftp servers to upload files, used for public file
|
|
|
|
## transfer services. Directories must be labeled
|
|
|
|
## public_content_rw_t.
|
2007-03-26 18:41:45 +00:00
|
|
|
## </p>
|
|
|
|
## </desc>
|
2008-07-23 21:38:39 +00:00
|
|
|
gen_tunable(allow_ftpd_anon_write, false)
|
2007-03-26 18:41:45 +00:00
|
|
|
|
|
|
|
## <desc>
|
|
|
|
## <p>
|
|
|
|
## Allow ftp servers to login to local users and
|
|
|
|
## read/write all files on the system, governed by DAC.
|
|
|
|
## </p>
|
|
|
|
## </desc>
|
2008-07-23 21:38:39 +00:00
|
|
|
gen_tunable(allow_ftpd_full_access, false)
|
2007-03-26 18:41:45 +00:00
|
|
|
|
|
|
|
## <desc>
|
|
|
|
## <p>
|
|
|
|
## Allow ftp servers to use cifs
|
|
|
|
## used for public file transfer services.
|
|
|
|
## </p>
|
|
|
|
## </desc>
|
2008-07-23 21:38:39 +00:00
|
|
|
gen_tunable(allow_ftpd_use_cifs, false)
|
2007-03-26 18:41:45 +00:00
|
|
|
|
|
|
|
## <desc>
|
|
|
|
## <p>
|
|
|
|
## Allow ftp servers to use nfs
|
|
|
|
## used for public file transfer services.
|
|
|
|
## </p>
|
|
|
|
## </desc>
|
2008-07-23 21:38:39 +00:00
|
|
|
gen_tunable(allow_ftpd_use_nfs, false)
|
2007-03-26 18:41:45 +00:00
|
|
|
|
|
|
|
## <desc>
|
|
|
|
## <p>
|
|
|
|
## Allow ftp to read and write files in the user home directories
|
|
|
|
## </p>
|
|
|
|
## </desc>
|
2008-07-23 21:38:39 +00:00
|
|
|
gen_tunable(ftp_home_dir, false)
|
2007-03-26 18:41:45 +00:00
|
|
|
|
2005-10-05 19:52:53 +00:00
|
|
|
type ftpd_t;
|
|
|
|
type ftpd_exec_t;
|
2008-07-23 21:38:39 +00:00
|
|
|
init_daemon_domain(ftpd_t, ftpd_exec_t)
|
2005-10-05 19:52:53 +00:00
|
|
|
|
|
|
|
type ftpd_etc_t;
|
2005-10-24 18:40:24 +00:00
|
|
|
files_config_file(ftpd_etc_t)
|
2005-10-05 19:52:53 +00:00
|
|
|
|
2008-10-08 20:03:24 +00:00
|
|
|
type ftpd_initrc_exec_t;
|
|
|
|
init_script_file(ftpd_initrc_exec_t)
|
|
|
|
|
2005-10-05 19:52:53 +00:00
|
|
|
type ftpd_lock_t;
|
|
|
|
files_lock_file(ftpd_lock_t)
|
|
|
|
|
|
|
|
type ftpd_tmp_t;
|
|
|
|
files_tmp_file(ftpd_tmp_t)
|
|
|
|
|
|
|
|
type ftpd_tmpfs_t;
|
|
|
|
files_tmpfs_file(ftpd_tmpfs_t)
|
|
|
|
|
|
|
|
type ftpd_var_run_t;
|
|
|
|
files_pid_file(ftpd_var_run_t)
|
|
|
|
|
2006-06-13 18:17:34 +00:00
|
|
|
type ftpdctl_t;
|
|
|
|
type ftpdctl_exec_t;
|
2008-07-23 21:38:39 +00:00
|
|
|
init_system_domain(ftpdctl_t, ftpdctl_exec_t)
|
2006-06-13 18:17:34 +00:00
|
|
|
|
|
|
|
type ftpdctl_tmp_t;
|
|
|
|
files_tmp_file(ftpdctl_tmp_t)
|
|
|
|
|
2005-10-05 19:52:53 +00:00
|
|
|
type xferlog_t;
|
|
|
|
logging_log_file(xferlog_t)
|
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
2006-06-13 18:17:34 +00:00
|
|
|
# ftpd local policy
|
2005-10-05 19:52:53 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
allow ftpd_t self:capability { chown fowner fsetid setgid setuid sys_chroot sys_nice sys_resource };
|
|
|
|
dontaudit ftpd_t self:capability sys_tty_config;
|
|
|
|
allow ftpd_t self:process signal_perms;
|
|
|
|
allow ftpd_t self:process { getcap setcap setsched setrlimit };
|
2006-12-12 20:08:08 +00:00
|
|
|
allow ftpd_t self:fifo_file rw_fifo_file_perms;
|
2005-10-05 19:52:53 +00:00
|
|
|
allow ftpd_t self:unix_dgram_socket { sendto create_socket_perms };
|
2006-06-13 18:17:34 +00:00
|
|
|
allow ftpd_t self:unix_stream_socket create_stream_socket_perms;
|
2005-10-05 19:52:53 +00:00
|
|
|
allow ftpd_t self:tcp_socket create_stream_socket_perms;
|
|
|
|
allow ftpd_t self:udp_socket create_socket_perms;
|
|
|
|
|
2006-12-12 20:08:08 +00:00
|
|
|
allow ftpd_t ftpd_etc_t:file read_file_perms;
|
2005-10-05 19:52:53 +00:00
|
|
|
|
2007-03-26 18:41:45 +00:00
|
|
|
allow ftpd_t ftpd_lock_t:file manage_file_perms;
|
2008-07-23 21:38:39 +00:00
|
|
|
files_lock_filetrans(ftpd_t, ftpd_lock_t, file)
|
2007-03-26 18:41:45 +00:00
|
|
|
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_dirs_pattern(ftpd_t, ftpd_tmp_t, ftpd_tmp_t)
|
|
|
|
manage_files_pattern(ftpd_t, ftpd_tmp_t, ftpd_tmp_t)
|
2006-02-21 18:40:44 +00:00
|
|
|
files_tmp_filetrans(ftpd_t, ftpd_tmp_t, { file dir })
|
2005-10-05 19:52:53 +00:00
|
|
|
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_dirs_pattern(ftpd_t, ftpd_tmpfs_t, ftpd_tmpfs_t)
|
|
|
|
manage_files_pattern(ftpd_t, ftpd_tmpfs_t, ftpd_tmpfs_t)
|
|
|
|
manage_lnk_files_pattern(ftpd_t, ftpd_tmpfs_t, ftpd_tmpfs_t)
|
|
|
|
manage_fifo_files_pattern(ftpd_t, ftpd_tmpfs_t, ftpd_tmpfs_t)
|
|
|
|
manage_sock_files_pattern(ftpd_t, ftpd_tmpfs_t, ftpd_tmpfs_t)
|
|
|
|
fs_tmpfs_filetrans(ftpd_t, ftpd_tmpfs_t, { dir file lnk_file sock_file fifo_file })
|
2005-10-05 19:52:53 +00:00
|
|
|
|
2008-10-08 20:03:24 +00:00
|
|
|
manage_dirs_pattern(ftpd_t, ftpd_var_run_t, ftpd_var_run_t)
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_files_pattern(ftpd_t, ftpd_var_run_t, ftpd_var_run_t)
|
|
|
|
manage_sock_files_pattern(ftpd_t, ftpd_var_run_t, ftpd_var_run_t)
|
2008-10-08 20:03:24 +00:00
|
|
|
files_pid_filetrans(ftpd_t, ftpd_var_run_t, { file dir} )
|
2005-10-21 21:35:25 +00:00
|
|
|
|
2006-06-13 18:17:34 +00:00
|
|
|
# proftpd requires the client side to bind a socket so that
|
|
|
|
# it can stat the socket to perform access control decisions,
|
|
|
|
# since getsockopt with SO_PEERCRED is not available on all
|
|
|
|
# proftpd-supported OSs
|
|
|
|
allow ftpd_t ftpdctl_tmp_t:sock_file { getattr unlink };
|
|
|
|
|
2005-10-05 19:52:53 +00:00
|
|
|
# Create and modify /var/log/xferlog.
|
2006-04-12 15:04:28 +00:00
|
|
|
allow ftpd_t xferlog_t:dir search_dir_perms;
|
2006-12-12 20:08:08 +00:00
|
|
|
allow ftpd_t xferlog_t:file manage_file_perms;
|
2008-07-23 21:38:39 +00:00
|
|
|
logging_log_filetrans(ftpd_t, xferlog_t, file)
|
2005-10-05 19:52:53 +00:00
|
|
|
|
2006-01-31 16:49:43 +00:00
|
|
|
kernel_read_kernel_sysctls(ftpd_t)
|
2005-10-05 19:52:53 +00:00
|
|
|
kernel_read_system_state(ftpd_t)
|
2008-10-08 20:03:24 +00:00
|
|
|
kernel_search_network_state(ftpd_t)
|
2005-10-05 19:52:53 +00:00
|
|
|
|
|
|
|
dev_read_sysfs(ftpd_t)
|
|
|
|
dev_read_urand(ftpd_t)
|
|
|
|
|
2005-12-09 15:42:39 +00:00
|
|
|
corecmd_exec_bin(ftpd_t)
|
2005-10-05 19:52:53 +00:00
|
|
|
|
2007-06-27 15:23:21 +00:00
|
|
|
corenet_all_recvfrom_unlabeled(ftpd_t)
|
|
|
|
corenet_all_recvfrom_netlabel(ftpd_t)
|
2009-01-06 20:24:10 +00:00
|
|
|
corenet_tcp_sendrecv_generic_if(ftpd_t)
|
|
|
|
corenet_udp_sendrecv_generic_if(ftpd_t)
|
2009-01-09 19:48:02 +00:00
|
|
|
corenet_tcp_sendrecv_generic_node(ftpd_t)
|
|
|
|
corenet_udp_sendrecv_generic_node(ftpd_t)
|
2005-10-05 19:52:53 +00:00
|
|
|
corenet_tcp_sendrecv_all_ports(ftpd_t)
|
|
|
|
corenet_udp_sendrecv_all_ports(ftpd_t)
|
2009-01-09 19:48:02 +00:00
|
|
|
corenet_tcp_bind_generic_node(ftpd_t)
|
2006-05-31 17:20:21 +00:00
|
|
|
corenet_tcp_bind_ftp_port(ftpd_t)
|
2005-10-05 19:52:53 +00:00
|
|
|
corenet_tcp_bind_ftp_data_port(ftpd_t)
|
|
|
|
corenet_tcp_bind_generic_port(ftpd_t)
|
2007-02-16 23:01:42 +00:00
|
|
|
corenet_tcp_bind_all_unreserved_ports(ftpd_t)
|
|
|
|
corenet_dontaudit_tcp_bind_all_ports(ftpd_t)
|
2005-10-05 19:52:53 +00:00
|
|
|
corenet_tcp_connect_all_ports(ftpd_t)
|
2006-05-31 17:20:21 +00:00
|
|
|
corenet_sendrecv_ftp_server_packets(ftpd_t)
|
2005-10-05 19:52:53 +00:00
|
|
|
|
2006-02-20 21:33:25 +00:00
|
|
|
domain_use_interactive_fds(ftpd_t)
|
2005-12-09 15:42:39 +00:00
|
|
|
|
|
|
|
files_search_etc(ftpd_t)
|
|
|
|
files_read_etc_files(ftpd_t)
|
|
|
|
files_read_etc_runtime_files(ftpd_t)
|
2006-01-31 19:21:01 +00:00
|
|
|
files_search_var_lib(ftpd_t)
|
2005-12-09 15:42:39 +00:00
|
|
|
|
|
|
|
fs_search_auto_mountpoints(ftpd_t)
|
|
|
|
fs_getattr_all_fs(ftpd_t)
|
|
|
|
|
|
|
|
auth_use_nsswitch(ftpd_t)
|
2005-10-21 21:35:25 +00:00
|
|
|
auth_domtrans_chk_passwd(ftpd_t)
|
2005-10-05 19:52:53 +00:00
|
|
|
# Append to /var/log/wtmp.
|
|
|
|
auth_append_login_records(ftpd_t)
|
|
|
|
#kerberized ftp requires the following
|
|
|
|
auth_write_login_records(ftpd_t)
|
2007-02-28 17:01:47 +00:00
|
|
|
auth_rw_faillog(ftpd_t)
|
2005-10-05 19:52:53 +00:00
|
|
|
|
2006-12-04 20:10:56 +00:00
|
|
|
init_rw_utmp(ftpd_t)
|
2005-10-05 19:52:53 +00:00
|
|
|
|
2008-10-08 20:03:24 +00:00
|
|
|
logging_send_audit_msgs(ftpd_t)
|
2005-10-05 19:52:53 +00:00
|
|
|
logging_send_syslog_msg(ftpd_t)
|
2008-10-08 20:03:24 +00:00
|
|
|
logging_set_loginuid(ftpd_t)
|
2005-10-05 19:52:53 +00:00
|
|
|
|
|
|
|
miscfiles_read_localization(ftpd_t)
|
|
|
|
miscfiles_read_public_files(ftpd_t)
|
|
|
|
|
|
|
|
seutil_dontaudit_search_config(ftpd_t)
|
|
|
|
|
|
|
|
sysnet_read_config(ftpd_t)
|
2006-04-19 15:25:22 +00:00
|
|
|
sysnet_use_ldap(ftpd_t)
|
2005-10-05 19:52:53 +00:00
|
|
|
|
2006-02-20 21:33:25 +00:00
|
|
|
userdom_dontaudit_use_unpriv_user_fds(ftpd_t)
|
2008-11-05 16:10:46 +00:00
|
|
|
userdom_dontaudit_search_user_home_dirs(ftpd_t)
|
2008-04-29 13:58:34 +00:00
|
|
|
|
2005-10-05 19:52:53 +00:00
|
|
|
tunable_policy(`allow_ftpd_anon_write',`
|
|
|
|
miscfiles_manage_public_files(ftpd_t)
|
2006-06-07 17:43:10 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
tunable_policy(`allow_ftpd_use_cifs',`
|
|
|
|
fs_read_cifs_files(ftpd_t)
|
|
|
|
fs_read_cifs_symlinks(ftpd_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
tunable_policy(`allow_ftpd_use_cifs && allow_ftpd_anon_write',`
|
|
|
|
fs_manage_cifs_files(ftpd_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
tunable_policy(`allow_ftpd_use_nfs',`
|
|
|
|
fs_read_nfs_files(ftpd_t)
|
|
|
|
fs_read_nfs_symlinks(ftpd_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
tunable_policy(`allow_ftpd_use_nfs && allow_ftpd_anon_write',`
|
|
|
|
fs_manage_nfs_files(ftpd_t)
|
|
|
|
')
|
2005-10-05 19:52:53 +00:00
|
|
|
|
2007-02-16 23:01:42 +00:00
|
|
|
tunable_policy(`allow_ftpd_full_access',`
|
|
|
|
allow ftpd_t self:capability { dac_override dac_read_search };
|
|
|
|
auth_manage_all_files_except_shadow(ftpd_t)
|
|
|
|
')
|
|
|
|
|
2005-10-05 19:52:53 +00:00
|
|
|
tunable_policy(`ftp_home_dir',`
|
2006-05-17 14:50:31 +00:00
|
|
|
allow ftpd_t self:capability { dac_override dac_read_search };
|
|
|
|
|
2005-10-05 19:52:53 +00:00
|
|
|
# allow access to /home
|
2005-10-14 17:55:40 +00:00
|
|
|
files_list_home(ftpd_t)
|
2008-11-05 16:10:46 +00:00
|
|
|
userdom_read_user_home_content_files(ftpd_t)
|
|
|
|
userdom_manage_user_home_content_dirs(ftpd_t)
|
|
|
|
userdom_manage_user_home_content_files(ftpd_t)
|
|
|
|
userdom_manage_user_home_content_symlinks(ftpd_t)
|
|
|
|
userdom_user_home_dir_filetrans_user_home_content(ftpd_t, { dir file lnk_file })
|
2005-10-05 19:52:53 +00:00
|
|
|
')
|
|
|
|
|
2006-06-07 17:43:10 +00:00
|
|
|
tunable_policy(`ftp_home_dir && use_nfs_home_dirs',`
|
|
|
|
fs_manage_nfs_files(ftpd_t)
|
|
|
|
fs_read_nfs_symlinks(ftpd_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
tunable_policy(`ftp_home_dir && use_samba_home_dirs',`
|
|
|
|
fs_manage_cifs_files(ftpd_t)
|
|
|
|
fs_read_cifs_symlinks(ftpd_t)
|
|
|
|
')
|
|
|
|
|
2006-07-28 15:13:58 +00:00
|
|
|
optional_policy(`
|
|
|
|
tunable_policy(`ftp_home_dir',`
|
|
|
|
apache_search_sys_content(ftpd_t)
|
|
|
|
')
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-10-05 19:52:53 +00:00
|
|
|
corecmd_exec_shell(ftpd_t)
|
|
|
|
|
2005-10-13 20:59:36 +00:00
|
|
|
files_read_usr_files(ftpd_t)
|
2005-10-05 19:52:53 +00:00
|
|
|
|
|
|
|
cron_system_entry(ftpd_t, ftpd_exec_t)
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-10-05 19:52:53 +00:00
|
|
|
logrotate_exec(ftpd_t)
|
|
|
|
')
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-01-16 18:30:14 +00:00
|
|
|
daemontools_service_domain(ftpd_t, ftpd_exec_t)
|
|
|
|
')
|
|
|
|
|
2007-02-28 17:01:47 +00:00
|
|
|
optional_policy(`
|
|
|
|
kerberos_read_keytab(ftpd_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2008-07-23 21:38:39 +00:00
|
|
|
inetd_tcp_service_domain(ftpd_t, ftpd_exec_t)
|
2005-11-01 21:15:11 +00:00
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2007-03-26 18:41:45 +00:00
|
|
|
tcpd_domtrans(tcpd_t)
|
2005-10-13 20:59:36 +00:00
|
|
|
')
|
2005-10-05 19:52:53 +00:00
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-10-05 19:52:53 +00:00
|
|
|
seutil_sigchld_newrole(ftpd_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-10-05 19:52:53 +00:00
|
|
|
udev_read_db(ftpd_t)
|
|
|
|
')
|
2006-06-13 18:17:34 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# ftpdctl local policy
|
|
|
|
#
|
|
|
|
|
|
|
|
# Allow ftpdctl to talk to ftpd over a socket connection
|
2008-07-23 21:38:39 +00:00
|
|
|
stream_connect_pattern(ftpdctl_t, ftpd_var_run_t, ftpd_var_run_t, ftpd_t)
|
2006-06-13 18:17:34 +00:00
|
|
|
|
|
|
|
# ftpdctl creates a socket so that the daemon can perform
|
|
|
|
# access control decisions (see comments in ftpd_t rules above)
|
|
|
|
allow ftpdctl_t ftpdctl_tmp_t:sock_file { create setattr };
|
|
|
|
files_tmp_filetrans(ftpdctl_t, ftpdctl_tmp_t, sock_file)
|
|
|
|
|
|
|
|
# Allow ftpdctl to read config files
|
|
|
|
files_read_etc_files(ftpdctl_t)
|
2008-11-05 16:10:46 +00:00
|
|
|
|
|
|
|
userdom_use_user_terminals(ftpdctl_t)
|