user_u-: 普通用户登录系统后预设;
system_u-:开机过程中系统进程的预设;
root-: root登录后预设;
在targeted policy中users不是很重要;
在strict policy中比较重要,的有预设的selinuxusers都以 "_u"结尾,root除外。
2.role
文件与目录的role,通常是object_r;
程序的role,通常是system_r;
用户的role,targetedpolicy为system_r;
strict policy为sysadm_r,staff_r,user_r
用户的role,类似于系统中的GID,不同的角色具备不同的权限;用户可以具备多个role;但是同一时间内只能使用一role;
role是RBAC的基础;
3.type
type:用来将主体与客体划分为不同的组,组每个主体和系统中的客体定义了一个类型;为进程运行提供最低的权限环境。
当一个类型与执行的进程关联时,该type也称为domain,也叫安全上下文。
域或安全上下文是一个进程允许操作的列表,决字一个进程可以对哪种类型进行操作。
1.1.3 SElinux配置文件
vi/etc/selinux/config
# This filecontrols the state of SELinux on the system.
# SELINUX= cantake one of these three values:
# enforcing -SELinux security policy is enforced.
# permissive -SELinux prints warnings instead of enforcing.
# disabled -SELinux is fully disabled.
SELINUX=enforcing
#SELINUX=disabled
# SELINUXTYPE=type of policy in use. Possible values are:
# targeted -Only targeted network daemons are protected.
# strict -Full SELinux protection.
SELINUXTYPE=targeted
#SELINUX有「disabled」「permissive」,「enforcing」3种选择。
1.模式的设置
enforcing:强制模式,只要selinux不允许,就无法执行
permissive:警告模式,将该事件记录下来,依然允许执行
disabled:关闭selinux;停用,启用需要重启计算机。
2.策略的设置
targeted:保护常见的网络服务,是selinux的默认值;
stric:提供RBAC的policy,具备完整的保护功能,保护网络服务,一般指令及应用程序。
策略改变后,需要重新启动计算机。
也

本文详细介绍了SELinux的管理与配置,包括用户、角色和类型的定义,以及策略设置。重点讲解了如何查看和切换SELinux的状态,如何修改文件和目录的安全上下文,以及与Samba和NFS的集成。此外,文章还提及了Android校招面试中关于SELinux的相关知识,强调了知识技能提升的重要性。

1272

被折叠的 条评论
为什么被折叠?



