Content-type: text/html
SELinux supports Roles Based Access Control (RBAC), some Linux roles are login roles, while other roles need to be transition into.
Note: Examples in this man page will use the staff_u SELinux user.
Non login roles are usually used for administrative tasks. For example, tasks that require root privileges. Roles control which types a user can run processes with. Roles often have default types assigned to them.
The default type for the secadm_r role is secadm_t.
The newrole program to transition directly to this role.
newrole -r secadm_r -t secadm_t
sudo is the preferred method to do transition from one role to another. You setup sudo to transition to secadm_r by adding a similar line to the /etc/sudoers file.
USERNAME ALL=(ALL) ROLE=secadm_r TYPE=secadm_t COMMAND
sudo will run COMMAND as staff_u:secadm_r:secadm_t:LEVEL
When using a a non login role, you need to setup SELinux so that your SELinux user can reach secadm_r role.
Execute the following to see all of the assigned SELinux roles:
semanage user -l
You need to add secadm_r to the staff_u user. You could setup the staff_u user to be able to use the secadm_r role with a command like:
$ semanage user -m -R 'staff_r system_r secadm_r' staff_u
SELinux policy also controls which roles can transition to a different role. You can list these rules using the following command.
sesearch --role_allow
SELinux policy allows the sysadm_r, staff_r, auditadm_r roles can transition to the secadm_r role.
The SELinux user type secadm_t can manage files labeled with the following file types. The paths listed are the default paths for these file types. Note the processes UID still need to have DAC permissions.
anon_inodefs_t
auth_cache_t
/var/cache/coolkey(/.*)?
boolean_type
cgroup_t
/cgroup
/sys/fs/cgroup
chrome_sandbox_tmpfs_t
default_context_t
/etc/selinux/([^/]*/)?contexts(/.*)?
/root/.default_contexts
dosfs_t
etc_runtime_t
/[^/]+
/etc/mtab.*
/etc/blkid(/.*)?
/etc/nologin.*
/etc/.fstab.hal..+
/halt
/fastboot
/poweroff
/etc/cmtab
/forcefsck
/.autofsck
/.suspended
/fsckoptions
/.autorelabel
/etc/securetty
/etc/nohotplug
/etc/killpower
/etc/ioctl.save
/etc/fstab.REVOKE
/etc/network/ifstate
/etc/sysconfig/hwconf
/etc/ptal/ptal-printd-like
/etc/sysconfig/iptables.save
/etc/xorg.conf.d/00-system-setup-keyboard.conf
/etc/X11/xorg.conf.d/00-system-setup-keyboard.conf
file_context_t
/etc/selinux/([^/]*/)?contexts/files(/.*)?
games_data_t
/var/games(/.*)?
/var/lib/games(/.*)?
gpg_agent_tmp_t
/home/[^/]*/.gnupg/log-socket
mail_spool_t
/var/mail(/.*)?
/var/spool/imap(/.*)?
/var/spool/mail(/.*)?
mqueue_spool_t
/var/spool/(client)?mqueue(/.*)?
/var/spool/mqueue.in(/.*)?
nfsd_rw_t
screen_home_t
/root/.screen(/.*)?
/home/[^/]*/.screen(/.*)?
/home/[^/]*/.screenrc
selinux_config_t
/etc/selinux(/.*)?
/etc/selinux/([^/]*/)?seusers
/etc/selinux/([^/]*/)?users(/.*)?
/etc/selinux/([^/]*/)?setrans.conf
selinux_login_config_t
/etc/selinux/([^/]*/)?logins(/.*)?
semanage_store_t
/etc/selinux/([^/]*/)?policy(/.*)?
/etc/selinux/([^/]*/)?modules/(active|tmp|previous)(/.*)?
/etc/share/selinux/mls(/.*)?
/etc/share/selinux/targeted(/.*)?
systemd_passwd_var_run_t
/var/run/systemd/ask-password(/.*)?
/var/run/systemd/ask-password-block(/.*)?
usbfs_t
user_fonts_cache_t
/root/.fontconfig(/.*)?
/root/.fonts/auto(/.*)?
/root/.fonts.cache-.*
/home/[^/]*/