Chris PeBenito 29af4c
policy_module(ftp, 1.12.0)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 56e1b3
## <desc>
Chris PeBenito 56e1b3
## 

Chris PeBenito dd9e1d
## Allow ftp servers to upload files,  used for public file
Chris PeBenito dd9e1d
## transfer services. Directories must be labeled
Chris PeBenito dd9e1d
## public_content_rw_t.
Chris PeBenito 56e1b3
## 

Chris PeBenito 56e1b3
## </desc>
Chris PeBenito 0bfccd
gen_tunable(allow_ftpd_anon_write, false)
Chris PeBenito 56e1b3
Chris PeBenito 56e1b3
## <desc>
Chris PeBenito 56e1b3
## 

Chris PeBenito a53c6c
## Allow ftp servers to login to local users and
Chris PeBenito 56e1b3
## read/write all files on the system, governed by DAC.
Chris PeBenito 56e1b3
## 

Chris PeBenito 56e1b3
## </desc>
Chris PeBenito 0bfccd
gen_tunable(allow_ftpd_full_access, false)
Chris PeBenito 56e1b3
Chris PeBenito 56e1b3
## <desc>
Chris PeBenito 56e1b3
## 

Chris PeBenito 56e1b3
## Allow ftp servers to use cifs
Chris PeBenito 56e1b3
## used for public file transfer services.
Chris PeBenito 56e1b3
## 

Chris PeBenito 56e1b3
## </desc>
Chris PeBenito 0bfccd
gen_tunable(allow_ftpd_use_cifs, false)
Chris PeBenito 56e1b3
Chris PeBenito 56e1b3
## <desc>
Chris PeBenito 56e1b3
## 

Chris PeBenito 56e1b3
## Allow ftp servers to use nfs
Chris PeBenito 56e1b3
## used for public file transfer services.
Chris PeBenito 56e1b3
## 

Chris PeBenito 56e1b3
## </desc>
Chris PeBenito 0bfccd
gen_tunable(allow_ftpd_use_nfs, false)
Chris PeBenito 56e1b3
Chris PeBenito 56e1b3
## <desc>
Chris PeBenito 56e1b3
## 

Dan Walsh 3eaa99
## Allow ftp servers to use connect to mysql database
Dan Walsh 3eaa99
## 

Dan Walsh 3eaa99
## </desc>
Dan Walsh 3eaa99
gen_tunable(ftpd_connect_db, false)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
## <desc>
Dan Walsh 3eaa99
## 

Chris PeBenito 56e1b3
## Allow ftp to read and write files in the user home directories
Chris PeBenito 56e1b3
## 

Chris PeBenito 56e1b3
## </desc>
Chris PeBenito 0bfccd
gen_tunable(ftp_home_dir, false)
Chris PeBenito 56e1b3
Chris PeBenito a53c6c
## <desc>
Chris PeBenito a53c6c
## 

Chris PeBenito a53c6c
## Allow anon internal-sftp to upload files, used for
Chris PeBenito a53c6c
## public file transfer services. Directories must be labeled
Chris PeBenito a53c6c
## public_content_rw_t.
Chris PeBenito a53c6c
## 

Chris PeBenito a53c6c
## </desc>
Chris PeBenito a53c6c
gen_tunable(sftpd_anon_write, false)
Chris PeBenito a53c6c
Chris PeBenito a53c6c
## <desc>
Chris PeBenito a53c6c
## 

Chris PeBenito a53c6c
## Allow sftp-internal to read and write files
Chris PeBenito a53c6c
## in the user home directories
Chris PeBenito a53c6c
## 

Chris PeBenito a53c6c
## </desc>
Chris PeBenito a53c6c
gen_tunable(sftpd_enable_homedirs, false)
Chris PeBenito a53c6c
Chris PeBenito a53c6c
## <desc>
Chris PeBenito a53c6c
## 

Chris PeBenito a53c6c
## Allow sftp-internal to login to local users and
Chris PeBenito a53c6c
## read/write all files on the system, governed by DAC.
Chris PeBenito a53c6c
## 

Chris PeBenito a53c6c
## </desc>
Chris PeBenito a53c6c
gen_tunable(sftpd_full_access, false)
Chris PeBenito a53c6c
Dan Walsh 3eaa99
## <desc>
Dan Walsh 3eaa99
## 

Dan Walsh 3eaa99
## Allow interlnal-sftp to read and write files 
Dan Walsh 3eaa99
## in the user ssh home directories.
Dan Walsh 3eaa99
## 

