selinux-refpolicy/policy/modules/system/fstools.te

225 lines
5.6 KiB
Plaintext
Raw Normal View History

2017-09-14 21:21:56 +00:00
policy_module(fstools, 1.21.1)
2005-06-27 20:59:28 +00:00
########################################
#
# Declarations
#
2005-06-30 18:54:08 +00:00
2005-09-26 20:26:32 +00:00
type fsadm_t;
2005-06-27 20:59:28 +00:00
type fsadm_exec_t;
2009-06-26 14:40:13 +00:00
init_system_domain(fsadm_t, fsadm_exec_t)
2005-06-27 20:59:28 +00:00
role system_r types fsadm_t;
type fsadm_log_t;
logging_log_file(fsadm_log_t)
2005-06-27 20:59:28 +00:00
type fsadm_tmp_t;
files_tmp_file(fsadm_tmp_t)
fstools: add in filetrans for /run dir the blkid tool writes to /run/blkid/. This creates the "fstools_run_t" type an allows the transition in /run. type=AVC msg=audit(1428929528.885:149519): avc: denied { write } for pid=5590 comm="mkfs.ext4" name="/" dev="tmpfs" ino=17656 scontext=staff_u:sysadm_r:fsadm_t tcontext=system_u:object_r:var_run_t tclass=dir permissive=0 In permissive: type=AVC msg=audit(1428948565.919:160149): avc: denied { write } for pid=26197 comm="mkfs.ext4" name="/" dev="tmpfs" ino=17656 scontext=staff_u:sysadm_r:fsadm_t tcontext=system_u:object_r:var_run_t tclass=dir permissive=1 type=AVC msg=audit(1428948565.919:160149): avc: denied { add_name } for pid=26197 comm="mkfs.ext4" name="blkid" scontext=staff_u:sysadm_r:fsadm_t tcontext=system_u:object_r:var_run_t tclass=dir permissive=1 type=AVC msg=audit(1428948565.919:160149): avc: denied { create } for pid=26197 comm="mkfs.ext4" name="blkid" scontext=staff_u:sysadm_r:fsadm_t tcontext=staff_u:object_r:var_run_t tclass=dir permissive=1 type=SYSCALL msg=audit(1428948565.919:160149): arch=c000003e syscall=83 success=yes exit=0 a0=2cd79c6d214 a1=1ed a2=ffffffffffffff20 a3=539fe9bc40 items=2 ppid=28115 pid=26197 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts2 ses=2 comm="mkfs.ext4" exe="/sbin/mke2fs" subj=staff_u:sysadm_r:fsadm_t key=(null) type=CWD msg=audit(1428948565.919:160149): cwd="/root/selinux" type=PATH msg=audit(1428948565.919:160149): item=0 name="/run/" inode=17656 dev=00:13 mode=040755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:var_run_t nametype=PARENT type=PATH msg=audit(1428948565.919:160149): item=1 name="/run/blkid" inode=4062404 dev=00:13 mode=040755 ouid=0 ogid=0 rdev=00:00 obj=staff_u:object_r:var_run_t nametype=CREATE type=UNKNOWN[1327] msg=audit(1428948565.919:160149): proctitle=6D6B66732E65787434002F6465762F7A72616D31 type=AVC msg=audit(1428948565.919:160150): avc: denied { write } for pid=26197 comm="mkfs.ext4" name="blkid" dev="tmpfs" ino=4062404 scontext=staff_u:sysadm_r:fsadm_t tcontext=staff_u:object_r:var_run_t tclass=dir permissive=1 type=AVC msg=audit(1428948565.919:160150): avc: denied { add_name } for pid=26197 comm="mkfs.ext4" name="blkid.tab" scontext=staff_u:sysadm_r:fsadm_t tcontext=staff_u:object_r:var_run_t tclass=dir permissive=1 type=AVC msg=audit(1428948565.919:160150): avc: denied { create } for pid=26197 comm="mkfs.ext4" name="blkid.tab" scontext=staff_u:sysadm_r:fsadm_t tcontext=staff_u:object_r:var_run_t tclass=file permissive=1 type=AVC msg=audit(1428948565.919:160150): avc: denied { write open } for pid=26197 comm="mkfs.ext4" path="/run/blkid/blkid.tab" dev="tmpfs" ino=4062405 scontext=staff_u:sysadm_r:fsadm_t tcontext=staff_u:object_r:var_run_t tclass=file permissive=1 type=AVC msg=audit(1428948565.919:160151): avc: denied { getattr } for pid=26197 comm="mkfs.ext4" path="/run/blkid/blkid.tab" dev="tmpfs" ino=4062405 scontext=staff_u:sysadm_r:fsadm_t tcontext=staff_u:object_r:var_run_t tclass=file permissive=1 Changes from v1: - only transition on dir, not file. - add fcontext for /run/fsck too. - the audit log in the previous version was missing some lines.
2015-04-13 18:13:39 +00:00
type fsadm_run_t;
files_pid_file(fsadm_run_t)
type swapfile_t; # customizable
files_type(swapfile_t)
2005-06-27 20:59:28 +00:00
########################################
2005-06-30 18:54:08 +00:00
#
# local policy
#
2005-06-27 20:59:28 +00:00
# ipc_lock is for losetup
allow fsadm_t self:capability { dac_override dac_read_search ipc_lock sys_admin sys_rawio sys_resource sys_tty_config };
allow fsadm_t self:process { transition signal_perms getsched setsched getsession getpgid setpgid getcap setcap share getattr noatsecure siginh rlimitinh dyntransition execstack setkeycreate setsockcreate getrlimit };
2005-06-27 20:59:28 +00:00
allow fsadm_t self:fd use;
allow fsadm_t self:fifo_file rw_fifo_file_perms;
allow fsadm_t self:sock_file read_sock_file_perms;
2005-06-27 20:59:28 +00:00
allow fsadm_t self:unix_dgram_socket create_socket_perms;
allow fsadm_t self:unix_stream_socket create_stream_socket_perms;
allow fsadm_t self:unix_dgram_socket sendto;
allow fsadm_t self:unix_stream_socket connectto;
allow fsadm_t self:shm create_shm_perms;
allow fsadm_t self:sem create_sem_perms;
allow fsadm_t self:msgq create_msgq_perms;
allow fsadm_t self:msg { send receive };
can_exec(fsadm_t, fsadm_exec_t)
2006-12-12 20:08:08 +00:00
allow fsadm_t fsadm_tmp_t:dir manage_dir_perms;
allow fsadm_t fsadm_tmp_t:file manage_file_perms;
2006-02-21 18:40:44 +00:00
files_tmp_filetrans(fsadm_t, fsadm_tmp_t, { file dir })
2005-06-27 20:59:28 +00:00
fstools: add in filetrans for /run dir the blkid tool writes to /run/blkid/. This creates the "fstools_run_t" type an allows the transition in /run. type=AVC msg=audit(1428929528.885:149519): avc: denied { write } for pid=5590 comm="mkfs.ext4" name="/" dev="tmpfs" ino=17656 scontext=staff_u:sysadm_r:fsadm_t tcontext=system_u:object_r:var_run_t tclass=dir permissive=0 In permissive: type=AVC msg=audit(1428948565.919:160149): avc: denied { write } for pid=26197 comm="mkfs.ext4" name="/" dev="tmpfs" ino=17656 scontext=staff_u:sysadm_r:fsadm_t tcontext=system_u:object_r:var_run_t tclass=dir permissive=1 type=AVC msg=audit(1428948565.919:160149): avc: denied { add_name } for pid=26197 comm="mkfs.ext4" name="blkid" scontext=staff_u:sysadm_r:fsadm_t tcontext=system_u:object_r:var_run_t tclass=dir permissive=1 type=AVC msg=audit(1428948565.919:160149): avc: denied { create } for pid=26197 comm="mkfs.ext4" name="blkid" scontext=staff_u:sysadm_r:fsadm_t tcontext=staff_u:object_r:var_run_t tclass=dir permissive=1 type=SYSCALL msg=audit(1428948565.919:160149): arch=c000003e syscall=83 success=yes exit=0 a0=2cd79c6d214 a1=1ed a2=ffffffffffffff20 a3=539fe9bc40 items=2 ppid=28115 pid=26197 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts2 ses=2 comm="mkfs.ext4" exe="/sbin/mke2fs" subj=staff_u:sysadm_r:fsadm_t key=(null) type=CWD msg=audit(1428948565.919:160149): cwd="/root/selinux" type=PATH msg=audit(1428948565.919:160149): item=0 name="/run/" inode=17656 dev=00:13 mode=040755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:var_run_t nametype=PARENT type=PATH msg=audit(1428948565.919:160149): item=1 name="/run/blkid" inode=4062404 dev=00:13 mode=040755 ouid=0 ogid=0 rdev=00:00 obj=staff_u:object_r:var_run_t nametype=CREATE type=UNKNOWN[1327] msg=audit(1428948565.919:160149): proctitle=6D6B66732E65787434002F6465762F7A72616D31 type=AVC msg=audit(1428948565.919:160150): avc: denied { write } for pid=26197 comm="mkfs.ext4" name="blkid" dev="tmpfs" ino=4062404 scontext=staff_u:sysadm_r:fsadm_t tcontext=staff_u:object_r:var_run_t tclass=dir permissive=1 type=AVC msg=audit(1428948565.919:160150): avc: denied { add_name } for pid=26197 comm="mkfs.ext4" name="blkid.tab" scontext=staff_u:sysadm_r:fsadm_t tcontext=staff_u:object_r:var_run_t tclass=dir permissive=1 type=AVC msg=audit(1428948565.919:160150): avc: denied { create } for pid=26197 comm="mkfs.ext4" name="blkid.tab" scontext=staff_u:sysadm_r:fsadm_t tcontext=staff_u:object_r:var_run_t tclass=file permissive=1 type=AVC msg=audit(1428948565.919:160150): avc: denied { write open } for pid=26197 comm="mkfs.ext4" path="/run/blkid/blkid.tab" dev="tmpfs" ino=4062405 scontext=staff_u:sysadm_r:fsadm_t tcontext=staff_u:object_r:var_run_t tclass=file permissive=1 type=AVC msg=audit(1428948565.919:160151): avc: denied { getattr } for pid=26197 comm="mkfs.ext4" path="/run/blkid/blkid.tab" dev="tmpfs" ino=4062405 scontext=staff_u:sysadm_r:fsadm_t tcontext=staff_u:object_r:var_run_t tclass=file permissive=1 Changes from v1: - only transition on dir, not file. - add fcontext for /run/fsck too. - the audit log in the previous version was missing some lines.
2015-04-13 18:13:39 +00:00
allow fsadm_t fsadm_run_t:dir manage_dir_perms;
allow fsadm_t fsadm_run_t:file manage_file_perms;
files_pid_filetrans(fsadm_t, fsadm_run_t, dir)
# log files
2006-12-12 20:08:08 +00:00
allow fsadm_t fsadm_log_t:dir setattr;
2009-06-26 14:40:13 +00:00
manage_files_pattern(fsadm_t, fsadm_log_t, fsadm_log_t)
logging_log_filetrans(fsadm_t, fsadm_log_t, file)
2005-06-27 20:59:28 +00:00
# Enable swapping to files
allow fsadm_t swapfile_t:file { rw_file_perms swapon };
2005-06-27 20:59:28 +00:00
kernel_read_system_state(fsadm_t)
kernel_read_kernel_sysctls(fsadm_t)
kernel_request_load_module(fsadm_t)
kernel_manage_unlabeled_dirs(fsadm_t)
2005-06-27 20:59:28 +00:00
# Allow console log change (updfstab)
kernel_change_ring_buffer_level(fsadm_t)
2005-07-08 20:44:57 +00:00
# mkreiserfs needs this
kernel_getattr_proc(fsadm_t)
kernel_getattr_core_if(fsadm_t)
2005-07-08 20:44:57 +00:00
# Access to /initrd devices
kernel_rw_unlabeled_dirs(fsadm_t)
kernel_rw_unlabeled_blk_files(fsadm_t)
kernel_read_unlabeled_files(fsadm_t)
2005-06-27 20:59:28 +00:00
corecmd_exec_bin(fsadm_t)
#RedHat bug #201164
corecmd_exec_shell(fsadm_t)
# cjp: these are probably not needed:
corecmd_read_bin_files(fsadm_t)
corecmd_read_bin_pipes(fsadm_t)
corecmd_read_bin_sockets(fsadm_t)
2005-09-19 21:17:45 +00:00
dev_getattr_all_chr_files(fsadm_t)
dev_dontaudit_getattr_all_blk_files(fsadm_t)
2007-08-22 20:02:41 +00:00
dev_dontaudit_getattr_generic_files(fsadm_t)
2005-06-27 20:59:28 +00:00
# mkreiserfs and other programs need this for UUID
dev_read_rand(fsadm_t)
dev_read_urand(fsadm_t)
dev_write_kmsg(fsadm_t)
2005-06-27 20:59:28 +00:00
# Recreate /dev/cdrom.
dev_manage_generic_symlinks(fsadm_t)
# fdisk needs this for early boot
dev_manage_generic_blk_files(fsadm_t)
2005-06-27 20:59:28 +00:00
# Access to /initrd devices
dev_search_usbfs(fsadm_t)
2005-06-28 17:32:57 +00:00
# for swapon
dev_rw_sysfs(fsadm_t)
2005-07-08 20:44:57 +00:00
# Access to /initrd devices
dev_getattr_usbfs_dirs(fsadm_t)
2006-01-11 15:28:14 +00:00
# Access to /dev/mapper/control
dev_rw_lvm_control(fsadm_t)
# for losetup
dev_rw_loop_control(fsadm_t)
2005-06-27 20:59:28 +00:00
domain_use_interactive_fds(fsadm_t)
files_getattr_boot_dirs(fsadm_t)
files_list_home(fsadm_t)
files_read_usr_files(fsadm_t)
files_read_etc_files(fsadm_t)
files_manage_lost_found(fsadm_t)
# Write to /etc/mtab.
files_manage_etc_runtime_files(fsadm_t)
files_etc_filetrans_etc_runtime(fsadm_t, file)
2005-06-27 20:59:28 +00:00
fs_search_auto_mountpoints(fsadm_t)
fs_getattr_xattr_fs(fsadm_t)
fs_rw_ramfs_pipes(fsadm_t)
fs_rw_tmpfs_files(fsadm_t)
2005-06-27 20:59:28 +00:00
# remount file system to apply changes
fs_remount_xattr_fs(fsadm_t)
2005-07-08 20:44:57 +00:00
# for /dev/shm
fs_list_auto_mountpoints(fsadm_t)
2005-07-08 20:44:57 +00:00
fs_search_tmpfs(fsadm_t)
fs_getattr_tmpfs_dirs(fsadm_t)
2006-01-25 15:53:35 +00:00
fs_read_tmpfs_symlinks(fsadm_t)
# Recreate /mnt/cdrom.
files_manage_mnt_dirs(fsadm_t)
# for tune2fs
files_search_all(fsadm_t)
2005-06-27 20:59:28 +00:00
mls_file_read_all_levels(fsadm_t)
mls_file_write_all_levels(fsadm_t)
2017-04-29 15:25:13 +00:00
selinux_getattr_fs(fsadm_t)
2005-06-27 20:59:28 +00:00
storage_raw_read_fixed_disk(fsadm_t)
storage_raw_write_fixed_disk(fsadm_t)
storage_raw_read_removable_device(fsadm_t)
storage_raw_write_removable_device(fsadm_t)
storage_read_scsi_generic(fsadm_t)
2005-06-28 17:32:57 +00:00
storage_swapon_fixed_disk(fsadm_t)
2005-06-27 20:59:28 +00:00
2005-09-16 13:36:26 +00:00
term_use_console(fsadm_t)
init_use_fds(fsadm_t)
2006-02-02 21:08:12 +00:00
init_use_script_ptys(fsadm_t)
init_dontaudit_getattr_initctl(fsadm_t)
init_rw_script_stream_sockets(fsadm_t)
2005-06-27 20:59:28 +00:00
logging_send_syslog_msg(fsadm_t)
miscfiles_read_localization(fsadm_t)
# for /run/mount/utab
mount_getattr_runtime_files(fsadm_t)
2014-08-19 12:44:57 +00:00
# losetup: bind mount_loopback_t files to loop devices
mount_rw_loopback_files(fsadm_t)
2005-06-27 20:59:28 +00:00
seutil_read_config(fsadm_t)
2008-11-05 16:10:46 +00:00
userdom_use_user_terminals(fsadm_t)
2005-06-27 20:59:28 +00:00
ifdef(`distro_debian',`
term_dontaudit_use_unallocated_ttys(fsadm_t)
')
2009-04-03 14:14:43 +00:00
ifdef(`distro_redhat',`
optional_policy(`
unconfined_domain(fsadm_t)
')
')
optional_policy(`
amanda_rw_dumpdates_files(fsadm_t)
amanda_append_log_files(fsadm_t)
')
optional_policy(`
2005-06-28 17:32:57 +00:00
# for smartctl cron jobs
2009-06-26 14:40:13 +00:00
cron_system_entry(fsadm_t, fsadm_exec_t)
2005-06-28 17:32:57 +00:00
')
optional_policy(`
devicekit_read_pid_files(fsadm_t)
devicekit_append_inherited_log_files(fsadm_t)
')
optional_policy(`
hal_dontaudit_write_log(fsadm_t)
')
optional_policy(`
livecd_rw_tmp_files(fsadm_t)
')
optional_policy(`
modutils_read_module_config(fsadm_t)
modutils_read_module_deps(fsadm_t)
')
optional_policy(`
2005-06-27 20:59:28 +00:00
nis_use_ypbind(fsadm_t)
')
2006-03-09 19:02:29 +00:00
optional_policy(`
2006-03-09 19:02:29 +00:00
fs_dontaudit_write_ramfs_pipes(fsadm_t)
rhgb_stub(fsadm_t)
')
2007-08-22 20:02:41 +00:00
optional_policy(`
udev_read_db(fsadm_t)
# Xen causes losetup to run with a presumably accidentally inherited
# file handle for /run/xen-hotplug/block
udev_dontaudit_rw_pid_files(fsadm_t)
')
2007-08-22 20:02:41 +00:00
optional_policy(`
xen_append_log(fsadm_t)
xen_rw_image_files(fsadm_t)
2007-08-22 20:02:41 +00:00
')