|
Chris PeBenito |
ab58ad |
#DESC Fsadm - Disk and file system administration
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# Authors: Stephen Smalley <sds@epoch.ncsc.mil> and Timothy Fraser
|
|
Chris PeBenito |
ab58ad |
# X-Debian-Packages: util-linux e2fsprogs xfsprogs reiserfsprogs parted raidtools2 mount
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
#################################
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# Rules for the fsadm_t domain.
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# fsadm_t is the domain for disk and file system
|
|
Chris PeBenito |
ab58ad |
# administration.
|
|
Chris PeBenito |
ab58ad |
# fsadm_exec_t is the type of the corresponding programs.
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
8967bf |
type fsadm_t, domain, privlog, fs_domain, mlsfileread, mlsfilewrite;
|
|
Chris PeBenito |
ab58ad |
role system_r types fsadm_t;
|
|
Chris PeBenito |
ab58ad |
role sysadm_r types fsadm_t;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
general_domain_access(fsadm_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# for swapon
|
|
Chris PeBenito |
ab58ad |
r_dir_file(fsadm_t, sysfs_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Read system information files in /proc.
|
|
Chris PeBenito |
ab58ad |
r_dir_file(fsadm_t, proc_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Read system variables in /proc/sys
|
|
Chris PeBenito |
ab58ad |
read_sysctl(fsadm_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# for /dev/shm
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t tmpfs_t:dir { getattr search };
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t tmpfs_t:file { read write };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
base_file_read_access(fsadm_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Read /etc.
|
|
Chris PeBenito |
ab58ad |
r_dir_file(fsadm_t, etc_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Read module-related files.
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t modules_conf_t:{ file lnk_file } r_file_perms;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Read /dev directories and any symbolic links.
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t device_t:dir r_dir_perms;
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t device_t:lnk_file r_file_perms;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
uses_shlib(fsadm_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
type fsadm_exec_t, file_type, sysadmfile, exec_type;
|
|
Chris PeBenito |
ab58ad |
domain_auto_trans(initrc_t, fsadm_exec_t, fsadm_t)
|
|
Chris PeBenito |
ab58ad |
ifdef(`targeted_policy', `', `
|
|
Chris PeBenito |
ab58ad |
domain_auto_trans(sysadm_t, fsadm_exec_t, fsadm_t)
|
|
Chris PeBenito |
ab58ad |
')
|
|
Chris PeBenito |
ab58ad |
tmp_domain(fsadm)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# remount file system to apply changes
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t fs_t:filesystem remount;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t fs_t:filesystem getattr;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# mkreiserfs needs this
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t proc_t:filesystem getattr;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# mkreiserfs and other programs need this for UUID
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t { urandom_device_t random_device_t }:chr_file { getattr read };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Use capabilities. ipc_lock is for losetup
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t self:capability { ipc_lock sys_rawio sys_admin sys_tty_config dac_override dac_read_search };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Write to /etc/mtab.
|
|
Chris PeBenito |
ab58ad |
file_type_auto_trans(fsadm_t, etc_t, etc_runtime_t, file)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Inherit and use descriptors from init.
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t init_t:fd use;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Run other fs admin programs in the fsadm_t domain.
|
|
Chris PeBenito |
ab58ad |
can_exec(fsadm_t, fsadm_exec_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Access disk devices.
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t fixed_disk_device_t:devfile_class_set rw_file_perms;
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t removable_device_t:devfile_class_set rw_file_perms;
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t scsi_generic_device_t:chr_file r_file_perms;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Access lost+found.
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t lost_found_t:dir create_dir_perms;
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t lost_found_t:{ file sock_file fifo_file } create_file_perms;
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t lost_found_t:lnk_file create_lnk_perms;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t file_t:dir { search read getattr rmdir create };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Recreate /mnt/cdrom.
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t mnt_t:dir { search read getattr rmdir create };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Recreate /dev/cdrom.
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t device_t:dir rw_dir_perms;
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t device_t:lnk_file { unlink create };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Enable swapping to devices and files
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t swapfile_t:file { getattr swapon };
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t fixed_disk_device_t:blk_file { getattr swapon };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Allow console log change (updfstab)
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t kernel_t:system syslog_console;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Access terminals.
|
|
Chris PeBenito |
ab58ad |
can_access_pty(fsadm_t, initrc)
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t { admin_tty_type devtty_t console_device_t }:chr_file rw_file_perms;
|
|
Chris PeBenito |
ab58ad |
ifdef(`gnome-pty-helper.te', `allow fsadm_t sysadm_gph_t:fd use;')
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t privfd:fd use;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
read_locale(fsadm_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# for smartctl cron jobs
|
|
Chris PeBenito |
ab58ad |
system_crond_entry(fsadm_exec_t, fsadm_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Access to /initrd devices
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t { file_t unlabeled_t }:dir rw_dir_perms;
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t { file_t unlabeled_t }:blk_file rw_file_perms;
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t usbfs_t:dir { getattr search };
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t ramfs_t:fifo_file rw_file_perms;
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t device_type:chr_file getattr;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# for tune2fs
|
|
Chris PeBenito |
ab58ad |
allow fsadm_t file_type:dir { getattr search };
|