Blob Blame History Raw

policy_module(authlogin,1.0)

########################################
#
# Declarations
#

type remote_login_t; #, nscd_client_domain;
domain_obj_id_change_exempt(remote_login_t)
domain_subj_id_change_exempt(remote_login_t)
domain_role_change_exempt(remote_login_t)
domain_type(remote_login_t)
domain_wide_inherit_fd(remote_login_t)
auth_login_entry_type(remote_login_t)
role system_r types remote_login_t;

type remote_login_tmp_t;
files_tmp_file(remote_login_tmp_t)

########################################
#
# Remote login remote policy
#

allow remote_login_t self:capability { dac_override chown fowner fsetid kill setgid setuid net_bind_service sys_nice sys_resource sys_tty_config };
allow remote_login_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem dyntransition };
allow remote_login_t self:process { setrlimit setexec };
allow remote_login_t self:fd use;
allow remote_login_t self:fifo_file rw_file_perms;
allow remote_login_t self:unix_dgram_socket create_socket_perms;
allow remote_login_t self:unix_stream_socket create_stream_socket_perms;
allow remote_login_t self:unix_dgram_socket sendto;
allow remote_login_t self:unix_stream_socket connectto;
allow remote_login_t self:shm create_shm_perms;
allow remote_login_t self:sem create_sem_perms;
allow remote_login_t self:msgq create_msgq_perms;
allow remote_login_t self:msg { send receive };

allow remote_login_t remote_login_tmp_t:dir create_dir_perms;
allow remote_login_t remote_login_tmp_t:file create_file_perms;
files_create_tmp_files(remote_login_t, remote_login_tmp_t, { file dir })

kernel_read_system_state(remote_login_t)
kernel_read_kernel_sysctl(remote_login_t)
selinux_get_fs_mount(remote_login_t)
selinux_validate_context(remote_login_t)
selinux_compute_access_vector(remote_login_t)
selinux_compute_create_context(remote_login_t)
selinux_compute_relabel_context(remote_login_t)
selinux_compute_user_contexts(remote_login_t)

# for SSP/ProPolice
dev_read_urand(remote_login_t)

fs_getattr_xattr_fs(remote_login_t)
fs_search_auto_mountpoints(remote_login_t)

auth_domtrans_chk_passwd(remote_login_t)
auth_dontaudit_read_shadow(remote_login_t)
auth_rw_login_records(remote_login_t)
auth_rw_lastlog(remote_login_t)
auth_exec_pam(remote_login_t)
auth_manage_pam_console_data(remote_login_t)

domain_read_all_entry_files(remote_login_t)

files_read_generic_etc_files(remote_login_t)
files_read_etc_runtime_files(remote_login_t)
files_list_home(remote_login_t)
files_read_usr_files(remote_login_t)

init_rw_script_pid(remote_login_t)

libs_use_ld_so(remote_login_t)
libs_use_shared_libs(remote_login_t)

logging_send_syslog_msg(remote_login_t)

seutil_read_config(remote_login_t)
seutil_read_default_contexts(remote_login_t)

miscfiles_read_localization(remote_login_t)

userdom_use_unpriv_users_fd(remote_login_t)

tunable_policy(`use_nfs_home_dirs',`
	fs_read_nfs_files(remote_login_t)
	fs_read_nfs_symlinks(remote_login_t)
')

tunable_policy(`use_samba_home_dirs',`
	fs_read_cifs_files(remote_login_t)
	fs_read_cifs_symlinks(remote_login_t)
')

optional_policy(`nis.te',`
	nis_use_ypbind(remote_login_t)
')

ifdef(`TODO',`

allow remote_login_t bin_t:dir r_dir_perms;
allow remote_login_t bin_t:notdevfile_class_set r_file_perms;
allow remote_login_t sbin_t:dir r_dir_perms;
allow remote_login_t sbin_t:notdevfile_class_set r_file_perms;
tunable_policy(`read_default_t',`
allow remote_login_t default_t:dir r_dir_perms;
allow remote_login_t default_t:notdevfile_class_set r_file_perms;
')

# Read directories and files with the readable_t type.
# This type is a general type for "world"-readable files.
allow remote_login_t readable_t:dir r_dir_perms;
allow remote_login_t readable_t:notdevfile_class_set r_file_perms;

# Read /var, /var/spool
allow remote_login_t { var_t var_spool_t }:dir search;

# for when /var/mail is a sym-link
allow remote_login_t var_t:lnk_file read;

# Read /dev directories and any symbolic links.
allow remote_login_t device_t:lnk_file r_file_perms;

dontaudit remote_login_t sysfs_t:dir search;

allow remote_login_t mnt_t:dir r_dir_perms;

# FIXME: what is this for?
ifdef(`xdm.te', `
allow xdm_t remote_login_t:process signull;
')

ifdef(`crack.te', `
allow remote_login_t crack_db_t:file r_file_perms;
')

# Permit login to search the user home directories.
allow remote_login_t home_dir_type:dir search;

# Write to /var/log/btmp
allow remote_login_t faillog_t:file { append read write };

# Search for mail spool file.
allow remote_login_t mail_spool_t:dir r_dir_perms;
allow remote_login_t mail_spool_t:file getattr;
allow remote_login_t mail_spool_t:lnk_file read;


allow remote_login_t mouse_device_t:chr_file { getattr setattr };

ifdef(`targeted_policy',`
unconfined_domain(remote_login_t)
domain_auto_trans(remote_login_t, shell_exec_t, unconfined_t)
')

# Only permit unprivileged user domains to be entered via rlogin,
# since very weak authentication is used.
login_spawn_domain(remote_login, unpriv_userdomain)

allow remote_login_t devpts_t:dir search;
allow remote_login_t userpty_type:chr_file { setattr write };

# Use the pty created by rlogind.
ifdef(`rlogind.te', `
allow remote_login_t rlogind_devpts_t:chr_file { setattr rw_file_perms };

# Relabel ptys created by rlogind.
allow remote_login_t rlogind_devpts_t:chr_file { relabelfrom relabelto };
')

# Use the pty created by telnetd.
ifdef(`telnetd.te', `
allow remote_login_t telnetd_devpts_t:chr_file { setattr rw_file_perms };

# Relabel ptys created by telnetd.
allow remote_login_t telnetd_devpts_t:chr_file { relabelfrom relabelto };
')

allow remote_login_t ptyfile:chr_file { getattr relabelfrom relabelto ioctl };

# Allow remote login to resolve host names (passed in via the -h switch)
can_resolve(remote_login_t)

') dnl endif TODO