Dan Walsh 3eaa99
## </desc>
Dan Walsh 3eaa99
gen_tunable(sftpd_write_ssh_home, false)
Dan Walsh 3eaa99
Chris PeBenito a53c6c
type anon_sftpd_t;
Chris PeBenito a53c6c
typealias anon_sftpd_t alias sftpd_anon_t;
Chris PeBenito a53c6c
domain_type(anon_sftpd_t)
Chris PeBenito a53c6c
role system_r types anon_sftpd_t;
Chris PeBenito a53c6c
Chris PeBenito 17de1b
type ftpd_t;
Chris PeBenito 17de1b
type ftpd_exec_t;
Chris PeBenito 0bfccd
init_daemon_domain(ftpd_t, ftpd_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type ftpd_etc_t;
Chris PeBenito 17de1b
files_config_file(ftpd_etc_t)
Chris PeBenito 17de1b
Chris PeBenito 967fd1
type ftpd_initrc_exec_t;
Chris PeBenito 967fd1
init_script_file(ftpd_initrc_exec_t)
Chris PeBenito 967fd1
Chris PeBenito 17de1b
type ftpd_lock_t;
Chris PeBenito 17de1b
files_lock_file(ftpd_lock_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type ftpd_tmp_t;
Chris PeBenito 17de1b
files_tmp_file(ftpd_tmp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type ftpd_tmpfs_t;
Chris PeBenito 17de1b
files_tmpfs_file(ftpd_tmpfs_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type ftpd_var_run_t;
Chris PeBenito 17de1b
files_pid_file(ftpd_var_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type ftpdctl_t;
Chris PeBenito 17de1b
type ftpdctl_exec_t;
Chris PeBenito 0bfccd
init_system_domain(ftpdctl_t, ftpdctl_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type ftpdctl_tmp_t;
Chris PeBenito 17de1b
files_tmp_file(ftpdctl_tmp_t)
Chris PeBenito 17de1b
Chris PeBenito a53c6c
type sftpd_t;
Chris PeBenito a53c6c
domain_type(sftpd_t)
Chris PeBenito a53c6c
role system_r types sftpd_t;
Chris PeBenito a53c6c
Chris PeBenito 17de1b
type xferlog_t;
Chris PeBenito 17de1b
logging_log_file(xferlog_t)
Chris PeBenito 17de1b
Chris PeBenito a53c6c
ifdef(`enable_mcs',`
Chris PeBenito a53c6c
	init_ranged_daemon_domain(ftpd_t, ftpd_exec_t, s0 - mcs_systemhigh)
Chris PeBenito a53c6c
')
Chris PeBenito a53c6c
Dan Walsh 3eaa99
ifdef(`enable_mls',`
Dan Walsh 3eaa99
	init_ranged_daemon_domain(ftpd_t, ftpd_exec_t, mls_systemhigh)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Chris PeBenito a53c6c
########################################
Chris PeBenito a53c6c
#
Chris PeBenito a53c6c
# anon-sftp local policy
Chris PeBenito a53c6c
#
Chris PeBenito a53c6c
Chris PeBenito a53c6c
files_read_etc_files(anon_sftpd_t)
Chris PeBenito a53c6c
Chris PeBenito a53c6c
miscfiles_read_public_files(anon_sftpd_t)
Chris PeBenito a53c6c
Chris PeBenito a53c6c
tunable_policy(`sftpd_anon_write',`
Chris PeBenito a53c6c
	miscfiles_manage_public_files(anon_sftpd_t)
Chris PeBenito a53c6c
')
Chris PeBenito a53c6c
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# ftpd local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Dan Walsh 3eaa99
allow ftpd_t self:capability { chown fowner fsetid ipc_lock setgid setuid sys_chroot sys_admin sys_nice sys_resource };
Chris PeBenito 17de1b
dontaudit ftpd_t self:capability sys_tty_config;
Chris PeBenito a53c6c
allow ftpd_t self:process { getcap getpgid setcap setsched setrlimit signal_perms };
Chris PeBenito c0868a
allow ftpd_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 17de1b
allow ftpd_t self:unix_dgram_socket { sendto create_socket_perms };
Chris PeBenito 17de1b
allow ftpd_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow ftpd_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow ftpd_t self:udp_socket create_socket_perms;
Chris PeBenito a53c6c
allow ftpd_t self:shm create_shm_perms;
Chris PeBenito a53c6c
allow ftpd_t self:key manage_key_perms;
Chris PeBenito 17de1b
Chris PeBenito c0868a
allow ftpd_t ftpd_etc_t:file read_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 56e1b3
allow ftpd_t ftpd_lock_t:file manage_file_perms;
Chris PeBenito 0bfccd
files_lock_filetrans(ftpd_t, ftpd_lock_t, file)
Chris PeBenito 56e1b3
Chris PeBenito 0bfccd
manage_dirs_pattern(ftpd_t, ftpd_tmp_t, ftpd_tmp_t)
Chris PeBenito 0bfccd
manage_files_pattern(ftpd_t, ftpd_tmp_t, ftpd_tmp_t)
Chris PeBenito 17de1b
Chris PeBenito 0bfccd
manage_dirs_pattern(ftpd_t, ftpd_tmpfs_t, ftpd_tmpfs_t)
Chris PeBenito 0bfccd
manage_files_pattern(ftpd_t, ftpd_tmpfs_t, ftpd_tmpfs_t)
Chris PeBenito 0bfccd
manage_lnk_files_pattern(ftpd_t, ftpd_tmpfs_t, ftpd_tmpfs_t)
Chris PeBenito 0bfccd
manage_fifo_files_pattern(ftpd_t, ftpd_tmpfs_t, ftpd_tmpfs_t)
Chris PeBenito 0bfccd
manage_sock_files_pattern(ftpd_t, ftpd_tmpfs_t, ftpd_tmpfs_t)
Chris PeBenito 0bfccd
fs_tmpfs_filetrans(ftpd_t, ftpd_tmpfs_t, { dir file lnk_file sock_file fifo_file })
Chris PeBenito 17de1b
Chris PeBenito 967fd1
manage_dirs_pattern(ftpd_t, ftpd_var_run_t, ftpd_var_run_t)
Chris PeBenito 0bfccd
manage_files_pattern(ftpd_t, ftpd_var_run_t, ftpd_var_run_t)
Chris PeBenito 0bfccd
manage_sock_files_pattern(ftpd_t, ftpd_var_run_t, ftpd_var_run_t)
Chris PeBenito 967fd1
files_pid_filetrans(ftpd_t, ftpd_var_run_t, { file dir} )
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# proftpd requires the client side to bind a socket so that
Chris PeBenito 17de1b
# it can stat the socket to perform access control decisions,
Chris PeBenito 17de1b
# since getsockopt with SO_PEERCRED is not available on all
Chris PeBenito 17de1b
# proftpd-supported OSs
Chris PeBenito 17de1b
allow ftpd_t ftpdctl_tmp_t:sock_file { getattr unlink };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# Create and modify /var/log/xferlog.
Chris PeBenito a53c6c
manage_files_pattern(ftpd_t, xferlog_t, xferlog_t)
Chris PeBenito 0bfccd
logging_log_filetrans(ftpd_t, xferlog_t, file)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_kernel_sysctls(ftpd_t)
Chris PeBenito 17de1b
kernel_read_system_state(ftpd_t)
Chris PeBenito 967fd1
kernel_search_network_state(ftpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
dev_read_sysfs(ftpd_t)
Chris PeBenito 17de1b
dev_read_urand(ftpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
corecmd_exec_bin(ftpd_t)
Chris PeBenito 17de1b
Chris PeBenito 190066
corenet_all_recvfrom_unlabeled(ftpd_t)
Chris PeBenito 190066
corenet_all_recvfrom_netlabel(ftpd_t)
Chris PeBenito 668b30
corenet_tcp_sendrecv_generic_if(ftpd_t)
Chris PeBenito 668b30
corenet_udp_sendrecv_generic_if(ftpd_t)
Chris PeBenito c12621
corenet_tcp_sendrecv_generic_node(ftpd_t)
Chris PeBenito c12621
corenet_udp_sendrecv_generic_node(ftpd_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_ports(ftpd_t)
Chris PeBenito 17de1b
corenet_udp_sendrecv_all_ports(ftpd_t)
Chris PeBenito c12621
corenet_tcp_bind_generic_node(ftpd_t)
Chris PeBenito 17de1b
corenet_tcp_bind_ftp_port(ftpd_t)
Chris PeBenito 17de1b
corenet_tcp_bind_ftp_data_port(ftpd_t)
Chris PeBenito 17de1b
corenet_tcp_bind_generic_port(ftpd_t)
Chris PeBenito 6b19be
corenet_tcp_bind_all_unreserved_ports(ftpd_t)
Chris PeBenito 6b19be
corenet_dontaudit_tcp_bind_all_ports(ftpd_t)
Chris PeBenito 17de1b
corenet_tcp_connect_all_ports(ftpd_t)
Chris PeBenito 17de1b
corenet_sendrecv_ftp_server_packets(ftpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
domain_use_interactive_fds(ftpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_search_etc(ftpd_t)
Chris PeBenito 17de1b
files_read_etc_files(ftpd_t)
Chris PeBenito 17de1b
files_read_etc_runtime_files(ftpd_t)
Chris PeBenito 17de1b
files_search_var_lib(ftpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
fs_search_auto_mountpoints(ftpd_t)
Chris PeBenito 17de1b
fs_getattr_all_fs(ftpd_t)
Chris PeBenito a53c6c
fs_search_fusefs(ftpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
auth_use_nsswitch(ftpd_t)
Chris PeBenito 17de1b
auth_domtrans_chk_passwd(ftpd_t)
Chris PeBenito 17de1b
# Append to /var/log/wtmp.
Chris PeBenito 17de1b
auth_append_login_records(ftpd_t)
Chris PeBenito 17de1b
#kerberized ftp requires the following
Chris PeBenito 17de1b
auth_write_login_records(ftpd_t)
Chris PeBenito 09c56f
auth_rw_faillog(ftpd_t)
Chris PeBenito 17de1b
Chris PeBenito d6d16b
init_rw_utmp(ftpd_t)
Chris PeBenito 17de1b
Chris PeBenito 967fd1
logging_send_audit_msgs(ftpd_t)
Chris PeBenito 17de1b
logging_send_syslog_msg(ftpd_t)
Chris PeBenito 967fd1
logging_set_loginuid(ftpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(ftpd_t)
Chris PeBenito 17de1b
miscfiles_read_public_files(ftpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
seutil_dontaudit_search_config(ftpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
sysnet_read_config(ftpd_t)
Chris PeBenito 17de1b
sysnet_use_ldap(ftpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
userdom_dontaudit_use_unpriv_user_fds(ftpd_t)
Chris PeBenito 296273
userdom_dontaudit_search_user_home_dirs(ftpd_t)
Chris PeBenito e9c6cd
Chris PeBenito 17de1b
tunable_policy(`allow_ftpd_anon_write',`
Chris PeBenito 17de1b
	miscfiles_manage_public_files(ftpd_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
tunable_policy(`allow_ftpd_use_cifs',`
Chris PeBenito 17de1b
	fs_read_cifs_files(ftpd_t)
Chris PeBenito 17de1b
	fs_read_cifs_symlinks(ftpd_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
tunable_policy(`allow_ftpd_use_cifs && allow_ftpd_anon_write',`
Chris PeBenito 17de1b
	fs_manage_cifs_files(ftpd_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
tunable_policy(`allow_ftpd_use_nfs',`
Chris PeBenito 17de1b
	fs_read_nfs_files(ftpd_t)
Chris PeBenito 17de1b
	fs_read_nfs_symlinks(ftpd_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
tunable_policy(`allow_ftpd_use_nfs && allow_ftpd_anon_write',`
Chris PeBenito 17de1b
	fs_manage_nfs_files(ftpd_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 6b19be
tunable_policy(`allow_ftpd_full_access',`
Chris PeBenito 6b19be
	allow ftpd_t self:capability { dac_override dac_read_search };
Chris PeBenito 6b19be
	auth_manage_all_files_except_shadow(ftpd_t)
Chris PeBenito 6b19be
')
Chris PeBenito 6b19be
Chris PeBenito 17de1b
tunable_policy(`ftp_home_dir',`
Chris PeBenito 17de1b
	allow ftpd_t self:capability { dac_override dac_read_search };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# allow access to /home
Chris PeBenito 17de1b
	files_list_home(ftpd_t)
Chris PeBenito 296273
	userdom_read_user_home_content_files(ftpd_t)
Dan Walsh 3eaa99
	userdom_manage_user_home_content(ftpd_t)
Dan Walsh 3eaa99
	userdom_manage_user_tmp_files(ftpd_t)
Dan Walsh 3eaa99
	userdom_tmp_filetrans_user_tmp(ftpd_t, file)
Dan Walsh 3eaa99
', `
Dan Walsh 3eaa99
   # Needed for permissive mode, to make sure everything gets labeled correctly
Dan Walsh 3eaa99
   userdom_user_home_dir_filetrans_pattern(ftpd_t, { dir file lnk_file })
Dan Walsh 3eaa99
   files_tmp_filetrans(ftpd_t, ftpd_tmp_t, { file dir })
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
tunable_policy(`ftp_home_dir && use_nfs_home_dirs',`
Chris PeBenito 17de1b
	fs_manage_nfs_files(ftpd_t)
Chris PeBenito 17de1b
	fs_read_nfs_symlinks(ftpd_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
tunable_policy(`ftp_home_dir && use_samba_home_dirs',`
Chris PeBenito 17de1b
	fs_manage_cifs_files(ftpd_t)
Chris PeBenito 17de1b
	fs_read_cifs_symlinks(ftpd_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 465510
	tunable_policy(`ftp_home_dir',`
Chris PeBenito 465510
		apache_search_sys_content(ftpd_t)
Chris PeBenito 465510
	')
Chris PeBenito 465510
')
Chris PeBenito 465510
Chris PeBenito 465510
optional_policy(`
Chris PeBenito 17de1b
	corecmd_exec_shell(ftpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	files_read_usr_files(ftpd_t)
Chris PeBenito 17de1b
Chris PeBenito 3f67f7
	cron_system_entry(ftpd_t, ftpd_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
		logrotate_exec(ftpd_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	daemontools_service_domain(ftpd_t, ftpd_exec_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito a53c6c
	selinux_validate_context(ftpd_t)
Chris PeBenito a53c6c
Chris PeBenito a53c6c
	kerberos_keytab_template(ftpd, ftpd_t)
Chris PeBenito a53c6c
	kerberos_manage_host_rcache(ftpd_t)
Chris PeBenito 09c56f
')
Chris PeBenito 09c56f
Chris PeBenito 09c56f
optional_policy(`
Dan Walsh 3eaa99
	tunable_policy(`ftpd_connect_db',`
Dan Walsh 3eaa99
		mysql_stream_connect(ftpd_t)
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Dan Walsh 3eaa99
	tunable_policy(`ftpd_connect_db',`
Dan Walsh 3eaa99
		postgresql_stream_connect(ftpd_t)
Dan Walsh 3eaa99
	')
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
tunable_policy(`ftpd_connect_db',`
Dan Walsh 3eaa99
	corenet_tcp_connect_mysqld_port(ftpd_t)
Dan Walsh 3eaa99
	corenet_tcp_connect_postgresql_port(ftpd_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
optional_policy(`
Chris PeBenito 0bfccd
	inetd_tcp_service_domain(ftpd_t, ftpd_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 56e1b3
		tcpd_domtrans(tcpd_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito a53c6c
	dbus_system_bus_client(ftpd_t)
Chris PeBenito a53c6c
Chris PeBenito a53c6c
	optional_policy(`
Chris PeBenito a53c6c
		oddjob_dbus_chat(ftpd_t)
Chris PeBenito a53c6c
		oddjob_domtrans_mkhomedir(ftpd_t)
Chris PeBenito a53c6c
	')
Chris PeBenito a53c6c
')
Chris PeBenito a53c6c
Chris PeBenito a53c6c
optional_policy(`
Chris PeBenito 17de1b
	seutil_sigchld_newrole(ftpd_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	udev_read_db(ftpd_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# ftpdctl local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# Allow ftpdctl to talk to ftpd over a socket connection
Chris PeBenito 0bfccd
stream_connect_pattern(ftpdctl_t, ftpd_var_run_t, ftpd_var_run_t, ftpd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# ftpdctl creates a socket so that the daemon can perform
Chris PeBenito 17de1b
# access control decisions (see comments in ftpd_t rules above)
Chris PeBenito 17de1b
allow ftpdctl_t ftpdctl_tmp_t:sock_file { create setattr };
Chris PeBenito 17de1b
files_tmp_filetrans(ftpdctl_t, ftpdctl_tmp_t, sock_file)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# Allow ftpdctl to read config files
Chris PeBenito 17de1b
files_read_etc_files(ftpdctl_t)
Chris PeBenito 296273
Chris PeBenito 296273
userdom_use_user_terminals(ftpdctl_t)
Chris PeBenito a53c6c
Chris PeBenito a53c6c
########################################
Chris PeBenito a53c6c
#
Chris PeBenito a53c6c
# sftpd local policy
Chris PeBenito a53c6c
#
Chris PeBenito a53c6c
files_read_etc_files(sftpd_t)
Chris PeBenito a53c6c
Chris PeBenito a53c6c
# allow read access to /home by default
Chris PeBenito a53c6c
userdom_read_user_home_content_files(sftpd_t)
Chris PeBenito a53c6c
userdom_read_user_home_content_symlinks(sftpd_t)
Dan Walsh 3eaa99
userdom_dontaudit_list_admin_dir(sftpd_t)
Dan Walsh 3eaa99
Dan Walsh 3eaa99
tunable_policy(`sftpd_full_access',`
Dan Walsh 3eaa99
    allow sftpd_t self:capability { dac_override dac_read_search };
Dan Walsh 3eaa99
    fs_read_noxattr_fs_files(sftpd_t)
Dan Walsh 3eaa99
    auth_manage_all_files_except_shadow(sftpd_t)
Dan Walsh 3eaa99
')
Dan Walsh 3eaa99
Dan Walsh 3eaa99
tunable_policy(`sftpd_write_ssh_home',`
Dan Walsh 3eaa99
    ssh_manage_home_files(sftpd_t)
Dan Walsh 3eaa99
')
Chris PeBenito a53c6c
Chris PeBenito a53c6c
tunable_policy(`sftpd_enable_homedirs',`
Chris PeBenito a53c6c
	allow sftpd_t self:capability { dac_override dac_read_search };
Chris PeBenito a53c6c
Chris PeBenito a53c6c
	# allow access to /home
Chris PeBenito a53c6c
	files_list_home(sftpd_t)
Dan Walsh 3eaa99
	userdom_read_user_home_content_files(sftpd_t)
Dan Walsh 3eaa99
	userdom_manage_user_home_content(sftpd_t)
Dan Walsh 3eaa99
', `
Dan Walsh 3eaa99
   # Needed for permissive mode, to make sure everything gets labeled correctly
Dan Walsh 3eaa99
   userdom_user_home_dir_filetrans_pattern(sftpd_t, { dir file lnk_file })
Chris PeBenito a53c6c
')
Chris PeBenito a53c6c
Chris PeBenito a53c6c
tunable_policy(`sftpd_enable_homedirs && use_nfs_home_dirs',`
Chris PeBenito a53c6c
	fs_manage_nfs_dirs(sftpd_t)
Chris PeBenito a53c6c
	fs_manage_nfs_files(sftpd_t)
Chris PeBenito a53c6c
	fs_manage_nfs_symlinks(sftpd_t)
Chris PeBenito a53c6c
')
Chris PeBenito a53c6c
Chris PeBenito a53c6c
tunable_policy(`sftpd_enable_homedirs && use_samba_home_dirs',`
Chris PeBenito a53c6c
	fs_manage_cifs_dirs(sftpd_t)
Chris PeBenito a53c6c
	fs_manage_cifs_files(sftpd_t)
Chris PeBenito a53c6c
	fs_manage_cifs_symlinks(sftpd_t)
Chris PeBenito a53c6c
')
Chris PeBenito a53c6c
Chris PeBenito a53c6c
tunable_policy(`sftpd_full_access',`
Chris PeBenito a53c6c
	allow sftpd_t self:capability { dac_override dac_read_search };
Chris PeBenito a53c6c
	fs_read_noxattr_fs_files(sftpd_t)
Chris PeBenito a53c6c
	auth_manage_all_files_except_shadow(sftpd_t)
Chris PeBenito a53c6c
')
Chris PeBenito a53c6c
Chris PeBenito a53c6c
tunable_policy(`use_samba_home_dirs',`
Chris PeBenito a53c6c
	# allow read access to /home by default
Chris PeBenito a53c6c
	fs_list_cifs(sftpd_t)
Chris PeBenito a53c6c
	fs_read_cifs_files(sftpd_t)
Chris PeBenito a53c6c
	fs_read_cifs_symlinks(sftpd_t)
Chris PeBenito a53c6c
')
Chris PeBenito a53c6c
Chris PeBenito a53c6c
tunable_policy(`use_nfs_home_dirs',`
Chris PeBenito a53c6c
	# allow read access to /home by default
Chris PeBenito a53c6c
	fs_list_nfs(sftpd_t)
Chris PeBenito a53c6c
	fs_read_nfs_files(sftpd_t)
Chris PeBenito a53c6c
	fs_read_nfs_symlinks(ftpd_t)
Chris PeBenito a53c6c
')